class Nws::Alert

Attributes

affected_area[R]
certainty[R]
description[R]
effective[R]
event[R]
expires[R]
headline[R]
note[R]
sender_name[R]
severity[R]
status[R]
urgency[R]

Public Class Methods

new(entry) click to toggle source
# File lib/alert.rb, line 18
def initialize(entry)
  @entry = entry

  find_status_and_notes_on_event
  find_severity_and_likelihood_of_alert
  find_sender_and_area_information
  get_text_of_alert
end

Private Instance Methods

find_sender_and_area_information() click to toggle source
# File lib/alert.rb, line 49
def find_sender_and_area_information
  @sender_name = @entry['info']['senderName']
  @affected_area = @entry['info']['area']['areaDesc']
end
find_severity_and_likelihood_of_alert() click to toggle source
# File lib/alert.rb, line 43
def find_severity_and_likelihood_of_alert
  @urgency = @entry['info']['urgency']
  @severity = @entry['info']['severity']
  @certainty = @entry['info']['certainty']
end
find_status_and_notes_on_event() click to toggle source
# File lib/alert.rb, line 37
def find_status_and_notes_on_event
  @status = @entry['status']
  @note = @entry['note']
  @event = @entry['info']['event']
end
get_text_of_alert() click to toggle source
# File lib/alert.rb, line 54
def get_text_of_alert
  @headline = @entry['info']['headline']
  @description = @entry['info']['description']
end
parse_time(raw_datetime) click to toggle source
# File lib/alert.rb, line 59
def parse_time(raw_datetime)
  DateTime.parse(raw_datetime)
end