Class: Weather::Forecast
- Inherits:
-
Object
- Object
- Weather::Forecast
- Defined in:
- lib/weather-api/forecast.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
the weather condition code, detailed at 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/weather-api/forecast.rb', line 21 def initialize(payload) @day = payload[:day].strip @date = Utils.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 weather condition code, detailed at developer.yahoo.com/weather
19 20 21 |
# File 'lib/weather-api/forecast.rb', line 19 def code @code end |
#date ⇒ Object (readonly)
the date associated with the forecast.
7 8 9 |
# File 'lib/weather-api/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/weather-api/forecast.rb', line 4 def day @day end |
#high ⇒ Object (readonly)
the high temperature forecasted.
13 14 15 |
# File 'lib/weather-api/forecast.rb', line 13 def high @high end |
#low ⇒ Object (readonly)
the low temperature forecasted.
10 11 12 |
# File 'lib/weather-api/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/weather-api/forecast.rb', line 16 def text @text end |