class TempoIQ::Row
Represents all the data found at a single timestamp.
The hierarchy looks like:
-
timestamp
-
device_key
-
sensor_key => value
-
-
Attributes
ts[R]
Timestamp of the row
values[R]
Data at the timestamp [Hash]
Looks like: {“device1” => {“sensor1” => 1.23, “sensor2” => 2.34}}
Public Class Methods
from_hash(hash)
click to toggle source
# File lib/tempoiq/models/row.rb, line 22 def self.from_hash(hash) new(hash['t'], hash['data']) end
new(ts, values)
click to toggle source
# File lib/tempoiq/models/row.rb, line 17 def initialize(ts, values) @ts = ts @values = values end
Public Instance Methods
value(device_key, key)
click to toggle source
Convenience method to select a single (device, sensor) value from within the row.
# File lib/tempoiq/models/row.rb, line 28 def value(device_key, key) @values[device_key][key] end