Class: Hawkular::Inventory::Relationship

Inherits:
Object
  • Object
show all
Defined in:
lib/hawkular/inventory/entities.rb

Overview

Definition of a Relationship between two entities in Inventory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Relationship

Returns a new instance of Relationship



136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/hawkular/inventory/entities.rb', line 136

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

#idObject (readonly)

Returns the value of attribute id



134
135
136
# File 'lib/hawkular/inventory/entities.rb', line 134

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name



133
134
135
# File 'lib/hawkular/inventory/entities.rb', line 133

def name
  @name
end

#propertiesObject (readonly)

Returns the value of attribute properties



132
133
134
# File 'lib/hawkular/inventory/entities.rb', line 132

def properties
  @properties
end

#source_idObject

Returns the value of attribute source_id



130
131
132
# File 'lib/hawkular/inventory/entities.rb', line 130

def source_id
  @source_id
end

#target_idObject (readonly)

Returns the value of attribute target_id



131
132
133
# File 'lib/hawkular/inventory/entities.rb', line 131

def target_id
  @target_id
end

Instance Method Details

#to_hObject



149
150
151
152
153
154
155
156
157
# File 'lib/hawkular/inventory/entities.rb', line 149

def to_h
  hash = {}
  hash['source'] = @source_id
  hash['target'] = @target_id
  hash['properties'] = @properties
  hash['name'] = @name
  hash['id'] = @id
  hash
end