Class: WeatherGov::Point

Inherits:
Feature show all
Defined in:
lib/weather_gov/point.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

#alerts_activeObject



56
57
58
# File 'lib/weather_gov/point.rb', line 56

def alerts_active
  @alerts_active ||= client.alerts_active(zone: forecast_zone_identifier.id)
end

#county_zoneObject



28
29
30
# File 'lib/weather_gov/point.rb', line 28

def county_zone
  @county_zone ||= client.zone(uri: county_zone_identifier.uri)
end

#county_zone_identifierObject



24
25
26
# File 'lib/weather_gov/point.rb', line 24

def county_zone_identifier
  @county_zone_identifier ||= Identifier::CountyZone.new(properties.fetch("county"))
end

#fire_zoneObject



36
37
38
# File 'lib/weather_gov/point.rb', line 36

def fire_zone
  @fire_zone ||= client.zone(uri: fire_zone_identifier.uri)
end

#fire_zone_identifierObject



32
33
34
# File 'lib/weather_gov/point.rb', line 32

def fire_zone_identifier
  @fire_zone_identifier ||= Identifier::FireZone.new(properties.fetch("fireWeatherZone"))
end

#forecastObject



64
65
66
# File 'lib/weather_gov/point.rb', line 64

def forecast
  @forecast ||= client.forecast(uri: properties.fetch("forecast"))
end

#forecast_grid_dataObject



40
41
42
# File 'lib/weather_gov/point.rb', line 40

def forecast_grid_data
  @forecast_grid_data ||= Identifier::Gridpoint.new(properties.fetch("forecastGridData"))
end

#forecast_hourlyObject



68
69
70
# File 'lib/weather_gov/point.rb', line 68

def forecast_hourly
  @forecast_hourly ||= client.forecast(uri: properties.fetch("forecastHourly"))
end

#forecast_officeObject



12
13
14
# File 'lib/weather_gov/point.rb', line 12

def forecast_office
  @forecast_office ||= client.office(uri: forecast_office_identifier.uri)
end

#forecast_office_identifierObject



8
9
10
# File 'lib/weather_gov/point.rb', line 8

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

#forecast_zoneObject



20
21
22
# File 'lib/weather_gov/point.rb', line 20

def forecast_zone
  @forecast_zone ||= client.zone(uri: forecast_zone_identifier.uri)
end

#forecast_zone_identifierObject



16
17
18
# File 'lib/weather_gov/point.rb', line 16

def forecast_zone_identifier
  @forecast_zone_identifier ||= Identifier::ForecastZone.new(properties.fetch("forecastZone"))
end

#gridpointObject



60
61
62
# File 'lib/weather_gov/point.rb', line 60

def gridpoint
  @gridpoint ||= client.gridpoint(uri: properties.fetch("forecastGridData"))
end

#observation_stationsObject



52
53
54
# File 'lib/weather_gov/point.rb', line 52

def observation_stations
  @observation_stations ||= client.stations(uri: properties.fetch("observationStations"))
end

#product(type) ⇒ Object



77
78
79
# File 'lib/weather_gov/point.rb', line 77

def product(type)
  products(type).first.product
end

#products(type) ⇒ Object



72
73
74
75
# File 'lib/weather_gov/point.rb', line 72

def products(type)
  @products ||= {}
  @products[type] ||= client.products(type: type, location: forecast_office_identifier.id)
end

#radar_stationObject



48
49
50
# File 'lib/weather_gov/point.rb', line 48

def radar_station
  properties.fetch("radarStation")
end

#relative_locationObject



44
45
46
# File 'lib/weather_gov/point.rb', line 44

def relative_location
  @relative_location ||= RelativeLocation.new(client: client, data: properties.fetch("relativeLocation"))
end