attack/barometer

View on GitHub
lib/barometer/weather_services/wunderground_v1/response/full_timezone.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Barometer
  module WeatherService
    class WundergroundV1
      class Response
        class FullTimeZone < WeatherService::Response::TimeZone
          def parse
            payload.fetch_each('simpleforecast', 'forecastday') do |forecast_payload|
              timezone = timezone(forecast_payload)
              return Data::Zone.new(timezone) if timezone
            end
          end

          private

          def timezone(forecast_payload)
            forecast_payload.fetch('date', 'tz_long')
          end
        end
      end
    end
  end
end