Class: Netatmo::DashboardData::Wind

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Wind

Returns a new instance of Wind.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/netatmo/dashboard_data/wind.rb', line 8

def initialize(data)
  return if data.nil?

  self.time = Time.at(data['time_utc'])
  self.wind_strength = data['WindStrength'].to_f
  self.max_wind_strength = data['max_wind_str'].to_f
  self.max_wind_strength_date = Time.at(data['date_max_wind_str'])
  self.wind_angle = data['WindAngle'].to_f
  self.gust_strength = data['Guststrength'].to_f
  self.gust_angle = data['GustAngle'].to_f
  self.wind_historic = data['WindHistoric']
  self.unit = 'km/h'
end

Instance Attribute Details

#gust_angleObject

Returns the value of attribute gust_angle.



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

def gust_angle
  @gust_angle
end

#gust_strengthObject

Returns the value of attribute gust_strength.



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

def gust_strength
  @gust_strength
end

#max_wind_strengthObject

Returns the value of attribute max_wind_strength.



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

def max_wind_strength
  @max_wind_strength
end

#max_wind_strength_dateObject

Returns the value of attribute max_wind_strength_date.



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

def max_wind_strength_date
  @max_wind_strength_date
end

#timeObject

Returns the value of attribute time.



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

def time
  @time
end

#unitObject

Returns the value of attribute unit.



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

def unit
  @unit
end

#wind_angleObject

Returns the value of attribute wind_angle.



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

def wind_angle
  @wind_angle
end

#wind_historicObject

Returns the value of attribute wind_historic.



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

def wind_historic
  @wind_historic
end

#wind_strengthObject

Returns the value of attribute wind_strength.



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

def wind_strength
  @wind_strength
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/netatmo/dashboard_data/wind.rb', line 22

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