Class: ActiveStorage::Service::VstorageService
- Inherits:
-
S3Service
- Object
- S3Service
- ActiveStorage::Service::VstorageService
- Defined in:
- lib/active_storage/service/vstorage_service.rb
Instance Attribute Summary collapse
-
#authorization ⇒ Object
readonly
Returns the value of attribute authorization.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
-
#initialize(bucket:, upload: {}, public: false, **options) ⇒ VstorageService
constructor
A new instance of VstorageService.
- #url_for_direct_upload(key, expires_in:) ⇒ Object
Constructor Details
#initialize(bucket:, upload: {}, public: false, **options) ⇒ VstorageService
Returns a new instance of VstorageService.
15 16 17 18 19 20 21 22 23 |
# File 'lib/active_storage/service/vstorage_service.rb', line 15 def initialize(bucket:, upload: {}, public: false, **) @region = [:region].downcase @project_id = upload.delete(:project_id) @client_id = upload.delete(:client_id) @client_secret = upload.delete(:client_secret) @authorization = Base64.strict_encode64("#{@client_id}:#{@client_secret}") super(bucket: bucket, upload: upload, public: public, **) end |
Instance Attribute Details
#authorization ⇒ Object (readonly)
Returns the value of attribute authorization.
9 10 11 |
# File 'lib/active_storage/service/vstorage_service.rb', line 9 def @authorization end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
9 10 11 |
# File 'lib/active_storage/service/vstorage_service.rb', line 9 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
9 10 11 |
# File 'lib/active_storage/service/vstorage_service.rb', line 9 def client_secret @client_secret end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
9 10 11 |
# File 'lib/active_storage/service/vstorage_service.rb', line 9 def project_id @project_id end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
9 10 11 |
# File 'lib/active_storage/service/vstorage_service.rb', line 9 def region @region end |
Instance Method Details
#url_for_direct_upload(key, expires_in:) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/active_storage/service/vstorage_service.rb', line 25 def url_for_direct_upload(key, expires_in:, **) instrument(:url, key: key) do |payload| generated_url = temp_url(bucket, key, expires_in) payload[:url] = generated_url generated_url end end |