Class: Fog::Volume::OpenStack::Volume

Inherits:
Model
  • Object
show all
Defined in:
lib/rackspace-fog/openstack/models/volume/volume.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

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

#destroyObject



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

#saveObject



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