Sha256: 7d987b156bf40d43713b40cd1d718bc2c9a4098070f719032dfaecb8a92693b7
Contents?: true
Size: 885 Bytes
Versions: 6
Compression:
Stored size: 885 Bytes
Contents
require_relative 'noaa/forecast_api' require_relative 'noaa/forecast_response' require_relative 'noaa/current_api' require_relative 'noaa/current_response' module Barometer module WeatherService class Noaa def self.call(query, config={}) Noaa.new(query).measure! end def initialize(query) @query = query end def measure! forecast_weather_api = ForecastApi.new(query) response = ForecastResponse.new.parse(forecast_weather_api.get) forecast_weather_api.query.add_conversion(:coordinates, response.location.coordinates) current_weather_api = CurrentApi.new(forecast_weather_api.query) CurrentResponse.new(response).parse(current_weather_api.get) end private attr_reader :query end end end Barometer::WeatherService.register(:noaa, Barometer::WeatherService::Noaa)
Version data entries
6 entries across 6 versions & 1 rubygems