Class: YahooWeather::Forecast
- Inherits:
-
Object
- Object
- YahooWeather::Forecast
- Defined in:
- lib/yahoo-weather/forecast.rb
Overview
The forecasted weather conditions for a specific location.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
the Yahoo! Weather code associated with the forecast, per developer.yahoo.com/weather.
-
#date ⇒ Object
readonly
the date associated with the forecast.
-
#day ⇒ Object
readonly
the brief name of the day associated with the forecast.
-
#high ⇒ Object
readonly
the high temperature forecasted.
-
#low ⇒ Object
readonly
the low temperature forecasted.
-
#text ⇒ Object
readonly
the brief prose text description of the forecasted weather conditions.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Forecast
constructor
A new instance of Forecast.
Constructor Details
#initialize(payload) ⇒ Forecast
Returns a new instance of Forecast.
21 22 23 24 25 26 27 28 |
# File 'lib/yahoo-weather/forecast.rb', line 21 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
#code ⇒ Object (readonly)
the Yahoo! Weather code associated with the forecast, per developer.yahoo.com/weather.
19 20 21 |
# File 'lib/yahoo-weather/forecast.rb', line 19 def code @code end |
#date ⇒ Object (readonly)
the date associated with the forecast.
7 8 9 |
# File 'lib/yahoo-weather/forecast.rb', line 7 def date @date end |
#day ⇒ Object (readonly)
the brief name of the day associated with the forecast.
4 5 6 |
# File 'lib/yahoo-weather/forecast.rb', line 4 def day @day end |
#high ⇒ Object (readonly)
the high temperature forecasted.
13 14 15 |
# File 'lib/yahoo-weather/forecast.rb', line 13 def high @high end |
#low ⇒ Object (readonly)
the low temperature forecasted.
10 11 12 |
# File 'lib/yahoo-weather/forecast.rb', line 10 def low @low end |
#text ⇒ Object (readonly)
the brief prose text description of the forecasted weather conditions.
16 17 18 |
# File 'lib/yahoo-weather/forecast.rb', line 16 def text @text end |