Class: YahooWeather::Forecast

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

Overview

The forecasted weather conditions for a specific location.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject (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

#dateObject (readonly)

the date associated with the forecast.



7
8
9
# File 'lib/yahoo-weather/forecast.rb', line 7

def date
  @date
end

#dayObject (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

#highObject (readonly)

the high temperature forecasted.



13
14
15
# File 'lib/yahoo-weather/forecast.rb', line 13

def high
  @high
end

#lowObject (readonly)

the low temperature forecasted.



10
11
12
# File 'lib/yahoo-weather/forecast.rb', line 10

def low
  @low
end

#textObject (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