Sha256: 4ca1800a6a29129c9fa765c9a5cdeff27d6a0e8522e91a9467b6e990cbd60157

Contents?: true

Size: 876 Bytes

Versions: 8

Compression:

Stored size: 876 Bytes

Contents

require_relative 'wunderground_v1/current_api'
require_relative 'wunderground_v1/current_response'
require_relative 'wunderground_v1/forecast_api'
require_relative 'wunderground_v1/forecast_response'

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

      def initialize(query)
        @query = query
      end

      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

      private

      attr_reader :query
    end
  end
end

Barometer::WeatherService.register(:wunderground, :v1, Barometer::WeatherService::WundergroundV1)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.6 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.5 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.4 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.3 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.2 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.1 lib/barometer/weather_services/wunderground_v1.rb
barometer-0.9.0 lib/barometer/weather_services/wunderground_v1.rb