Class: YahooWeather::Forecast
- Inherits:
-
Object
- Object
- YahooWeather::Forecast
- Defined in:
- lib/yahoo-weather.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.
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
#code ⇒ Object (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 |
#date ⇒ Object (readonly)
the date associated with the forecast.
147 148 149 |
# File 'lib/yahoo-weather.rb', line 147 def date @date end |
#day ⇒ Object (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 |
#high ⇒ Object (readonly)
the high temperature forecasted.
153 154 155 |
# File 'lib/yahoo-weather.rb', line 153 def high @high end |
#low ⇒ Object (readonly)
the low temperature forecasted.
150 151 152 |
# File 'lib/yahoo-weather.rb', line 150 def low @low end |
#text ⇒ Object (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 |