Class: Netatmo::DashboardData::Temperature

Inherits:
Object
  • Object
show all
Defined in:
lib/netatmo/dashboard_data/temperature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#maxObject

Returns the value of attribute max.



6
7
8
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6

def max
  @max
end

#max_dateObject

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

#minObject

Returns the value of attribute min.



6
7
8
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6

def min
  @min
end

#min_dateObject

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

#timeObject

Returns the value of attribute time.



6
7
8
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6

def time
  @time
end

#trendObject

Returns the value of attribute trend.



6
7
8
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6

def trend
  @trend
end

#unitObject

Returns the value of attribute unit.



6
7
8
# File 'lib/netatmo/dashboard_data/temperature.rb', line 6

def unit
  @unit
end

#valueObject

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

#temperatureObject



25
26
27
# File 'lib/netatmo/dashboard_data/temperature.rb', line 25

def temperature
  value
end

#to_sObject



21
22
23
# File 'lib/netatmo/dashboard_data/temperature.rb', line 21

def to_s
  "#{value} #{unit}"
end