Class: Ggggsss::S3Fetcher
- Inherits:
-
Object
- Object
- Ggggsss::S3Fetcher
- Defined in:
- lib/ggggsss.rb
Instance Attribute Summary collapse
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
- #fetch! ⇒ Object
-
#initialize(bucket_name, path) ⇒ S3Fetcher
constructor
A new instance of S3Fetcher.
Constructor Details
#initialize(bucket_name, path) ⇒ S3Fetcher
Returns a new instance of S3Fetcher.
49 50 51 52 53 |
# File 'lib/ggggsss.rb', line 49 def initialize(bucket_name, path) @bucket_name = bucket_name @path = path @objects = [] end |
Instance Attribute Details
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
47 48 49 |
# File 'lib/ggggsss.rb', line 47 def objects @objects end |
Instance Method Details
#fetch! ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/ggggsss.rb', line 55 def fetch! s3 = Aws::S3::Resource.new bucket = s3.bucket(@bucket_name) bucket.objects(prefix: @path).each do |object_summary| object_output = object_summary.get @objects << S3Object.new(key: object_summary.key, body: object_output.body) end end |