Class: Fog::Rackspace::Files::File
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::Files::File
show all
- Defined in:
- lib/fog/rackspace/models/files/file.rb
Instance Attribute Summary collapse
Attributes inherited from Model
#connection
Instance Method Summary
collapse
Methods inherited from Model
#_dump, _load, aliases, attribute, attributes, #attributes, #collection, identity, #identity, #initialize, #inspect, #merge_attributes, #new_record?, #reload, #requires, #to_json, #wait_for
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(options = {})
requires :body, :directory, :key
data = connection.put_object(directory.name, @key, @body, options)
@etag = data.['ETag']
true
end
|