Class: TempoIQ::Sensor

Inherits:
Object
  • Object
show all
Defined in:
lib/tempoiq/models/sensor.rb

Overview

The container for a stream of time series DataPoints.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject

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

#keyObject (readonly)

The sensor primary key [String]



5
6
7
# File 'lib/tempoiq/models/sensor.rb', line 5

def key
  @key
end

#nameObject

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_hashObject



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