Class: SimpleMeasurement

Inherits:
Measurement show all
Defined in:
lib/wattics-api-client/measurements.rb

Instance Attribute Summary collapse

Attributes inherited from Measurement

#id, #timestamp

Instance Method Summary collapse

Methods inherited from Measurement

#<=>

Instance Attribute Details

#valueObject

Returns the value of attribute value.



18
19
20
# File 'lib/wattics-api-client/measurements.rb', line 18

def value
  @value
end

Instance Method Details

#jsonObject



28
29
30
31
32
33
34
# File 'lib/wattics-api-client/measurements.rb', line 28

def json
  {
    id: @id.to_s,
    tsISO8601: @timestamp,
    value: @value
  }.select { |_k, v| v }.to_json
end

#to_sObject



20
21
22
23
24
25
26
# File 'lib/wattics-api-client/measurements.rb', line 20

def to_s
  'SimpleMeasurement{' \
    "id='" + @id.to_s + '\'' \
    ', timestamp=' + @timestamp.to_s +
    ', value=' + @value.to_s +
    '}'
end