Class: Barometer::WeatherService::WeatherBug::Response::ForecastedWeather

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/weather_services/weather_bug/response/forecasted_weather.rb

Instance Method Summary collapse

Constructor Details

#initialize(payload, timezone) ⇒ ForecastedWeather

Returns a new instance of ForecastedWeather.



6
7
8
9
10
# File 'lib/barometer/weather_services/weather_bug/response/forecasted_weather.rb', line 6

def initialize(payload, timezone)
  @payload = payload
  @timezone = timezone
  @predictions = Barometer::Response::PredictionCollection.new
end

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/barometer/weather_services/weather_bug/response/forecasted_weather.rb', line 12

def parse
  each_prediction do |prediction, forecast_payload, index|
    prediction.date = date(index), timezone
    prediction.condition = condition(forecast_payload)
    prediction.icon = icon(forecast_payload)
    prediction.high = high(forecast_payload)
    prediction.low = low(forecast_payload)
  end

  predictions
end