Class: Reporter::Record::Weather

Inherits:
Base
  • Object
show all
Defined in:
lib/reporter/record/weather.rb

Overview

Public: The weather record is perhaps the most self-explanitory

of the data captured.

Dictionary keys are descriptive, detailing the metric and the units used.

Instance Method Summary collapse

Methods inherited from Base

#==, #hash, #initialize

Constructor Details

This class inherits a constructor from Reporter::Record::Base

Instance Method Details

#dewpoint_cObject

Public: Represents the current dew point in degrees Celcius.

Returns a Float representing the current dew point in degrees

Celcius.


15
16
17
# File 'lib/reporter/record/weather.rb', line 15

def dewpoint_c
  @dewpoint_c ||= @data["dewpointC"].to_f
end

#feelslike_cObject

Public: Represents the current “feels-like” temperature.

Returns a Float representing the current “feels-like”

temperature in degrees Celcius.


23
24
25
# File 'lib/reporter/record/weather.rb', line 23

def feelslike_c
  @feelslike_c ||= @data["feelslikeC"].to_f
end

#feelslike_fObject

Public: Represents the current “feels-like” temperature.

Returns a Float representing the current “feels-like”

temperature in degrees Farenheit.


31
32
33
# File 'lib/reporter/record/weather.rb', line 31

def feelslike_f
  @feelslike_f ||= @data["feelslikeF"].to_f
end

#latitudeObject

Public: Represents the latitude of this weather record.

Returns a Float representing the latitude of this weather

record in degrees.


39
40
41
# File 'lib/reporter/record/weather.rb', line 39

def latitude
  @latitude ||= @data["latitude"].to_f
end

#longitudeObject

Public: Represents the longitude of this weather record.

Returns a Float representing the longitude of this weather

record in degrees.


47
48
49
# File 'lib/reporter/record/weather.rb', line 47

def longitude
  @longitude ||= @data["longitude"].to_f
end

#precip_today_inObject

Public: Represents the precipitation today.

Returns a Float representing the amount of precipitation that

has fallen today, measured in inches.


63
64
65
# File 'lib/reporter/record/weather.rb', line 63

def precip_today_in
  @precip_today_in ||= @data["precipTodayIn"].to_f
end

#precip_today_metricObject

Public: Represents the precipitation today.

Returns a Float representing the amount of precipitation that

has fallen today, measured in millimeters.


55
56
57
# File 'lib/reporter/record/weather.rb', line 55

def precip_today_metric
  @precip_today_metric ||= @data["precipTodayMetric"].to_f
end

#pressure_inObject

Public: Represents the current atmospheric pressure.

Returns a Float representing the current atmospheric pressure

in millimeters of mercury.


79
80
81
# File 'lib/reporter/record/weather.rb', line 79

def pressure_in
  @pressure_in ||= @data["pressureIn"].to_f
end

#pressure_mbObject

Public: Represents the current atmospheric pressure.

Returns a Float representing the current atmospheric pressure

in millibars.


71
72
73
# File 'lib/reporter/record/weather.rb', line 71

def pressure_mb
  @pressure_mb ||= @data["pressureMb"].to_f
end

#relative_humidityObject

Public: Represents the current relative humidity percentage.

Returns a Float between 0 and 1, representing the current

relative humidity percentage.


87
88
89
# File 'lib/reporter/record/weather.rb', line 87

def relative_humidity
  @relative_humidity ||= @data["relativeHumidity"].to_f / 100.0
end

#station_idObject

Public: Represents the station identifier of the weather

record.

Returns a String containing the station identifier of the

weather record.


96
97
98
# File 'lib/reporter/record/weather.rb', line 96

def station_id
  @station_id ||= @data["stationID"].to_s
end

#temp_cObject

Public: Represents the current temperature.

Returns a Float representing the temperature in degrees

Celcius.


104
105
106
# File 'lib/reporter/record/weather.rb', line 104

def temp_c
  @temp_c ||= @data["tempC"].to_f
end

#temp_fObject

Public: Represents the current temperature.

Returns a Float representing the temperature in degrees

Farenheit.


112
113
114
# File 'lib/reporter/record/weather.rb', line 112

def temp_f
  @temp_f ||= @data["tempF"].to_f
end

#uvObject

Public: Represents the current ultraviolet level.

Returns an Integer representing the current ultraviolet level.



119
120
121
# File 'lib/reporter/record/weather.rb', line 119

def uv
  @uv ||= @data["uv"].to_i
end

#visibility_kmObject

Public: Represents the current visibility.

Returns a Float representing the visibility in kilometers.



126
127
128
# File 'lib/reporter/record/weather.rb', line 126

def visibility_km
  @visibility_km ||= @data["visibilityKM"].to_f
end

#visibility_miObject

Public: Represents the current visibility.

Returns a Float representing the current visibility in miles.



133
134
135
# File 'lib/reporter/record/weather.rb', line 133

def visibility_mi
  @visibility_mi ||= @data["visibilityMi"].to_f
end

#weatherObject

Public: A phrase describing the current conditions.

Returns a String containing the phrase describing the current

conditions.


141
142
143
# File 'lib/reporter/record/weather.rb', line 141

def weather
  @weather ||= @data["weather"].to_s
end

#wind_degreesObject

Public: Represents the wind direction.

Returns an Integer representing the wind direction in degrees.



148
149
150
# File 'lib/reporter/record/weather.rb', line 148

def wind_degrees
  @wind_degrees ||= @data["windDegrees"].to_i
end

#wind_directionObject

Public: Represents the wind direction.

Returns a Symbol representing the wind direction.



155
156
157
# File 'lib/reporter/record/weather.rb', line 155

def wind_direction
  @wind_direction ||= @data["windDirection"].to_sym
end

#wind_gust_kphObject

Public: Represents the maximum wind gust speed.

Returns a Float representing the maximum wind gust speed in

kilometers per hour.


179
180
181
# File 'lib/reporter/record/weather.rb', line 179

def wind_gust_kph
  @wind_gust_kph ||= @data["windGustKPH"].to_f
end

#wind_gust_mphObject

Public: Represents the maximum wind gust speed.

Returns a Float representing the maximum wind gust speed in

miles per hour.


187
188
189
# File 'lib/reporter/record/weather.rb', line 187

def wind_gust_mph
  @wind_gust_mph ||= @data["windGustMPH"].to_f
end

#wind_kphObject

Public: Represents the current wind speed.

Returns a Float representing the current wind speed in

kilometers per hour.


163
164
165
# File 'lib/reporter/record/weather.rb', line 163

def wind_kph
  @wind_kph ||= @data["windKPH"].to_f
end

#wind_mphObject

Public: Represents the current wind speed.

Returns a Float representing the current wind speed in miles

per hour.


171
172
173
# File 'lib/reporter/record/weather.rb', line 171

def wind_mph
  @wind_mph ||= @data["windMPH"].to_f
end