Class: Deltacloud::Address

Inherits:
BaseModel show all
Defined in:
lib/deltacloud/models/address.rb

Instance Attribute Summary collapse

Attributes inherited from BaseModel

#description, #name

Instance Method Summary collapse

Methods inherited from BaseModel

attr_accessor, attributes, #attributes, #id, #to_entity

Constructor Details

#initialize(init = nil) ⇒ Address



21
22
23
# File 'lib/deltacloud/models/address.rb', line 21

def initialize(init=nil)
  super(init)
end

Instance Attribute Details

#instance_idObject

Returns the value of attribute instance_id.



19
20
21
# File 'lib/deltacloud/models/address.rb', line 19

def instance_id
  @instance_id
end

Instance Method Details

#associated?Boolean



25
26
27
# File 'lib/deltacloud/models/address.rb', line 25

def associated?
  !self.instance_id.nil?
end

#to_hash(context) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/deltacloud/models/address.rb', line 29

def to_hash(context)
  r = {
    :id => self.id,
    :href => context.address_url(self.id),
    :associated => associated?
  }
  r[:instance_id] = instance_id if associated?
  r
end