Class: Netatmo::DashboardData::Temperature
- Inherits:
-
Object
- Object
- Netatmo::DashboardData::Temperature
- Defined in:
- lib/netatmo/dashboard_data/temperature.rb
Instance Attribute Summary collapse
-
#max ⇒ Object
Returns the value of attribute max.
-
#max_date ⇒ Object
Returns the value of attribute max_date.
-
#min ⇒ Object
Returns the value of attribute min.
-
#min_date ⇒ Object
Returns the value of attribute min_date.
-
#time ⇒ Object
Returns the value of attribute time.
-
#trend ⇒ Object
Returns the value of attribute trend.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(data) ⇒ Temperature
constructor
A new instance of Temperature.
- #temperature ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Temperature
Returns a new instance of Temperature.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 8 def initialize(data) return if data.nil? self.time = Time.at(data['time_utc']) self.value = data['Temperature'].to_f self.min = data['min_temp'].to_f self.max = data['max_temp'].to_f self.min_date = Time.at(data['date_min_temp']) self.max_date = Time.at(data['date_max_temp']) self.trend = Netatmo::Util::TempTrend.key(data['temp_trend'].to_sym) self.unit = '°C' end |
Instance Attribute Details
#max ⇒ Object
Returns the value of attribute max.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def max @max end |
#max_date ⇒ Object
Returns the value of attribute max_date.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def max_date @max_date end |
#min ⇒ Object
Returns the value of attribute min.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def min @min end |
#min_date ⇒ Object
Returns the value of attribute min_date.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def min_date @min_date end |
#time ⇒ Object
Returns the value of attribute time.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def time @time end |
#trend ⇒ Object
Returns the value of attribute trend.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def trend @trend end |
#unit ⇒ Object
Returns the value of attribute unit.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def unit @unit end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6 def value @value end |
Instance Method Details
#temperature ⇒ Object
25 26 27 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 25 def temperature value end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/netatmo/dashboard_data/temperature.rb', line 21 def to_s "#{value} #{unit}" end |