Class: Fog::Volume::OpenStack::Volume
- Defined in:
- lib/rackspace-fog/openstack/models/volume/volume.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Volume
constructor
A new instance of Volume.
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #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, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Volume
Returns a new instance of Volume.
22 23 24 25 |
# File 'lib/rackspace-fog/openstack/models/volume/volume.rb', line 22 def initialize(attributes) @connection = attributes[:connection] super end |
Instance Method Details
#destroy ⇒ Object
34 35 36 37 38 |
# File 'lib/rackspace-fog/openstack/models/volume/volume.rb', line 34 def destroy requires :id connection.delete_volume(id) true end |
#save ⇒ Object
27 28 29 30 31 32 |
# File 'lib/rackspace-fog/openstack/models/volume/volume.rb', line 27 def save requires :display_name, :size data = connection.create_volume(display_name, display_description, size, attributes) merge_attributes(data.body['volume']) true end |