Class: YahooWeather::Condition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Condition

Returns a new instance of Condition.



14
15
16
17
18
19
# File 'lib/yahoo-weather/condition.rb', line 14

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

Instance Attribute Details

#codeObject (readonly)

the Yahoo! Weather condition code, as detailed at developer.yahoo.com/weather.



3
4
5
# File 'lib/yahoo-weather/condition.rb', line 3

def code
  @code
end

#dateObject (readonly)

the date and time associated with these conditions.



6
7
8
# File 'lib/yahoo-weather/condition.rb', line 6

def date
  @date
end

#tempObject (readonly)

the temperature of the location.



9
10
11
# File 'lib/yahoo-weather/condition.rb', line 9

def temp
  @temp
end

#textObject (readonly)

the brief prose text description of the weather conditions of the location.



12
13
14
# File 'lib/yahoo-weather/condition.rb', line 12

def text
  @text
end