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