Class: Address
Overview
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Instance Attribute Summary collapse
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
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.
20 21 22 |
# File 'lib/deltacloud/models/address.rb', line 20 def initialize(init=nil) super(init) end |
Instance Attribute Details
#instance_id ⇒ Object
Returns the value of attribute instance_id.
18 19 20 |
# File 'lib/deltacloud/models/address.rb', line 18 def instance_id @instance_id end |
Instance Method Details
#associated? ⇒ Boolean
24 25 26 |
# File 'lib/deltacloud/models/address.rb', line 24 def associated? !self.instance_id.nil? end |
#to_hash(context) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/deltacloud/models/address.rb', line 28 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 |