Class: Fog::AWS::S3::Object
- Defined in:
- lib/fog/aws/models/s3/object.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#content_length ⇒ Object
Returns the value of attribute content_length.
-
#etag ⇒ Object
Returns the value of attribute etag.
-
#key ⇒ Object
Returns the value of attribute key.
-
#last_modified ⇒ Object
Returns the value of attribute last_modified.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#size ⇒ Object
Returns the value of attribute size.
-
#storage_class ⇒ Object
Returns the value of attribute storage_class.
Instance Method Summary collapse
- #copy(target_bucket_name, target_object_key) ⇒ Object
- #delete ⇒ Object
-
#initialize(attributes = {}) ⇒ Object
constructor
A new instance of Object.
- #save(options = {}) ⇒ Object
Methods inherited from Model
Constructor Details
#initialize(attributes = {}) ⇒ Object
Returns a new instance of Object.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fog/aws/models/s3/object.rb', line 16 def initialize(attributes = {}) remap_attributes(attributes, { 'Content-Length' => :content_length, 'ETag' => :etag, 'Key' => :key, 'LastModified' => :last_modified, 'Last-Modified' => :last_modified, 'Size' => :size, 'StorageClass' => :storage_class }) super end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def body @body end |
#content_length ⇒ Object
Returns the value of attribute content_length.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def content_length @content_length end |
#etag ⇒ Object
Returns the value of attribute etag.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def etag @etag end |
#key ⇒ Object
Returns the value of attribute key.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def key @key end |
#last_modified ⇒ Object
Returns the value of attribute last_modified.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def last_modified @last_modified end |
#owner ⇒ Object
Returns the value of attribute owner.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def owner @owner end |
#size ⇒ Object
Returns the value of attribute size.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def size @size end |
#storage_class ⇒ Object
Returns the value of attribute storage_class.
7 8 9 |
# File 'lib/fog/aws/models/s3/object.rb', line 7 def storage_class @storage_class end |
Instance Method Details
#copy(target_bucket_name, target_object_key) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fog/aws/models/s3/object.rb', line 37 def copy(target_bucket_name, target_object_key) data = connection.copy_object(bucket.name, key, target_bucket_name, target_object_key).body copy = self.dup copy_data = {} for key, value in data if ['ETag', 'LastModified'].include?(key) copy_data[key] = value end end copy.update_attributes(copy_data) copy end |
#delete ⇒ Object
50 51 52 |
# File 'lib/fog/aws/models/s3/object.rb', line 50 def delete connection.delete_object(bucket, key) end |
#save(options = {}) ⇒ Object
62 63 64 65 |
# File 'lib/fog/aws/models/s3/object.rb', line 62 def save( = {}) data = connection.put_object(bucket.name, key, body, ) @etag = data.headers['ETag'] end |