Sha256: cdf4752da57df0105f403d129a894b3ebe0a401256af2d97c6a1e8bb4d22d513
Contents?: true
Size: 943 Bytes
Versions: 1
Compression:
Stored size: 943 Bytes
Contents
require "noaa-alerts/version" module Noaa class Alert attr_reader :description, :locations, :identifier, :effective_at, :expires_at, :event, :urgency, :severity, :headline def initialize(entry) @description = "" @event = "" @urgency = "" @severity = "" @headline = "" @locations = [] @identifier = "" @effective_at = nil @expires_at = nil handle_entry(entry) end private def handle_entry(entry) @description = entry['info']['description'] @event = entry['info']['event'] @urgency= entry['info']['urgency'] @severity = entry['info']['severity'] @headline = entry['info']['headline'] @locations = entry['info']['area']['areaDesc'].split('; ') @identifier = entry['identifier'] @effective_at = Time.parse(entry['info']['effective']) @expires_at = Time.parse(entry['info']['expires']) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
noaa-alerts-0.1.0 | lib/alert.rb |