Class: WeatherGov::Gridpoint
Instance Attribute Summary
Attributes inherited from Feature
#client
Instance Method Summary
collapse
Methods inherited from Feature
#context, #data, #geometry, #id, #initialize, #properties, #type
Instance Method Details
#apparent_temperature ⇒ Object
59
60
61
62
63
|
# File 'lib/weather_gov/gridpoint.rb', line 59
def apparent_temperature
@apparent_temperature ||= properties.dig("apparentTemperature", "values").map do |data|
ValidDurationValue.new(data: data, unit: apparent_temperature_unit)
end
end
|
#apparent_temperature_unit ⇒ Object
55
56
57
|
# File 'lib/weather_gov/gridpoint.rb', line 55
def apparent_temperature_unit
@apparent_temperature_unit ||= properties.dig("apparentTemperature", "uom").split(":").last
end
|
#dewpoint ⇒ Object
29
30
31
32
33
|
# File 'lib/weather_gov/gridpoint.rb', line 29
def dewpoint
@dewpoint ||= properties.dig("dewpoint", "values").map do |data|
ValidDurationValue.new(data: data, unit: dewpoint_unit)
end
end
|
#dewpoint_unit ⇒ Object
25
26
27
|
# File 'lib/weather_gov/gridpoint.rb', line 25
def dewpoint_unit
@dewpoint_unit ||= properties.dig("dewpoint", "uom").split(":").last
end
|
#forecast_office ⇒ Object
11
12
13
|
# File 'lib/weather_gov/gridpoint.rb', line 11
def forecast_office
@forecast_office ||= Identifier::Office.new(properties.fetch("forecastOffice"))
end
|
#max_temperature ⇒ Object
49
50
51
52
53
|
# File 'lib/weather_gov/gridpoint.rb', line 49
def max_temperature
@max_temperature ||= properties.dig("maxTemperature", "values").map do |data|
ValidDurationValue.new(data: data, unit: max_temperature_unit)
end
end
|
#max_temperature_unit ⇒ Object
45
46
47
|
# File 'lib/weather_gov/gridpoint.rb', line 45
def max_temperature_unit
@max_temperature_unit ||= properties.dig("maxTemperature", "uom").split(":").last
end
|
#min_temperature ⇒ Object
39
40
41
42
43
|
# File 'lib/weather_gov/gridpoint.rb', line 39
def min_temperature
@min_temperature ||= properties.dig("minTemperature", "values").map do |data|
ValidDurationValue.new(data: data, unit: min_temperature_unit)
end
end
|
#min_temperature_unit ⇒ Object
35
36
37
|
# File 'lib/weather_gov/gridpoint.rb', line 35
def min_temperature_unit
@min_temperature_unit ||= properties.dig("minTemperature", "uom").split(":").last
end
|
#relative_humidity ⇒ Object
69
70
71
72
73
|
# File 'lib/weather_gov/gridpoint.rb', line 69
def relative_humidity
@relative_humidity ||= properties.dig("relativeHumidity", "values").map do |data|
ValidDurationValue.new(data: data, unit: relative_humidity_unit)
end
end
|
#relative_humidity_unit ⇒ Object
65
66
67
|
# File 'lib/weather_gov/gridpoint.rb', line 65
def relative_humidity_unit
@relative_humidity_unit ||= properties.dig("relativeHumidity", "uom").split(":").last
end
|
#temperature ⇒ Object
19
20
21
22
23
|
# File 'lib/weather_gov/gridpoint.rb', line 19
def temperature
@temperature ||= properties.dig("temperature", "values").map do |data|
ValidDurationValue.new(data: data, unit: temperature_unit)
end
end
|
#temperature_unit ⇒ Object
15
16
17
|
# File 'lib/weather_gov/gridpoint.rb', line 15
def temperature_unit
@temperature_unit ||= properties.dig("temperature", "uom").split(":").last
end
|
#update_time ⇒ Object
7
8
9
|
# File 'lib/weather_gov/gridpoint.rb', line 7
def update_time
@update_time ||= Time.parse(properties.fetch("updateTime"))
end
|