Class: QueueryClient::S3DataFileBundle
- Inherits:
-
DataFileBundle
- Object
- DataFileBundle
- QueueryClient::S3DataFileBundle
- Defined in:
- lib/queuery_client/s3_data_file_bundle.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #data_files ⇒ Object
-
#initialize(bucket, prefix, s3_client: nil, logger: Logger.new($stderr)) ⇒ S3DataFileBundle
constructor
A new instance of S3DataFileBundle.
- #url ⇒ Object
Methods inherited from DataFileBundle
Constructor Details
#initialize(bucket, prefix, s3_client: nil, logger: Logger.new($stderr)) ⇒ S3DataFileBundle
Returns a new instance of S3DataFileBundle.
8 9 10 11 12 13 |
# File 'lib/queuery_client/s3_data_file_bundle.rb', line 8 def initialize(bucket, prefix, s3_client: nil, logger: Logger.new($stderr)) @s3_client = s3_client || Aws::S3::Client.new # Use env to inject credentials @bucket = bucket @prefix = prefix @logger = logger end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
15 16 17 |
# File 'lib/queuery_client/s3_data_file_bundle.rb', line 15 def bucket @bucket end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
17 18 19 |
# File 'lib/queuery_client/s3_data_file_bundle.rb', line 17 def logger @logger end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
16 17 18 |
# File 'lib/queuery_client/s3_data_file_bundle.rb', line 16 def prefix @prefix end |
Instance Method Details
#data_files ⇒ Object
23 24 25 26 |
# File 'lib/queuery_client/s3_data_file_bundle.rb', line 23 def data_files b = Aws::S3::Resource.new(client: @s3_client).bucket(@bucket) b.objects(prefix: @prefix).map {|obj| S3DataFile.new(obj) } end |
#url ⇒ Object
19 20 21 |
# File 'lib/queuery_client/s3_data_file_bundle.rb', line 19 def url "s3://#{@bucket}/#{@prefix}" end |