Class: TempoIQ::Sensor
- Inherits:
-
Object
- Object
- TempoIQ::Sensor
- Defined in:
- lib/tempoiq/models/sensor.rb
Overview
The container for a stream of time series DataPoints.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Indexable attributes.
-
#key ⇒ Object
readonly
The sensor primary key [String].
-
#name ⇒ Object
Human readable name of the sensor [String] EG - “Thermometer 1”.
Instance Method Summary collapse
-
#initialize(key, name = "", attributes = {}) ⇒ Sensor
constructor
A new instance of Sensor.
- #to_hash ⇒ Object
Constructor Details
#initialize(key, name = "", attributes = {}) ⇒ Sensor
Returns a new instance of Sensor.
14 15 16 17 18 |
# File 'lib/tempoiq/models/sensor.rb', line 14 def initialize(key, name = "", attributes = {}) @key = key @name = name @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Indexable attributes. Useful for grouping related sensors. EG - => ‘F’, ‘model’ => ‘FHZ343’
12 13 14 |
# File 'lib/tempoiq/models/sensor.rb', line 12 def attributes @attributes end |
#key ⇒ Object (readonly)
The sensor primary key [String]
5 6 7 |
# File 'lib/tempoiq/models/sensor.rb', line 5 def key @key end |
#name ⇒ Object
Human readable name of the sensor [String] EG - “Thermometer 1”
8 9 10 |
# File 'lib/tempoiq/models/sensor.rb', line 8 def name @name end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/tempoiq/models/sensor.rb', line 20 def to_hash { 'key' => key, 'name' => name, 'attributes' => attributes } end |