aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_storage/service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/active_storage/service.rb')
-rw-r--r--lib/active_storage/service.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/active_storage/service.rb b/lib/active_storage/service.rb
new file mode 100644
index 0000000000..038b6ccb53
--- /dev/null
+++ b/lib/active_storage/service.rb
@@ -0,0 +1,41 @@
+# Abstract class serving as an interface for concrete services.
+class ActiveStorage::Service
+ 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)
+ 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
+
+ def bytesize(key)
+ raise NotImplementedError
+ end
+
+ def checksum(key)
+ raise NotImplementedError
+ end
+end