Class: SpreeCmCommissioner::S3PresignedUrl
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::S3PresignedUrl
- Includes:
- ActiveModel::Serialization
- Defined in:
- app/models/spree_cm_commissioner/s3_presigned_url.rb
Instance Attribute Summary collapse
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#id ⇒ Object
Returns the value of attribute id.
-
#s3_direct_post ⇒ Object
readonly
Returns the value of attribute s3_direct_post.
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(bucket_name, object_key, uuid = nil) ⇒ S3PresignedUrl
constructor
A new instance of S3PresignedUrl.
Constructor Details
#initialize(bucket_name, object_key, uuid = nil) ⇒ S3PresignedUrl
Returns a new instance of S3PresignedUrl.
14 15 16 17 18 19 20 21 22 |
# File 'app/models/spree_cm_commissioner/s3_presigned_url.rb', line 14 def initialize(bucket_name, object_key, uuid = nil) @id = uuid.presence || generate_secure_random if object_key.blank? @error_message = I18n.t('s3_signed_url.missing_file_name') else @s3_direct_post = presigned_post(bucket_name, object_key) end end |
Instance Attribute Details
#error_message ⇒ Object
Returns the value of attribute error_message.
5 6 7 |
# File 'app/models/spree_cm_commissioner/s3_presigned_url.rb', line 5 def @error_message end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'app/models/spree_cm_commissioner/s3_presigned_url.rb', line 5 def id @id end |
#s3_direct_post ⇒ Object (readonly)
Returns the value of attribute s3_direct_post.
4 5 6 |
# File 'app/models/spree_cm_commissioner/s3_presigned_url.rb', line 4 def s3_direct_post @s3_direct_post end |
Instance Method Details
#host ⇒ Object
10 11 12 |
# File 'app/models/spree_cm_commissioner/s3_presigned_url.rb', line 10 def host URI.parse(url).host end |