Class: ActiveStorage::Service::SaasService
- Inherits:
-
ActiveStorage::Service
- Object
- ActiveStorage::Service
- ActiveStorage::Service::SaasService
- Defined in:
- lib/active_storage/service/saas_service.rb
Overview
# config/storage.yml saas:
service: Saas
default_service: qinium
url_expires_in: 300
qinium:
service: Qinium
access_key:
secret_key:
bucket:
put_policy_options:
expires_in: 3600
Instance Attribute Summary collapse
-
#blob ⇒ Object
readonly
Returns the value of attribute blob.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #analyzers ⇒ Object
- #default_service ⇒ Object
- #form_data_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:) ⇒ Object
- #http_method_for_direct_upload ⇒ Object
- #http_response_type_for_direct_upload ⇒ Object
-
#initialize(options) ⇒ SaasService
constructor
A new instance of SaasService.
- #name=(_) ⇒ Object
- #respond_to_missing?(method, _include_all) ⇒ Boolean
- #service ⇒ Object
Constructor Details
#initialize(options) ⇒ SaasService
Returns a new instance of SaasService.
19 20 21 22 23 |
# File 'lib/active_storage/service/saas_service.rb', line 19 def initialize() super() @blob = .delete(:blob) @options = end |
Instance Attribute Details
#blob ⇒ Object (readonly)
Returns the value of attribute blob.
17 18 19 |
# File 'lib/active_storage/service/saas_service.rb', line 17 def blob @blob end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'lib/active_storage/service/saas_service.rb', line 17 def @options end |
Instance Method Details
#analyzers ⇒ Object
70 71 72 73 |
# File 'lib/active_storage/service/saas_service.rb', line 70 def analyzers service_class = service.class service_class.respond_to?(:analyzers) ? service_class.analyzers : [] end |
#default_service ⇒ Object
79 80 81 |
# File 'lib/active_storage/service/saas_service.rb', line 79 def default_service @default_service ||= ActiveStorage::Blob.services.fetch(@options[:default_service]) end |
#form_data_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/active_storage/service/saas_service.rb', line 58 def form_data_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:) if service.respond_to?(:form_data_for_direct_upload) service.form_data_for_direct_upload key, expires_in: expires_in, content_type: content_type, content_length: content_length, checksum: checksum else {} end end |
#http_method_for_direct_upload ⇒ Object
50 51 52 |
# File 'lib/active_storage/service/saas_service.rb', line 50 def http_method_for_direct_upload service.http_method_for_direct_upload if service.respond_to?(:http_method_for_direct_upload) end |
#http_response_type_for_direct_upload ⇒ Object
54 55 56 |
# File 'lib/active_storage/service/saas_service.rb', line 54 def http_response_type_for_direct_upload service.http_response_type_for_direct_upload if service.respond_to?(:http_response_type_for_direct_upload) end |
#name=(_) ⇒ Object
34 35 36 |
# File 'lib/active_storage/service/saas_service.rb', line 34 def name=(_) # do nothing, name should be service.name end |
#respond_to_missing?(method, _include_all) ⇒ Boolean
46 47 48 |
# File 'lib/active_storage/service/saas_service.rb', line 46 def respond_to_missing?(method, _include_all) service.respond_to?(method) end |
#service ⇒ Object
75 76 77 |
# File 'lib/active_storage/service/saas_service.rb', line 75 def service @service ||= (blob && ActiveStorageSaas.service_resolver.call(blob)) || default_service end |