Class: Hawkular::Inventory::Relationship
- Inherits:
-
Object
- Object
- Hawkular::Inventory::Relationship
- Defined in:
- lib/hawkular/inventory/entities.rb
Overview
Definition of a Relationship between two entities in Inventory
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#source_id ⇒ Object
Returns the value of attribute source_id.
-
#target_id ⇒ Object
readonly
Returns the value of attribute target_id.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Relationship
constructor
A new instance of Relationship.
- #to_h ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Relationship
Returns a new instance of Relationship
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/hawkular/inventory/entities.rb', line 138 def initialize(hash = {}) if hash.empty? @properties = {} return end @source_id = hash['source'] @target_id = hash['target'] @properties = hash['properties'] @name = hash['name'] @id = hash['id'] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id
136 137 138 |
# File 'lib/hawkular/inventory/entities.rb', line 136 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name
135 136 137 |
# File 'lib/hawkular/inventory/entities.rb', line 135 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties
134 135 136 |
# File 'lib/hawkular/inventory/entities.rb', line 134 def properties @properties end |
#source_id ⇒ Object
Returns the value of attribute source_id
132 133 134 |
# File 'lib/hawkular/inventory/entities.rb', line 132 def source_id @source_id end |
#target_id ⇒ Object (readonly)
Returns the value of attribute target_id
133 134 135 |
# File 'lib/hawkular/inventory/entities.rb', line 133 def target_id @target_id end |
Instance Method Details
#to_h ⇒ Object
151 152 153 154 155 156 157 158 159 |
# File 'lib/hawkular/inventory/entities.rb', line 151 def to_h hash = {} hash['source'] = @source_id hash['target'] = @target_id hash['properties'] = @properties hash['name'] = @name hash['id'] = @id hash end |