Class: S3FileHandler::Folder::Create
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- S3FileHandler::Folder::Create
- Defined in:
- lib/s3_file_handler/folder/create.rb
Instance Attribute Summary collapse
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#folder_name ⇒ Object
readonly
Returns the value of attribute folder_name.
Attributes inherited from BaseOperation
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(bucket_name, folder_name, client: S3FileHandler.client) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(bucket_name, folder_name, client: S3FileHandler.client) ⇒ Create
Returns a new instance of Create.
8 9 10 11 12 13 |
# File 'lib/s3_file_handler/folder/create.rb', line 8 def initialize(bucket_name, folder_name, client: S3FileHandler.client) super(client: client) @bucket_name = bucket_name @folder_name = folder_name.end_with?('/') ? folder_name : "#{folder_name}/" end |
Instance Attribute Details
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
6 7 8 |
# File 'lib/s3_file_handler/folder/create.rb', line 6 def bucket_name @bucket_name end |
#folder_name ⇒ Object (readonly)
Returns the value of attribute folder_name.
6 7 8 |
# File 'lib/s3_file_handler/folder/create.rb', line 6 def folder_name @folder_name end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/s3_file_handler/folder/create.rb', line 15 def execute handle_aws_errors do client.put_object( bucket: bucket_name, key: folder_name ) result({ bucket: bucket_name, folder: folder_name, status: 'created' }) end end |