Module: Shrine::Plugins::Transloadit
- Defined in:
- lib/shrine/plugins/transloadit.rb
Defined Under Namespace
Modules: AttacherClassMethods, AttacherMethods, ClassMethods, FileMethods, InstanceMethods Classes: TransloaditFile
Class Method Summary collapse
-
.configure(uploader, opts = {}) ⇒ Object
Accepts Transloadit credentials via ‘:auth_key` and `:auth_secret`.
-
.load_dependencies(uploader, opts = {}) ⇒ Object
It loads the backgrounding plugin, so that it can override promoting.
Class Method Details
.configure(uploader, opts = {}) ⇒ Object
Accepts Transloadit credentials via ‘:auth_key` and `:auth_secret`.
If :cache storage wasn’t assigned, it will be assigned to a URL storage for direct uploads.
If promoting was not yet overriden, it is set to automatically trigger Transloadit processing defined in ‘Shrine#transloadit_process`.
17 18 19 20 21 22 23 24 25 |
# File 'lib/shrine/plugins/transloadit.rb', line 17 def self.configure(uploader, opts = {}) uploader.opts[:transloadit_auth_key] = opts.fetch(:auth_key, uploader.opts[:transloadit_auth_key]) uploader.opts[:transloadit_auth_secret] = opts.fetch(:auth_secret, uploader.opts[:transloadit_auth_secret]) raise Error, "The :auth_key is required for transloadit plugin" if uploader.opts[:transloadit_auth_key].nil? raise Error, "The :auth_secret is required for transloadit plugin" if uploader.opts[:transloadit_auth_secret].nil? uploader.opts[:backgrounding_promote] ||= proc { transloadit_process } end |
.load_dependencies(uploader, opts = {}) ⇒ Object
It loads the backgrounding plugin, so that it can override promoting.
28 29 30 |
# File 'lib/shrine/plugins/transloadit.rb', line 28 def self.load_dependencies(uploader, opts = {}) uploader.plugin :backgrounding end |