Class: Barometer::WeatherService::Yahoo::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/weather_services/yahoo/response.rb,
lib/barometer/weather_services/yahoo/response/sun.rb,
lib/barometer/weather_services/yahoo/response/location.rb,
lib/barometer/weather_services/yahoo/response/timezone.rb,
lib/barometer/weather_services/yahoo/response/current_weather.rb,
lib/barometer/weather_services/yahoo/response/forecasted_weather.rb

Defined Under Namespace

Classes: CurrentWeather, ForecastedWeather, Location, Sun, TimeZone

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



10
11
12
# File 'lib/barometer/weather_services/yahoo/response.rb', line 10

def initialize
  @response = Barometer::Response.new
end

Instance Method Details

#parse(payload) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/barometer/weather_services/yahoo/response.rb', line 14

def parse(payload)
  response.add_query(payload.query)

  response.timezone = Yahoo::Response::TimeZone.new(payload).parse
  response.location = Yahoo::Response::Location.new(payload).parse
  response.current = Yahoo::Response::CurrentWeather.new(payload, timezone).parse
  response.forecast = Yahoo::Response::ForecastedWeather.new(payload, timezone, current_sun).parse

  response
end