Class: WeatherGov::Alert
Constant Summary
collapse
- SUMMARY_KEYS =
[
"sent",
"effective",
"onset",
"expires",
"ends",
"status",
"severity",
"certainty",
"urgency",
"event",
"headline",
"description",
"instruction",
].freeze
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
#active? ⇒ Boolean
37
38
39
|
# File 'lib/weather_gov/alert.rb', line 37
def active?
active_time_range.include?(Time.now)
end
|
#active_time_range ⇒ Object
33
34
35
|
# File 'lib/weather_gov/alert.rb', line 33
def active_time_range
effective_time...expires_time
end
|
#effective_time ⇒ Object
25
26
27
|
# File 'lib/weather_gov/alert.rb', line 25
def effective_time
Time.parse(properties.fetch("effective"))
end
|
#expires_time ⇒ Object
29
30
31
|
# File 'lib/weather_gov/alert.rb', line 29
def expires_time
Time.parse(properties.fetch("expires"))
end
|
#sent_time ⇒ Object
21
22
23
|
# File 'lib/weather_gov/alert.rb', line 21
def sent_time
Time.parse(properties.fetch("sent"))
end
|
#summary_hash ⇒ Object
41
42
43
|
# File 'lib/weather_gov/alert.rb', line 41
def summary_hash
properties.slice(*SUMMARY_KEYS)
end
|