Class: YahooWeather::Forecast

Inherits:
Object
  • Object
show all
Defined in:
lib/yahoo-weather.rb

Overview

The forecasted weather conditions for a specific location.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Forecast

Returns a new instance of Forecast.



161
162
163
164
165
166
167
168
# File 'lib/yahoo-weather.rb', line 161

def initialize (payload)
  @day = payload['day']
  @date = YahooWeather._parse_time(payload['date'])
  @low = payload['low'].to_i
  @high = payload['high'].to_i
  @text = payload['text']
  @code = payload['code'].to_i
end

Instance Attribute Details

#codeObject (readonly)

the Yahoo! Weather code associated with the forecast, per developer.yahoo.com/weather.



159
160
161
# File 'lib/yahoo-weather.rb', line 159

def code
  @code
end

#dateObject (readonly)

the date associated with the forecast.



147
148
149
# File 'lib/yahoo-weather.rb', line 147

def date
  @date
end

#dayObject (readonly)

the brief name of the day associated with the forecast.



144
145
146
# File 'lib/yahoo-weather.rb', line 144

def day
  @day
end

#highObject (readonly)

the high temperature forecasted.



153
154
155
# File 'lib/yahoo-weather.rb', line 153

def high
  @high
end

#lowObject (readonly)

the low temperature forecasted.



150
151
152
# File 'lib/yahoo-weather.rb', line 150

def low
  @low
end

#textObject (readonly)

the brief prose text description of the forecasted weather conditions.



156
157
158
# File 'lib/yahoo-weather.rb', line 156

def text
  @text
end