Module: Shrine::Plugins::Lambda
- Defined in:
- lib/shrine/plugins/shrine-lambda.rb,
lib/shrine/plugins/lambda/version.rb
Defined Under Namespace
Modules: AttacherClassMethods, AttacherMethods, ClassMethods
Constant Summary collapse
- SETTINGS =
{ access_key_id: :optional, callback_url: :required, convert_params: :optional, endpoint: :optional, log_formatter: :optional, log_level: :optional, logger: :optional, profile: :optional, region: :optional, retry_limit: :optional, secret_access_key: :optional, session_token: :optional, stub_responses: :optional, validate_params: :optional }.freeze
- Error =
Class.new(Shrine::Error)
- VERSION =
'0.1.1'
Class Method Summary collapse
-
.configure(uploader, settings = {}) ⇒ Object
If promoting was not yet overridden, it is set to automatically trigger Lambda processing defined in ‘Shrine#lambda_process`.
-
.load_dependencies(uploader, _opts = {}) ⇒ Object
It loads the backgrounding plugin, so that it can override promoting.
Class Method Details
.configure(uploader, settings = {}) ⇒ Object
If promoting was not yet overridden, it is set to automatically trigger Lambda processing defined in ‘Shrine#lambda_process`.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/shrine/plugins/shrine-lambda.rb', line 28 def self.configure(uploader, settings = {}) SETTINGS.each do |key, value| raise Error, "The :#{key} option is required for Lambda plugin" if value == :required && settings[key].nil? uploader.opts[key] = settings.delete(key) if settings[key] end @logger = if Shrine.respond_to?(:logger) Shrine.logger elsif uploader.respond_to?(:logger) uploader.logger end uploader.opts[:backgrounding_promote] = proc { lambda_process } return unless @logger settings.each do |key, _value| @logger.info "The :#{key} option is not supported by the Lambda plugin" end end |
.load_dependencies(uploader, _opts = {}) ⇒ Object
It loads the backgrounding plugin, so that it can override promoting.
51 52 53 |
# File 'lib/shrine/plugins/shrine-lambda.rb', line 51 def self.load_dependencies(uploader, _opts = {}) uploader.plugin :backgrounding end |