Class: UndergroundWeather::CurrentConditions

Inherits:
Object
  • Object
show all
Defined in:
lib/undergroundweather/features/current_conditions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feed) ⇒ CurrentConditions



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/undergroundweather/features/current_conditions.rb', line 11

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']
  @precip_today  = obsv['precip_today_in']
  @precip_hour   = obsv['precip_1hr_in']
  
  @icon = obsv['icon_url']
  @url  = obsv['forecast_url']
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def country
  @country
end

#dewpoint_cObject (readonly)

Returns the value of attribute dewpoint_c.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def dewpoint_c
  @dewpoint_c
end

#dewpoint_fObject (readonly)

Returns the value of attribute dewpoint_f.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def dewpoint_f
  @dewpoint_f
end

#elevationObject (readonly)

Returns the value of attribute elevation.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def elevation
  @elevation
end

#heat_index_cObject (readonly)

Returns the value of attribute heat_index_c.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def heat_index_c
  @heat_index_c
end

#heat_index_fObject (readonly)

Returns the value of attribute heat_index_f.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def heat_index_f
  @heat_index_f
end

#humidityObject (readonly)

Returns the value of attribute humidity.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def humidity
  @humidity
end

#iconObject (readonly)

Returns the value of attribute icon.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def icon
  @icon
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def longitude
  @longitude
end

#precip_hourObject (readonly)

Returns the value of attribute precip_hour.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def precip_hour
  @precip_hour
end

#precip_todayObject (readonly)

Returns the value of attribute precip_today.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def precip_today
  @precip_today
end

#pressure_inObject (readonly)

Returns the value of attribute pressure_in.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def pressure_in
  @pressure_in
end

#pressure_mbObject (readonly)

Returns the value of attribute pressure_mb.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def pressure_mb
  @pressure_mb
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def state
  @state
end

#stationObject (readonly)

Returns the value of attribute station.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def station
  @station
end

#temp_cObject (readonly)

Returns the value of attribute temp_c.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def temp_c
  @temp_c
end

#temp_fObject (readonly)

Returns the value of attribute temp_f.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def temp_f
  @temp_f
end

#timeObject (readonly)

Returns the value of attribute time.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def time
  @time
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def time_zone
  @time_zone
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def url
  @url
end

#visibility_kmObject (readonly)

Returns the value of attribute visibility_km.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def visibility_km
  @visibility_km
end

#visibility_miObject (readonly)

Returns the value of attribute visibility_mi.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def visibility_mi
  @visibility_mi
end

#weatherObject (readonly)

Returns the value of attribute weather.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def weather
  @weather
end

#windObject (readonly)

Returns the value of attribute wind.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def wind
  @wind
end

#wind_dirObject (readonly)

Returns the value of attribute wind_dir.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def wind_dir
  @wind_dir
end

#wind_mphObject (readonly)

Returns the value of attribute wind_mph.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def wind_mph
  @wind_mph
end

#windchill_cObject (readonly)

Returns the value of attribute windchill_c.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def windchill_c
  @windchill_c
end

#windchill_fObject (readonly)

Returns the value of attribute windchill_f.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def windchill_f
  @windchill_f
end

#zipObject (readonly)

Returns the value of attribute zip.



3
4
5
# File 'lib/undergroundweather/features/current_conditions.rb', line 3

def zip
  @zip
end

Instance Method Details

#dewpointObject



66
67
68
# File 'lib/undergroundweather/features/current_conditions.rb', line 66

def dewpoint
  @dewpoint_f
end

#heat_indexObject



54
55
56
# File 'lib/undergroundweather/features/current_conditions.rb', line 54

def heat_index
  @head_index_f
end

#tempObject



50
51
52
# File 'lib/undergroundweather/features/current_conditions.rb', line 50

def temp
  @temp_f
end

#visibilityObject



62
63
64
# File 'lib/undergroundweather/features/current_conditions.rb', line 62

def visibility
  @visibility_mi
end

#windchillObject



58
59
60
# File 'lib/undergroundweather/features/current_conditions.rb', line 58

def windchill
  @windchill_f
end