Class: WeatherSage::Weather::Period
- Inherits:
-
Object
- Object
- WeatherSage::Weather::Period
- Defined in:
- lib/weather-sage/weather/period.rb
Overview
Numerical weather forecast period.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#detailed_forecast ⇒ Object
readonly
Returns the value of attribute detailed_forecast.
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#is_daytime ⇒ Object
readonly
Returns the value of attribute is_daytime.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#short_forecast ⇒ Object
readonly
Returns the value of attribute short_forecast.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
-
#temperature_trend ⇒ Object
readonly
Returns the value of attribute temperature_trend.
-
#temperature_unit ⇒ Object
readonly
Returns the value of attribute temperature_unit.
-
#wind_direction ⇒ Object
readonly
Returns the value of attribute wind_direction.
-
#wind_speed ⇒ Object
readonly
Returns the value of attribute wind_speed.
Instance Method Summary collapse
-
#initialize(ctx, data) ⇒ Period
constructor
Create new forecast period from given data.
Constructor Details
#initialize(ctx, data) ⇒ Period
Create new forecast period from given data.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/weather-sage/weather/period.rb', line 22 def initialize(ctx, data) @ctx = ctx @data = data.freeze # log data @ctx.log.debug('Period#initialize') do 'data = %p' % [data] end @name = data['name'] @start_time = Time.parse(data['startTime']) @end_time = Time.parse(data['endTime']) @is_daytime = data['isDaytime'] @temperature = data['temperature'] @temperature_unit = data['temperatureUnit'] @temperature_trend = data['temperatureTrend'] @wind_speed = data['windSpeed'] @wind_direction = data['windDirection'] @icon = data['icon'] @short_forecast = data['shortForecast'] @detailed_forecast = data['detailedForecast'] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def data @data end |
#detailed_forecast ⇒ Object (readonly)
Returns the value of attribute detailed_forecast.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def detailed_forecast @detailed_forecast end |
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def end_time @end_time end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def icon @icon end |
#is_daytime ⇒ Object (readonly)
Returns the value of attribute is_daytime.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def is_daytime @is_daytime end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def name @name end |
#short_forecast ⇒ Object (readonly)
Returns the value of attribute short_forecast.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def short_forecast @short_forecast end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def start_time @start_time end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def temperature @temperature end |
#temperature_trend ⇒ Object (readonly)
Returns the value of attribute temperature_trend.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def temperature_trend @temperature_trend end |
#temperature_unit ⇒ Object (readonly)
Returns the value of attribute temperature_unit.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def temperature_unit @temperature_unit end |
#wind_direction ⇒ Object (readonly)
Returns the value of attribute wind_direction.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def wind_direction @wind_direction end |
#wind_speed ⇒ Object (readonly)
Returns the value of attribute wind_speed.
5 6 7 |
# File 'lib/weather-sage/weather/period.rb', line 5 def wind_speed @wind_speed end |