class Deltacloud::StorageVolume

Attributes

actions[RW]
capacity[RW]
created[RW]
description[RW]
device[RW]
instance_id[RW]
kind[RW]
name[RW]
realm_id[RW]
state[RW]

Public Instance Methods

to_hash(context) click to toggle source
# File lib/deltacloud/models/storage_volume.rb, line 31
def to_hash(context)
  r = {
    :id => self.id,
    :href => context.storage_volume_url(self.id),
    :name => name,
    :description => description,
    :state => state,
    :created => created,
    :realm => { :id => realm_id, :href => context.realm_url(realm_id), :rel => :realm },
    :device => device,
    :kind => kind,
    :capacity => capacity,
  }
  r[:actions] = (actions || []).map { |a|
    { :href => context.send("#{a}_storage_volume_url", self.id), :rel => a }
  }
  if instance_id
    r[:instance] = { :id => instance_id, :href => context.instance_url(instance_id), :rel => :instance }
  else
    r[:instance] = {}
  end
  r
end