Class: Weather::Forecast

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

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/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

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

#dateObject (readonly)

the date associated with the forecast.



7
8
9
# File 'lib/weather-api/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/weather-api/forecast.rb', line 4

def day
  @day
end

#highObject (readonly)

the high temperature forecasted.



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

def high
  @high
end

#lowObject (readonly)

the low temperature forecasted.



10
11
12
# File 'lib/weather-api/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/weather-api/forecast.rb', line 16

def text
  @text
end