Module: Barometer::WeatherService

Defined in:
lib/barometer/weather_service.rb,
lib/barometer/weather_services/base.rb,
lib/barometer/weather_services/response.rb,
lib/barometer/weather_services/wunderground_v1.rb,
lib/barometer/weather_services/response/location.rb,
lib/barometer/weather_services/response/time_zone.rb,
lib/barometer/weather_services/wunderground_v1/query.rb,
lib/barometer/weather_services/wunderground_v1/current_api.rb,
lib/barometer/weather_services/wunderground_v1/response/sun.rb,
lib/barometer/weather_services/wunderground_v1/forecast_api.rb,
lib/barometer/weather_services/wunderground_v1/response/station.rb,
lib/barometer/weather_services/wunderground_v1/current_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/forecast_response.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

Modules: Response Classes: Base, KeyRequired, NotFound, WundergroundV1

Class Method Summary collapse

Class Method Details

.new(*args) ⇒ Object



28
29
30
# File 'lib/barometer/weather_service.rb', line 28

def self.new(*args)
  Base.new(*args)
end

.register(key, *args, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/barometer/weather_service.rb', line 14

def self.register(key, *args, &block)
  if block_given?
    services.register(key, *args, &block)
  elsif args.size > 0
    services.register(key, *args)
  else
    raise ArgumentError
  end
end

.servicesObject



10
11
12
# File 'lib/barometer/weather_service.rb', line 10

def self.services
  @@services ||= Utils::VersionedRegistration.new
end

.services=(services) ⇒ Object



6
7
8
# File 'lib/barometer/weather_service.rb', line 6

def self.services=(services)
  @@services = services
end

.source(key, version = nil) ⇒ Object



24
25
26
# File 'lib/barometer/weather_service.rb', line 24

def self.source(key, version=nil)
  services.find(key, version) or raise NotFound
end