Class: Deltacloud::Address
- Defined in:
- lib/deltacloud/models/address.rb
Instance Attribute Summary collapse
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
Attributes inherited from BaseModel
Instance Method Summary collapse
- #associated? ⇒ Boolean
-
#initialize(init = nil) ⇒ Address
constructor
A new instance of Address.
- #to_hash(context) ⇒ Object
Methods inherited from BaseModel
attr_accessor, attributes, #attributes, #id, #to_entity
Constructor Details
#initialize(init = nil) ⇒ Address
Returns a new instance of Address.
21 22 23 |
# File 'lib/deltacloud/models/address.rb', line 21 def initialize(init=nil) super(init) end |
Instance Attribute Details
#instance_id ⇒ Object
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 |