Class: WeatherGov::Gridpoint

Inherits:
Feature
  • Object
show all
Defined in:
lib/weather_gov/gridpoint.rb

Instance Attribute Summary

Attributes inherited from Feature

#client

Instance Method Summary collapse

Methods inherited from Feature

#context, #data, #geometry, #id, #initialize, #properties, #type

Constructor Details

This class inherits a constructor from WeatherGov::Feature

Instance Method Details

#apparent_temperatureObject



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_unitObject



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

#dewpointObject



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_unitObject



25
26
27
# File 'lib/weather_gov/gridpoint.rb', line 25

def dewpoint_unit
  @dewpoint_unit ||= properties.dig("dewpoint", "uom").split(":").last
end

#forecast_officeObject



11
12
13
# File 'lib/weather_gov/gridpoint.rb', line 11

def forecast_office
  @forecast_office ||= Identifier::Office.new(properties.fetch("forecastOffice"))
end

#max_temperatureObject



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_unitObject



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_temperatureObject



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_unitObject



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_humidityObject



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_unitObject



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

#temperatureObject



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_unitObject



15
16
17
# File 'lib/weather_gov/gridpoint.rb', line 15

def temperature_unit
  @temperature_unit ||= properties.dig("temperature", "uom").split(":").last
end

#update_timeObject



7
8
9
# File 'lib/weather_gov/gridpoint.rb', line 7

def update_time
  @update_time ||= Time.parse(properties.fetch("updateTime"))
end