Class: Helium::Sensor
- Inherits:
-
Object
- Object
- Helium::Sensor
- Defined in:
- lib/helium/sensor.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#mac ⇒ Object
Returns the value of attribute mac.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ports ⇒ Object
Returns the value of attribute ports.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(client:, params:) ⇒ Sensor
constructor
A new instance of Sensor.
- #timeseries(size: 1000, port: nil, start_time: nil, end_time: nil) ⇒ Object
Constructor Details
#initialize(client:, params:) ⇒ Sensor
Returns a new instance of Sensor.
5 6 7 8 9 10 11 12 13 |
# File 'lib/helium/sensor.rb', line 5 def initialize(client:, params:) @client = client @id = params["id"] @name = params["attributes"]["name"] @mac = params["meta"]["mac"] @ports = params["meta"]["ports"] @created_at = params["meta"]["created"] @updated_at = params["meta"]["updated"] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/helium/sensor.rb', line 3 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/helium/sensor.rb', line 3 def id @id end |
#mac ⇒ Object
Returns the value of attribute mac.
3 4 5 |
# File 'lib/helium/sensor.rb', line 3 def mac @mac end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/helium/sensor.rb', line 3 def name @name end |
#ports ⇒ Object
Returns the value of attribute ports.
3 4 5 |
# File 'lib/helium/sensor.rb', line 3 def ports @ports end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/helium/sensor.rb', line 3 def updated_at @updated_at end |
Instance Method Details
#timeseries(size: 1000, port: nil, start_time: nil, end_time: nil) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/helium/sensor.rb', line 23 def timeseries(size: 1000, port: nil, start_time: nil, end_time: nil) @client.sensor_timeseries(self, size: size, port: port, start_time: start_time, end_time: end_time ) end |