Class: S3FileHandler::File::Read
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- S3FileHandler::File::Read
- Defined in:
- lib/s3_file_handler/file/read.rb
Instance Attribute Summary collapse
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#file_key ⇒ Object
readonly
Returns the value of attribute file_key.
Attributes inherited from BaseOperation
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(bucket_name, file_key, client: S3FileHandler.client) ⇒ Read
constructor
A new instance of Read.
Constructor Details
#initialize(bucket_name, file_key, client: S3FileHandler.client) ⇒ Read
Returns a new instance of Read.
8 9 10 11 12 13 |
# File 'lib/s3_file_handler/file/read.rb', line 8 def initialize(bucket_name, file_key, client: S3FileHandler.client) super(client: client) @bucket_name = bucket_name @file_key = file_key end |
Instance Attribute Details
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
6 7 8 |
# File 'lib/s3_file_handler/file/read.rb', line 6 def bucket_name @bucket_name end |
#file_key ⇒ Object (readonly)
Returns the value of attribute file_key.
6 7 8 |
# File 'lib/s3_file_handler/file/read.rb', line 6 def file_key @file_key end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/s3_file_handler/file/read.rb', line 15 def execute handle_aws_errors do response = client.get_object(bucket: bucket_name, key: file_key) result({ content: response.body.read, metadata: response. }) end end |