Class: Netatmo::DashboardData::CO2
- Inherits:
-
Object
- Object
- Netatmo::DashboardData::CO2
- Defined in:
- lib/netatmo/dashboard_data/co2.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
Returns the value of attribute time.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #co2 ⇒ Object
-
#initialize(data) ⇒ CO2
constructor
A new instance of CO2.
- #status ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ CO2
Returns a new instance of CO2.
8 9 10 11 12 13 14 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 8 def initialize(data) return if data.nil? self.time = Time.at(data['time_utc']) self.value = data['CO2'].to_f self.unit = 'ppm' end |
Instance Attribute Details
#time ⇒ Object
Returns the value of attribute time.
6 7 8 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 6 def time @time end |
#unit ⇒ Object
Returns the value of attribute unit.
6 7 8 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 6 def unit @unit end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 6 def value @value end |
Instance Method Details
#co2 ⇒ Object
20 21 22 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 20 def co2 value end |
#status ⇒ Object
24 25 26 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 24 def status # TODO: calculate status end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/netatmo/dashboard_data/co2.rb', line 16 def to_s "#{value} #{unit}" end |