Class: Barometer::WeatherService::WundergroundV1::ForecastResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/weather_services/wunderground_v1/forecast_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ForecastResponse

Returns a new instance of ForecastResponse.



9
10
11
# File 'lib/barometer/weather_services/wunderground_v1/forecast_response.rb', line 9

def initialize(response)
  @response = response
end

Instance Method Details

#parse(payload) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/barometer/weather_services/wunderground_v1/forecast_response.rb', line 13

def parse(payload)
  response.timezone = WundergroundV1::Response::FullTimeZone.new(payload).parse
  if response.current
    response.current.sun = WundergroundV1::Response::Sun.new(payload, timezone, response).parse
  end
  response.forecast = WundergroundV1::Response::ForecastedWeather.new(payload, response).parse

  response
end