Class: UndergroundWeather::DailyForecast

Inherits:
Object
  • Object
show all
Defined in:
lib/undergroundweather/daily_forecast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(forecast) ⇒ DailyForecast

Returns a new instance of DailyForecast.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/undergroundweather/daily_forecast.rb', line 7

def initialize(forecast)
  @day  = forecast['date']['weekday']
  @date = Time.at(forecast['date']['epoch'].to_i)
  
  @high_f = forecast['high']['fahrenheit']
  @high_c = forecast['high']['celsius']
  
  @low_f = forecast['low']['fahrenheit']
  @low_c = forecast['low']['celsius']
  
  @conditions = forecast['conditions']
  @icon       = forecast['icon_url']
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def conditions
  @conditions
end

#dateObject (readonly)

Returns the value of attribute date.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def date
  @date
end

#dayObject (readonly)

Returns the value of attribute day.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def day
  @day
end

#high_cObject (readonly)

Returns the value of attribute high_c.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def high_c
  @high_c
end

#high_fObject (readonly) Also known as: high

Returns the value of attribute high_f.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def high_f
  @high_f
end

#iconObject (readonly)

Returns the value of attribute icon.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def icon
  @icon
end

#low_cObject (readonly)

Returns the value of attribute low_c.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def low_c
  @low_c
end

#low_fObject (readonly) Also known as: low

Returns the value of attribute low_f.



3
4
5
# File 'lib/undergroundweather/daily_forecast.rb', line 3

def low_f
  @low_f
end