Class: Barometer::WeatherService::Yahoo::Response::CurrentWeather

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/weather_services/yahoo/response/current_weather.rb

Instance Method Summary collapse

Constructor Details

#initialize(payload, timezone) ⇒ CurrentWeather

Returns a new instance of CurrentWeather.



9
10
11
12
13
# File 'lib/barometer/weather_services/yahoo/response/current_weather.rb', line 9

def initialize(payload, timezone)
  @payload = payload
  @timezone = timezone
  @current = Barometer::Response::Current.new # needs query or metric
end

Instance Method Details

#parseObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/barometer/weather_services/yahoo/response/current_weather.rb', line 15

def parse
  current.observed_at = observed_at, '%a, %d %b %Y %l:%M %P %Z'
  current.stale_at = stale_at
  current.condition = condition
  current.icon = icon
  current.temperature = temperature
  current.humidity = humidity
  current.pressure = pressure
  current.visibility = visibility
  current.wind_chill = wind_chill
  current.wind = wind
  current.sun = Yahoo::Response::Sun.new(payload, base_time).parse

  current
end