Class: Tenkit::Weather
- Inherits:
-
Object
- Object
- Tenkit::Weather
- Defined in:
- lib/tenkit/weather.rb
Instance Attribute Summary collapse
-
#current_weather ⇒ Object
readonly
Returns the value of attribute current_weather.
-
#forecast_daily ⇒ Object
readonly
Returns the value of attribute forecast_daily.
-
#forecast_hourly ⇒ Object
readonly
Returns the value of attribute forecast_hourly.
-
#forecast_next_hour ⇒ Object
readonly
Returns the value of attribute forecast_next_hour.
-
#weather_alerts ⇒ Object
readonly
Returns the value of attribute weather_alerts.
Instance Method Summary collapse
-
#initialize(response) ⇒ Weather
constructor
A new instance of Weather.
Constructor Details
#initialize(response) ⇒ Weather
Returns a new instance of Weather.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tenkit/weather.rb', line 15 def initialize(response) parsed_response = JSON.parse(response.body) current_weather = parsed_response['currentWeather'] forecast_daily = parsed_response['forecastDaily'] forecast_hourly = parsed_response['forecastHourly'] forecast_next_hour = parsed_response['forecastNextHour'] weather_alerts = parsed_response['weatherAlerts'] @current_weather = CurrentWeather.new(current_weather) @forecast_daily = DailyForecast.new(forecast_daily) @forecast_hourly = HourlyForecast.new(forecast_hourly) @forecast_next_hour = NextHourForecast.new(forecast_next_hour) @weather_alerts = WeatherAlertCollection.new(weather_alerts) end |
Instance Attribute Details
#current_weather ⇒ Object (readonly)
Returns the value of attribute current_weather.
9 10 11 |
# File 'lib/tenkit/weather.rb', line 9 def current_weather @current_weather end |
#forecast_daily ⇒ Object (readonly)
Returns the value of attribute forecast_daily.
9 10 11 |
# File 'lib/tenkit/weather.rb', line 9 def forecast_daily @forecast_daily end |
#forecast_hourly ⇒ Object (readonly)
Returns the value of attribute forecast_hourly.
9 10 11 |
# File 'lib/tenkit/weather.rb', line 9 def forecast_hourly @forecast_hourly end |
#forecast_next_hour ⇒ Object (readonly)
Returns the value of attribute forecast_next_hour.
9 10 11 |
# File 'lib/tenkit/weather.rb', line 9 def forecast_next_hour @forecast_next_hour end |
#weather_alerts ⇒ Object (readonly)
Returns the value of attribute weather_alerts.
9 10 11 |
# File 'lib/tenkit/weather.rb', line 9 def weather_alerts @weather_alerts end |