1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/active_storage/service.rb

35 lines
795 B
Ruby
Raw Normal View History

# Abstract class serving as an interface for concrete services.
class ActiveStorage::Service
2017-07-06 10:01:11 -04:00
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)
2017-07-04 12:52:11 -04:00
rescue LoadError => e
puts "Couldn't configure service: #{service} (#{e.message})"
end
end
2017-07-06 10:01:11 -04:00
def upload(key, io, checksum: nil)
2017-07-01 06:10:11 -04:00
raise NotImplementedError
2017-06-30 13:12:58 -04:00
end
def download(key)
2017-07-01 06:10:11 -04:00
raise NotImplementedError
2017-06-30 13:12:58 -04:00
end
def delete(key)
2017-07-01 06:10:11 -04:00
raise NotImplementedError
2017-06-30 13:12:58 -04:00
end
2017-07-03 15:08:36 -04:00
def exist?(key)
2017-07-01 06:10:11 -04:00
raise NotImplementedError
2017-06-30 13:12:58 -04:00
end
def url(key, expires_in:, disposition:, filename:)
2017-07-01 06:10:11 -04:00
raise NotImplementedError
2017-06-30 13:12:58 -04:00
end
2017-06-30 18:14:22 -04:00
end