Class: Fog::Rackspace::Files::File
- Defined in:
- lib/fog/rackspace/models/files/file.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
#collection, #initialize, #inspect, #reload, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
11 12 13 |
# File 'lib/fog/rackspace/models/files/file.rb', line 11 def body @body end |
Instance Method Details
#destroy ⇒ Object
29 30 31 32 33 |
# File 'lib/fog/rackspace/models/files/file.rb', line 29 def destroy requires :directory, :key connection.delete_object(directory.name, @key) true end |
#directory ⇒ Object
25 26 27 |
# File 'lib/fog/rackspace/models/files/file.rb', line 25 def directory @directory end |
#owner=(new_owner) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/fog/rackspace/models/files/file.rb', line 35 def owner=(new_owner) if new_owner @owner = { :display_name => new_owner['DisplayName'], :id => new_owner['ID'] } end end |
#save(options = {}) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/fog/rackspace/models/files/file.rb', line 44 def save( = {}) requires :body, :directory, :key data = connection.put_object(directory.name, @key, @body, ) @etag = data.headers['ETag'] true end |