Class: WeatherGov::Zone

Inherits:
Feature show all
Defined in:
lib/weather_gov/zone.rb

Instance Attribute Summary

Attributes inherited from Feature

#client

Instance Method Summary collapse

Methods inherited from Feature

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

Constructor Details

This class inherits a constructor from WeatherGov::Feature

Instance Method Details

#effective_dateObject



17
18
19
# File 'lib/weather_gov/zone.rb', line 17

def effective_date
  Time.parse(properties.fetch("effectiveDate"))
end

#expirationObject



21
22
23
# File 'lib/weather_gov/zone.rb', line 21

def expiration
  Time.parse(properties.fetch("expirationDate"))
end

#forecast_office_identifiersObject



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

def forecast_office_identifiers
  properties.fetch("forecastOffices", []).map { |uri| Identifier::Office.new(uri) }
end

#forecast_officesObject



29
30
31
# File 'lib/weather_gov/zone.rb', line 29

def forecast_offices
  forecast_office_identifiers.map { |identifier| client.office(uri: identifier.uri) }
end

#nameObject



9
10
11
# File 'lib/weather_gov/zone.rb', line 9

def name
  properties.fetch("name")
end

#stateObject



13
14
15
# File 'lib/weather_gov/zone.rb', line 13

def state
  properties.fetch("state")
end

#typeObject



5
6
7
# File 'lib/weather_gov/zone.rb', line 5

def type
  properties.fetch("type")
end