Class: Weather::Condition
- Inherits:
-
Object
- Object
- Weather::Condition
- Defined in:
- lib/weather-api/condition.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
the weather condition code, detailed at developer.yahoo.com/weather.
-
#date ⇒ Object
readonly
the date and time associated with these conditions.
-
#temp ⇒ Object
readonly
the temperature of the location.
-
#text ⇒ Object
readonly
the brief prose text description of the weather conditions of the location.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Condition
constructor
A new instance of Condition.
Constructor Details
#initialize(payload) ⇒ Condition
Returns a new instance of Condition.
15 16 17 18 19 20 |
# File 'lib/weather-api/condition.rb', line 15 def initialize(payload) @code = payload[:code].to_i @date = Utils.parse_time payload[:date] @temp = payload[:temp].to_i @text = payload[:text].strip end |
Instance Attribute Details
#code ⇒ Object (readonly)
the weather condition code, detailed at developer.yahoo.com/weather
4 5 6 |
# File 'lib/weather-api/condition.rb', line 4 def code @code end |
#date ⇒ Object (readonly)
the date and time associated with these conditions.
7 8 9 |
# File 'lib/weather-api/condition.rb', line 7 def date @date end |
#temp ⇒ Object (readonly)
the temperature of the location.
10 11 12 |
# File 'lib/weather-api/condition.rb', line 10 def temp @temp end |
#text ⇒ Object (readonly)
the brief prose text description of the weather conditions of the location.
13 14 15 |
# File 'lib/weather-api/condition.rb', line 13 def text @text end |