class TempoIQ::DataPoint

The core type of TempoIQ. Holds a timestamp and value.

Attributes

ts[R]

The timestamp of the datapoint [Time]

value[R]

The value of the datapoint [Fixnum / Float]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/tempoiq/models/datapoint.rb, line 24
def self.from_hash(hash)
  new(Time.parse(hash['t']), m['v'])
end
new(ts, value) click to toggle source
# File lib/tempoiq/models/datapoint.rb, line 12
def initialize(ts, value)
  @ts = ts
  @value = value
end

Public Instance Methods

to_hash() click to toggle source
# File lib/tempoiq/models/datapoint.rb, line 17
def to_hash
  {
    't' => ts.iso8601(3),
    'v' => value
  }
end