Class: Fog::AWS::S3::Objects
- Inherits:
-
Collection
- Object
- Collection
- Fog::AWS::S3::Objects
- Defined in:
- lib/fog/aws/models/s3/objects.rb
Instance Attribute Summary collapse
-
#is_truncated ⇒ Object
Returns the value of attribute is_truncated.
-
#marker ⇒ Object
Returns the value of attribute marker.
-
#max_keys ⇒ Object
Returns the value of attribute max_keys.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #create(attributes = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Objects
constructor
A new instance of Objects.
- #new(attributes = {}) ⇒ Object
Methods inherited from Collection
Constructor Details
#initialize(attributes = {}) ⇒ Objects
Returns a new instance of Objects.
12 13 14 15 16 17 18 19 20 |
# File 'lib/fog/aws/models/s3/objects.rb', line 12 def initialize(attributes = {}) remap_attributes(attributes, { 'IsTruncated' => :is_truncated, 'Marker' => :marker, 'MaxKeys' => :max_keys, 'Prefix' => :prefix }) super end |
Instance Attribute Details
#is_truncated ⇒ Object
Returns the value of attribute is_truncated.
7 8 9 |
# File 'lib/fog/aws/models/s3/objects.rb', line 7 def is_truncated @is_truncated end |
#marker ⇒ Object
Returns the value of attribute marker.
7 8 9 |
# File 'lib/fog/aws/models/s3/objects.rb', line 7 def marker @marker end |
#max_keys ⇒ Object
Returns the value of attribute max_keys.
7 8 9 |
# File 'lib/fog/aws/models/s3/objects.rb', line 7 def max_keys @max_keys end |
#prefix ⇒ Object
Returns the value of attribute prefix.
7 8 9 |
# File 'lib/fog/aws/models/s3/objects.rb', line 7 def prefix @prefix end |
Instance Method Details
#all(options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/aws/models/s3/objects.rb', line 22 def all( = {}) data = connection.get_bucket(bucket.name, ).body objects_data = {} for key, value in data if ['IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(key) objects_data[key] = value end end objects = Fog::AWS::S3::Objects.new({ :bucket => bucket, :connection => connection }.merge!(objects_data)) data['Contents'].each do |object| owner = Fog::AWS::S3::Owner.new(object.delete('Owner').merge!(:connection => connection)) objects << Fog::AWS::S3::Object.new({ :bucket => bucket, :connection => connection, :owner => owner }.merge!(object)) end objects end |
#create(attributes = {}) ⇒ Object
45 46 47 48 49 |
# File 'lib/fog/aws/models/s3/objects.rb', line 45 def create(attributes = {}) object = new(attributes) object.save object end |