Class: Hawkular::Inventory::ResourceType

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ ResourceType

Returns a new instance of ResourceType.



56
57
58
59
60
61
# File 'lib/hawkular/inventory/entities.rb', line 56

def initialize(hash)
  @id = hash['id']
  @properties = hash['properties'] || {}
  @operations = (hash['operations'] || []).map { |op| Operation.new(op) }
  @_hash = hash.dup
end

Instance Attribute Details

#idString (readonly)

Returns Id of the resource type.

Returns:

  • (String)

    Id of the resource type



50
51
52
# File 'lib/hawkular/inventory/entities.rb', line 50

def id
  @id
end

#operationsList<Operation> (readonly)

Returns Operations associated with this type.

Returns:

  • (List<Operation>)

    Operations associated with this type



54
55
56
# File 'lib/hawkular/inventory/entities.rb', line 54

def operations
  @operations
end

#propertiesHash<String,String> (readonly)

Returns Properties of this resource type.

Returns:

  • (Hash<String,String>)

    Properties of this resource type



52
53
54
# File 'lib/hawkular/inventory/entities.rb', line 52

def properties
  @properties
end

Instance Method Details

#==(other) ⇒ Object



63
64
65
# File 'lib/hawkular/inventory/entities.rb', line 63

def ==(other)
  equal?(other) || other.class == self.class && other.id == @id
end

#to_hHash<String,Object>

Returns a hash representation of the resource type

Returns:

  • (Hash<String,Object>)

    hash of the resource type



69
70
71
# File 'lib/hawkular/inventory/entities.rb', line 69

def to_h
  @_hash.dup
end