Class: Hawkular::Metrics::MetricDefinition

Inherits:
BaseObject
  • Object
show all
Defined in:
lib/hawkular/metrics/types.rb

Instance Attribute Summary collapse

Attributes inherited from BaseObject

#id, #json

Instance Method Summary collapse

Constructor Details

#initialize(json = nil) ⇒ MetricDefinition

Returns a new instance of MetricDefinition



19
20
21
22
23
24
25
26
# File 'lib/hawkular/metrics/types.rb', line 19

def initialize(json = nil)
  super(json)
  unless json.nil? # rubocop:disable Style/GuardClause
    @tenant_id = @json['tenantId']
    @data_retention = @json['dataRetention']
    @tags = @json['tags']
  end
end

Instance Attribute Details

#data_retentionObject

Returns the value of attribute data_retention



17
18
19
# File 'lib/hawkular/metrics/types.rb', line 17

def data_retention
  @data_retention
end

#tagsObject

Returns the value of attribute tags



17
18
19
# File 'lib/hawkular/metrics/types.rb', line 17

def tags
  @tags
end

#tenant_idObject

Returns the value of attribute tenant_id



17
18
19
# File 'lib/hawkular/metrics/types.rb', line 17

def tenant_id
  @tenant_id
end

Instance Method Details

#hashObject



28
29
30
31
32
33
# File 'lib/hawkular/metrics/types.rb', line 28

def hash
  h = { id: @id, tenantId: @tenant_id,
        dataRetention: @data_retention, tags: @tags }
  h.delete_if { |_k, v| v.nil? }
  h
end