Class: Barometer::WeatherService::WundergroundV1

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/weather_services/wunderground_v1.rb,
lib/barometer/weather_services/wunderground_v1/query.rb,
lib/barometer/weather_services/wunderground_v1/current_api.rb,
lib/barometer/weather_services/wunderground_v1/forecast_api.rb,
lib/barometer/weather_services/wunderground_v1/response/sun.rb,
lib/barometer/weather_services/wunderground_v1/current_response.rb,
lib/barometer/weather_services/wunderground_v1/response/station.rb,
lib/barometer/weather_services/wunderground_v1/forecast_response.rb,
lib/barometer/weather_services/wunderground_v1/response/location.rb,
lib/barometer/weather_services/wunderground_v1/response/timezone.rb,
lib/barometer/weather_services/wunderground_v1/response/full_timezone.rb,
lib/barometer/weather_services/wunderground_v1/response/current_weather.rb,
lib/barometer/weather_services/wunderground_v1/response/forecasted_weather.rb

Defined Under Namespace

Classes: CurrentApi, CurrentResponse, ForecastApi, ForecastResponse, Query, Response

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ WundergroundV1

Returns a new instance of WundergroundV1.



13
14
15
# File 'lib/barometer/weather_services/wunderground_v1.rb', line 13

def initialize(query)
  @query = query
end

Class Method Details

.call(query, config = {}) ⇒ Object



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

def self.call(query, config={})
  WundergroundV1.new(query).measure!
end

Instance Method Details

#measure!Object



17
18
19
20
21
22
23
# File 'lib/barometer/weather_services/wunderground_v1.rb', line 17

def measure!
  current_weather_api = CurrentApi.new(query)
  response = CurrentResponse.new.parse(current_weather_api.get)

  forecast_weather_api = ForecastApi.new(current_weather_api.query)
  ForecastResponse.new(response).parse(forecast_weather_api.get)
end