Class: Barometer::WeatherService::WundergroundV1::Response::CurrentWeather

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

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ CurrentWeather

Returns a new instance of CurrentWeather.



6
7
8
9
# File 'lib/barometer/weather_services/wunderground_v1/response/current_weather.rb', line 6

def initialize(payload)
  @payload = payload
  @current = Barometer::Response::Current.new
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/barometer/weather_services/wunderground_v1/response/current_weather.rb', line 11

def parse
  current.observed_at = observed_at, '%B %e, %l:%M %p %Z'
  current.stale_at = stale_at
  current.humidity = humidity
  current.condition = condition
  current.icon = icon
  current.temperature = temperature
  current.dew_point = dew_point
  current.wind_chill = wind_chill
  current.heat_index = heat_index
  current.wind = wind
  current.visibility = visibility
  current.pressure = pressure

  current
end