class Netatmo::DashboardData::Temperature

Attributes

max[RW]
max_date[RW]
min[RW]
min_date[RW]
time[RW]
trend[RW]
unit[RW]
value[RW]

Public Class Methods

new(data) click to toggle source
# 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

Public Instance Methods

temperature() click to toggle source
# File lib/netatmo/dashboard_data/temperature.rb, line 25
def temperature
  value
end
to_s() click to toggle source
# File lib/netatmo/dashboard_data/temperature.rb, line 21
def to_s
  "#{value} #{unit}"
end