aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_storage/service.rb
blob: 9aab654d80d900448980698f0eae1f03044bf1ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Abstract class serving as an interface for concrete services.
class ActiveStorage::Service
  class ActiveStorage::IntegrityError < StandardError; end

  def self.configure(service, **options)
    begin
      require "active_storage/service/#{service.to_s.downcase}_service"
      ActiveStorage::Service.const_get(:"#{service}Service").new(**options)
    rescue LoadError => e
      puts "Couldn't configure service: #{service} (#{e.message})"
    end
  end


  def upload(key, io, checksum: nil)
    raise NotImplementedError
  end

  def download(key)
    raise NotImplementedError
  end

  def delete(key)
    raise NotImplementedError
  end

  def exist?(key)
    raise NotImplementedError
  end

  def url(key, expires_in:, disposition:, filename:)
    raise NotImplementedError
  end
end