module UndergroundWeather class CurrentConditions attr_reader :city, :state, :country, :zip, :latitude, :longitude, :elevation, :time_zone, :time, :station, :weather, :temp_f, :temp_c, :humidity, :wind, :wind_dir, :wind_mph, :icon, :url, :heat_index_f, :heat_index_c, :dewpoint_f, :dewpoint_c, :windchill_f, :windchill_c, :visibility_mi, :visibility_km, :pressure_mb, :pressure_in def initialize(feed) obsv = feed['current_observation'] @city = obsv['display_location']['city'] @state = obsv['display_location']['state'] @country = obsv['display_location']['country'] @zip = obsv['display_location']['zip'] @longitude = obsv['display_location']['longitude'] @latitude = obsv['display_location']['latitude'] @elevation = obsv['display_location']['elevation'] @time_zone = obsv['local_tz_short'] @time = obsv['observation_time_rfc822'] @station = obsv['station_id'] @weather = obsv['weather'] @temp_f = obsv['temp_f'] @temp_c = obsv['temp_c'] @humidity = obsv['relative_humidity'] @wind = obsv['wind_string'] @wind_dir = obsv['wind_dir'] @wind_mph = obsv['wind_mph'] @heat_index_f = obsv['heat_index_f'] @heat_index_c = obsv['heat_index_c'] @windchill_f = obsv['windchill_f'] @windchill_c = obsv['windchill_c'] @dewpoint_f = obsv['dewpoint_f'] @dewpoint_c = obsv['dewpoint_c'] @visibility_mi = obsv['visibility_mi'] @visibility_km = obsv['visibility_km'] @pressure_mb = obsv['pressure_mb'] @pressure_in = obsv['pressure_in'] @icon = obsv['icon_url'] @url = obsv['forecast_url'] end def temp @temp_f end def heat_index @head_index_f end def windchill @windchill_f end def visibility @visibility_mi end def dewpoint @dewpoint_f end end end