rcap 2.4.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/.ruby-version +1 -0
 - data/CHANGELOG.md +18 -0
 - data/README.md +1 -0
 - data/lib/rcap.rb +3 -1
 - data/lib/rcap/alert.rb +30 -29
 - data/lib/rcap/base/alert.rb +208 -205
 - data/lib/rcap/base/area.rb +95 -91
 - data/lib/rcap/base/circle.rb +45 -34
 - data/lib/rcap/base/event_code.rb +2 -0
 - data/lib/rcap/base/geocode.rb +2 -0
 - data/lib/rcap/base/info.rb +273 -272
 - data/lib/rcap/base/parameter.rb +29 -28
 - data/lib/rcap/base/point.rb +26 -24
 - data/lib/rcap/base/polygon.rb +43 -35
 - data/lib/rcap/base/resource.rb +65 -65
 - data/lib/rcap/cap_1_0/alert.rb +85 -86
 - data/lib/rcap/cap_1_0/area.rb +2 -2
 - data/lib/rcap/cap_1_0/circle.rb +2 -1
 - data/lib/rcap/cap_1_0/event_code.rb +3 -1
 - data/lib/rcap/cap_1_0/geocode.rb +3 -1
 - data/lib/rcap/cap_1_0/info.rb +3 -3
 - data/lib/rcap/cap_1_0/parameter.rb +13 -13
 - data/lib/rcap/cap_1_0/point.rb +2 -1
 - data/lib/rcap/cap_1_0/polygon.rb +3 -3
 - data/lib/rcap/cap_1_0/resource.rb +2 -3
 - data/lib/rcap/cap_1_1/alert.rb +6 -6
 - data/lib/rcap/cap_1_1/area.rb +2 -2
 - data/lib/rcap/cap_1_1/circle.rb +2 -1
 - data/lib/rcap/cap_1_1/event_code.rb +3 -1
 - data/lib/rcap/cap_1_1/geocode.rb +3 -1
 - data/lib/rcap/cap_1_1/info.rb +125 -132
 - data/lib/rcap/cap_1_1/parameter.rb +2 -3
 - data/lib/rcap/cap_1_1/point.rb +2 -1
 - data/lib/rcap/cap_1_1/polygon.rb +3 -3
 - data/lib/rcap/cap_1_1/resource.rb +37 -38
 - data/lib/rcap/cap_1_2/alert.rb +6 -6
 - data/lib/rcap/cap_1_2/area.rb +2 -2
 - data/lib/rcap/cap_1_2/circle.rb +2 -1
 - data/lib/rcap/cap_1_2/event_code.rb +3 -1
 - data/lib/rcap/cap_1_2/geocode.rb +3 -1
 - data/lib/rcap/cap_1_2/info.rb +120 -123
 - data/lib/rcap/cap_1_2/parameter.rb +2 -3
 - data/lib/rcap/cap_1_2/point.rb +2 -1
 - data/lib/rcap/cap_1_2/polygon.rb +4 -4
 - data/lib/rcap/cap_1_2/resource.rb +38 -38
 - data/lib/rcap/config.rb +5 -3
 - data/lib/rcap/custom_validators.rb +75 -78
 - data/lib/rcap/extensions/array.rb +3 -1
 - data/lib/rcap/extensions/date.rb +3 -1
 - data/lib/rcap/extensions/date_time.rb +5 -2
 - data/lib/rcap/extensions/float.rb +2 -0
 - data/lib/rcap/extensions/integer.rb +7 -0
 - data/lib/rcap/extensions/nil_class.rb +2 -0
 - data/lib/rcap/extensions/string.rb +6 -4
 - data/lib/rcap/extensions/time.rb +5 -3
 - data/lib/rcap/formatters/yaml.rb +5 -0
 - data/lib/rcap/info.rb +6 -5
 - data/lib/rcap/utilities.rb +27 -30
 - data/lib/rcap/validation.rb +22 -21
 - data/lib/rcap/version.rb +3 -1
 - data/rcap.gemspec +5 -5
 - data/spec/alert_spec.rb +141 -141
 - data/spec/cap_1_0/alert_spec.rb +92 -94
 - data/spec/cap_1_0/area_spec.rb +86 -86
 - data/spec/cap_1_0/circle_spec.rb +48 -39
 - data/spec/cap_1_0/event_code_spec.rb +15 -15
 - data/spec/cap_1_0/geocode_spec.rb +16 -16
 - data/spec/cap_1_0/info_spec.rb +175 -177
 - data/spec/cap_1_0/parameter_spec.rb +27 -27
 - data/spec/cap_1_0/point_spec.rb +18 -18
 - data/spec/cap_1_0/polygon_spec.rb +43 -41
 - data/spec/cap_1_0/resource_spec.rb +63 -64
 - data/spec/cap_1_1/alert_spec.rb +107 -109
 - data/spec/cap_1_1/area_spec.rb +90 -90
 - data/spec/cap_1_1/circle_spec.rb +43 -34
 - data/spec/cap_1_1/event_code_spec.rb +15 -16
 - data/spec/cap_1_1/geocode_spec.rb +16 -16
 - data/spec/cap_1_1/info_spec.rb +194 -196
 - data/spec/cap_1_1/parameter_spec.rb +17 -17
 - data/spec/cap_1_1/point_spec.rb +18 -18
 - data/spec/cap_1_1/polygon_spec.rb +43 -41
 - data/spec/cap_1_1/resource_spec.rb +106 -107
 - data/spec/cap_1_2/alert_spec.rb +98 -99
 - data/spec/cap_1_2/area_spec.rb +90 -90
 - data/spec/cap_1_2/circle_spec.rb +52 -43
 - data/spec/cap_1_2/event_code_spec.rb +19 -20
 - data/spec/cap_1_2/geocode_spec.rb +20 -20
 - data/spec/cap_1_2/info_spec.rb +196 -198
 - data/spec/cap_1_2/parameter_spec.rb +19 -19
 - data/spec/cap_1_2/point_spec.rb +21 -21
 - data/spec/cap_1_2/polygon_spec.rb +55 -47
 - data/spec/cap_1_2/resource_spec.rb +96 -97
 - data/spec/extensions_spec.rb +29 -29
 - data/spec/info_spec.rb +15 -15
 - data/spec/spec_helper.rb +3 -3
 - data/spec/validations_spec.rb +73 -73
 - metadata +12 -11
 - data/lib/rcap/extensions/fixnum.rb +0 -5
 
    
        data/lib/rcap/base/event_code.rb
    CHANGED
    
    
    
        data/lib/rcap/base/geocode.rb
    CHANGED
    
    
    
        data/lib/rcap/base/info.rb
    CHANGED
    
    | 
         @@ -1,52 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module RCAP
         
     | 
| 
       2 
4 
     | 
    
         
             
              module Base
         
     | 
| 
       3 
5 
     | 
    
         
             
                class Info
         
     | 
| 
       4 
6 
     | 
    
         
             
                  include Validation
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                  CATEGORY_GEO       =  
     | 
| 
       7 
     | 
    
         
            -
                  CATEGORY_MET       =  
     | 
| 
       8 
     | 
    
         
            -
                  CATEGORY_SAFETY    =  
     | 
| 
       9 
     | 
    
         
            -
                  CATEGORY_SECURITY  =  
     | 
| 
       10 
     | 
    
         
            -
                  CATEGORY_RESCUE    =  
     | 
| 
       11 
     | 
    
         
            -
                  CATEGORY_FIRE      =  
     | 
| 
       12 
     | 
    
         
            -
                  CATEGORY_HEALTH    =  
     | 
| 
       13 
     | 
    
         
            -
                  CATEGORY_ENV       =  
     | 
| 
       14 
     | 
    
         
            -
                  CATEGORY_TRANSPORT =  
     | 
| 
       15 
     | 
    
         
            -
                  CATEGORY_INFRA     =  
     | 
| 
       16 
     | 
    
         
            -
                  CATEGORY_CBRNE     =  
     | 
| 
       17 
     | 
    
         
            -
                  CATEGORY_OTHER     =  
     | 
| 
      
 8 
     | 
    
         
            +
                  CATEGORY_GEO       = 'Geo'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  CATEGORY_MET       = 'Met'
         
     | 
| 
      
 10 
     | 
    
         
            +
                  CATEGORY_SAFETY    = 'Safety'
         
     | 
| 
      
 11 
     | 
    
         
            +
                  CATEGORY_SECURITY  = 'Security'
         
     | 
| 
      
 12 
     | 
    
         
            +
                  CATEGORY_RESCUE    = 'Rescue'
         
     | 
| 
      
 13 
     | 
    
         
            +
                  CATEGORY_FIRE      = 'Fire'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  CATEGORY_HEALTH    = 'Health'
         
     | 
| 
      
 15 
     | 
    
         
            +
                  CATEGORY_ENV       = 'Env'
         
     | 
| 
      
 16 
     | 
    
         
            +
                  CATEGORY_TRANSPORT = 'Transport'
         
     | 
| 
      
 17 
     | 
    
         
            +
                  CATEGORY_INFRA     = 'Infra'
         
     | 
| 
      
 18 
     | 
    
         
            +
                  CATEGORY_CBRNE     = 'CBRNE'
         
     | 
| 
      
 19 
     | 
    
         
            +
                  CATEGORY_OTHER     = 'Other'
         
     | 
| 
       18 
20 
     | 
    
         
             
                  # Valid values for categories
         
     | 
| 
       19 
     | 
    
         
            -
                  VALID_CATEGORIES = [ 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  URGENCY_IMMEDIATE =  
     | 
| 
       25 
     | 
    
         
            -
                  URGENCY_EXPECTED  =  
     | 
| 
       26 
     | 
    
         
            -
                  URGENCY_FUTURE    =  
     | 
| 
       27 
     | 
    
         
            -
                  URGENCY_PAST      =  
     | 
| 
       28 
     | 
    
         
            -
                  URGENCY_UNKNOWN   =  
     | 
| 
      
 21 
     | 
    
         
            +
                  VALID_CATEGORIES = [CATEGORY_GEO, CATEGORY_MET, CATEGORY_SAFETY,
         
     | 
| 
      
 22 
     | 
    
         
            +
                                      CATEGORY_SECURITY, CATEGORY_RESCUE, CATEGORY_FIRE, CATEGORY_HEALTH,
         
     | 
| 
      
 23 
     | 
    
         
            +
                                      CATEGORY_ENV, CATEGORY_TRANSPORT, CATEGORY_INFRA, CATEGORY_CBRNE,
         
     | 
| 
      
 24 
     | 
    
         
            +
                                      CATEGORY_OTHER].freeze
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  URGENCY_IMMEDIATE = 'Immediate'
         
     | 
| 
      
 27 
     | 
    
         
            +
                  URGENCY_EXPECTED  = 'Expected'
         
     | 
| 
      
 28 
     | 
    
         
            +
                  URGENCY_FUTURE    = 'Future'
         
     | 
| 
      
 29 
     | 
    
         
            +
                  URGENCY_PAST      = 'Past'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  URGENCY_UNKNOWN   = 'Unknown'
         
     | 
| 
       29 
31 
     | 
    
         
             
                  # Valid values for urgency
         
     | 
| 
       30 
     | 
    
         
            -
                  VALID_URGENCIES = [ 
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                  SEVERITY_EXTREME  =  
     | 
| 
       34 
     | 
    
         
            -
                  SEVERITY_SEVERE   =  
     | 
| 
       35 
     | 
    
         
            -
                  SEVERITY_MODERATE =  
     | 
| 
       36 
     | 
    
         
            -
                  SEVERITY_MINOR    =  
     | 
| 
       37 
     | 
    
         
            -
                  SEVERITY_UNKNOWN  =  
     | 
| 
      
 32 
     | 
    
         
            +
                  VALID_URGENCIES = [URGENCY_IMMEDIATE, URGENCY_EXPECTED, URGENCY_FUTURE,
         
     | 
| 
      
 33 
     | 
    
         
            +
                                     URGENCY_PAST, URGENCY_UNKNOWN].freeze
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  SEVERITY_EXTREME  = 'Extreme'
         
     | 
| 
      
 36 
     | 
    
         
            +
                  SEVERITY_SEVERE   = 'Severe'
         
     | 
| 
      
 37 
     | 
    
         
            +
                  SEVERITY_MODERATE = 'Moderate'
         
     | 
| 
      
 38 
     | 
    
         
            +
                  SEVERITY_MINOR    = 'Minor'
         
     | 
| 
      
 39 
     | 
    
         
            +
                  SEVERITY_UNKNOWN  = 'Unknown'
         
     | 
| 
       38 
40 
     | 
    
         
             
                  # Valid values for severity
         
     | 
| 
       39 
     | 
    
         
            -
                  VALID_SEVERITIES = [ 
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  CERTAINTY_VERY_LIKELY =  
     | 
| 
       43 
     | 
    
         
            -
                  CERTAINTY_LIKELY      =  
     | 
| 
       44 
     | 
    
         
            -
                  CERTAINTY_POSSIBLE    =  
     | 
| 
       45 
     | 
    
         
            -
                  CERTAINTY_UNLIKELY    =  
     | 
| 
       46 
     | 
    
         
            -
                  CERTAINTY_UNKNOWN     =  
     | 
| 
      
 41 
     | 
    
         
            +
                  VALID_SEVERITIES = [SEVERITY_EXTREME, SEVERITY_SEVERE, SEVERITY_MODERATE,
         
     | 
| 
      
 42 
     | 
    
         
            +
                                      SEVERITY_MINOR, SEVERITY_UNKNOWN].freeze
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  CERTAINTY_VERY_LIKELY = 'Very Likely'
         
     | 
| 
      
 45 
     | 
    
         
            +
                  CERTAINTY_LIKELY      = 'Likely'
         
     | 
| 
      
 46 
     | 
    
         
            +
                  CERTAINTY_POSSIBLE    = 'Possible'
         
     | 
| 
      
 47 
     | 
    
         
            +
                  CERTAINTY_UNLIKELY    = 'Unlikely'
         
     | 
| 
      
 48 
     | 
    
         
            +
                  CERTAINTY_UNKNOWN     = 'Unknown'
         
     | 
| 
       47 
49 
     | 
    
         
             
                  # Valid valies for certainty
         
     | 
| 
       48 
     | 
    
         
            -
                  VALID_CERTAINTIES = [ 
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 50 
     | 
    
         
            +
                  VALID_CERTAINTIES = [CERTAINTY_VERY_LIKELY, CERTAINTY_LIKELY,
         
     | 
| 
      
 51 
     | 
    
         
            +
                                       CERTAINTY_POSSIBLE, CERTAINTY_UNLIKELY, CERTAINTY_UNKNOWN].freeze
         
     | 
| 
       50 
52 
     | 
    
         | 
| 
       51 
53 
     | 
    
         
             
                  XML_ELEMENT_NAME           = 'info'
         
     | 
| 
       52 
54 
     | 
    
         
             
                  LANGUAGE_ELEMENT_NAME      = 'language'
         
     | 
| 
         @@ -67,78 +69,77 @@ module RCAP 
     | 
|
| 
       67 
69 
     | 
    
         
             
                  WEB_ELEMENT_NAME           = 'web'
         
     | 
| 
       68 
70 
     | 
    
         
             
                  CONTACT_ELEMENT_NAME       = 'contact'
         
     | 
| 
       69 
71 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
                  XPATH               = "cap:#{ 
     | 
| 
       71 
     | 
    
         
            -
                  LANGUAGE_XPATH      = "cap:#{ 
     | 
| 
       72 
     | 
    
         
            -
                  EVENT_XPATH         = "cap:#{ 
     | 
| 
       73 
     | 
    
         
            -
                  URGENCY_XPATH       = "cap:#{ 
     | 
| 
       74 
     | 
    
         
            -
                  CATEGORY_XPATH      = "cap:#{ 
     | 
| 
       75 
     | 
    
         
            -
                  SEVERITY_XPATH      = "cap:#{ 
     | 
| 
       76 
     | 
    
         
            -
                  CERTAINTY_XPATH     = "cap:#{ 
     | 
| 
       77 
     | 
    
         
            -
                  AUDIENCE_XPATH      = "cap:#{ 
     | 
| 
       78 
     | 
    
         
            -
                  EVENT_CODE_XPATH    = "cap:#{ 
     | 
| 
       79 
     | 
    
         
            -
                  EFFECTIVE_XPATH     = "cap:#{ 
     | 
| 
       80 
     | 
    
         
            -
                  ONSET_XPATH         = "cap:#{ 
     | 
| 
       81 
     | 
    
         
            -
                  EXPIRES_XPATH       = "cap:#{ 
     | 
| 
       82 
     | 
    
         
            -
                  SENDER_NAME_XPATH   = "cap:#{ 
     | 
| 
       83 
     | 
    
         
            -
                  HEADLINE_XPATH      = "cap:#{ 
     | 
| 
       84 
     | 
    
         
            -
                  DESCRIPTION_XPATH   = "cap:#{ 
     | 
| 
       85 
     | 
    
         
            -
                  INSTRUCTION_XPATH   = "cap:#{ 
     | 
| 
       86 
     | 
    
         
            -
                  WEB_XPATH           = "cap:#{ 
     | 
| 
       87 
     | 
    
         
            -
                  CONTACT_XPATH       = "cap:#{ 
     | 
| 
      
 72 
     | 
    
         
            +
                  XPATH               = "cap:#{XML_ELEMENT_NAME}"
         
     | 
| 
      
 73 
     | 
    
         
            +
                  LANGUAGE_XPATH      = "cap:#{LANGUAGE_ELEMENT_NAME}"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  EVENT_XPATH         = "cap:#{EVENT_ELEMENT_NAME}"
         
     | 
| 
      
 75 
     | 
    
         
            +
                  URGENCY_XPATH       = "cap:#{URGENCY_ELEMENT_NAME}"
         
     | 
| 
      
 76 
     | 
    
         
            +
                  CATEGORY_XPATH      = "cap:#{CATEGORY_ELEMENT_NAME}"
         
     | 
| 
      
 77 
     | 
    
         
            +
                  SEVERITY_XPATH      = "cap:#{SEVERITY_ELEMENT_NAME}"
         
     | 
| 
      
 78 
     | 
    
         
            +
                  CERTAINTY_XPATH     = "cap:#{CERTAINTY_ELEMENT_NAME}"
         
     | 
| 
      
 79 
     | 
    
         
            +
                  AUDIENCE_XPATH      = "cap:#{AUDIENCE_ELEMENT_NAME}"
         
     | 
| 
      
 80 
     | 
    
         
            +
                  EVENT_CODE_XPATH    = "cap:#{EVENT_CODE_ELEMENT_NAME}"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  EFFECTIVE_XPATH     = "cap:#{EFFECTIVE_ELEMENT_NAME}"
         
     | 
| 
      
 82 
     | 
    
         
            +
                  ONSET_XPATH         = "cap:#{ONSET_ELEMENT_NAME}"
         
     | 
| 
      
 83 
     | 
    
         
            +
                  EXPIRES_XPATH       = "cap:#{EXPIRES_ELEMENT_NAME}"
         
     | 
| 
      
 84 
     | 
    
         
            +
                  SENDER_NAME_XPATH   = "cap:#{SENDER_NAME_ELEMENT_NAME}"
         
     | 
| 
      
 85 
     | 
    
         
            +
                  HEADLINE_XPATH      = "cap:#{HEADLINE_ELEMENT_NAME}"
         
     | 
| 
      
 86 
     | 
    
         
            +
                  DESCRIPTION_XPATH   = "cap:#{DESCRIPTION_ELEMENT_NAME}"
         
     | 
| 
      
 87 
     | 
    
         
            +
                  INSTRUCTION_XPATH   = "cap:#{INSTRUCTION_ELEMENT_NAME}"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  WEB_XPATH           = "cap:#{WEB_ELEMENT_NAME}"
         
     | 
| 
      
 89 
     | 
    
         
            +
                  CONTACT_XPATH       = "cap:#{CONTACT_ELEMENT_NAME}"
         
     | 
| 
       88 
90 
     | 
    
         | 
| 
       89 
91 
     | 
    
         
             
                  DEFAULT_LANGUAGE = 'en-US'
         
     | 
| 
       90 
92 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                  validates_presence_of( 
     | 
| 
       92 
     | 
    
         
            -
                  validates_presence_of( 
     | 
| 
       93 
     | 
    
         
            -
                  validates_presence_of( 
     | 
| 
       94 
     | 
    
         
            -
                  validates_presence_of( 
     | 
| 
       95 
     | 
    
         
            -
                  validates_inclusion_of( 
     | 
| 
       96 
     | 
    
         
            -
                  validates_inclusion_of( 
     | 
| 
       97 
     | 
    
         
            -
                  validates_inclusion_of_members_of( 
     | 
| 
       98 
     | 
    
         
            -
                  validates_collection_of( 
     | 
| 
      
 93 
     | 
    
         
            +
                  validates_presence_of(:event)
         
     | 
| 
      
 94 
     | 
    
         
            +
                  validates_presence_of(:urgency)
         
     | 
| 
      
 95 
     | 
    
         
            +
                  validates_presence_of(:severity)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  validates_presence_of(:certainty)
         
     | 
| 
      
 97 
     | 
    
         
            +
                  validates_inclusion_of(:severity, allow_nil: true, in: VALID_SEVERITIES, message: "can only be assigned the following values: #{VALID_SEVERITIES.join(', ')}")
         
     | 
| 
      
 98 
     | 
    
         
            +
                  validates_inclusion_of(:urgency, allow_nil: true, in: VALID_URGENCIES, message: "can only be assigned the following values: #{VALID_URGENCIES.join(', ')}")
         
     | 
| 
      
 99 
     | 
    
         
            +
                  validates_inclusion_of_members_of(:categories, in: VALID_CATEGORIES, allow_blank: true)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  validates_collection_of(:resources, :areas, :event_codes, :parameters)
         
     | 
| 
       99 
101 
     | 
    
         | 
| 
       100 
102 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       101 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 103 
     | 
    
         
            +
                  attr_accessor(:event)
         
     | 
| 
       102 
104 
     | 
    
         
             
                  # @return [String] Value can only be one of {VALID_URGENCIES}
         
     | 
| 
       103 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 105 
     | 
    
         
            +
                  attr_accessor(:urgency)
         
     | 
| 
       104 
106 
     | 
    
         
             
                  # @return [String] Value can only be one of {VALID_SEVERITIES}
         
     | 
| 
       105 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 107 
     | 
    
         
            +
                  attr_accessor(:severity)
         
     | 
| 
       106 
108 
     | 
    
         
             
                  # @return [String] Value can only be one of {VALID_CERTAINTIES}
         
     | 
| 
       107 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 109 
     | 
    
         
            +
                  attr_accessor(:certainty)
         
     | 
| 
       108 
110 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       109 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 111 
     | 
    
         
            +
                  attr_accessor(:language)
         
     | 
| 
       110 
112 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       111 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 113 
     | 
    
         
            +
                  attr_accessor(:audience)
         
     | 
| 
       112 
114 
     | 
    
         
             
                  # @return [DateTime] Effective start time of information
         
     | 
| 
       113 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 115 
     | 
    
         
            +
                  attr_accessor(:effective)
         
     | 
| 
       114 
116 
     | 
    
         
             
                  # @return [DateTime] Expected start of event
         
     | 
| 
       115 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 117 
     | 
    
         
            +
                  attr_accessor(:onset)
         
     | 
| 
       116 
118 
     | 
    
         
             
                  # @return [DateTime] Effective expiry time of information
         
     | 
| 
       117 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 119 
     | 
    
         
            +
                  attr_accessor(:expires)
         
     | 
| 
       118 
120 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       119 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 121 
     | 
    
         
            +
                  attr_accessor(:sender_name)
         
     | 
| 
       120 
122 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       121 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 123 
     | 
    
         
            +
                  attr_accessor(:headline)
         
     | 
| 
       122 
124 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       123 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 125 
     | 
    
         
            +
                  attr_accessor(:description)
         
     | 
| 
       124 
126 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       125 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 127 
     | 
    
         
            +
                  attr_accessor(:instruction)
         
     | 
| 
       126 
128 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       127 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 129 
     | 
    
         
            +
                  attr_accessor(:web)
         
     | 
| 
       128 
130 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       129 
     | 
    
         
            -
                  attr_accessor( 
     | 
| 
      
 131 
     | 
    
         
            +
                  attr_accessor(:contact)
         
     | 
| 
       130 
132 
     | 
    
         | 
| 
       131 
133 
     | 
    
         
             
                  # @return [Array<String>] Collection of textual categories; elements can be one of {VALID_CATEGORIES}
         
     | 
| 
       132 
     | 
    
         
            -
                  attr_reader( 
     | 
| 
      
 134 
     | 
    
         
            +
                  attr_reader(:categories)
         
     | 
| 
       133 
135 
     | 
    
         
             
                  # @return [Array<EventCode>] Collection of {EventCode} objects
         
     | 
| 
       134 
     | 
    
         
            -
                  attr_reader( 
     | 
| 
      
 136 
     | 
    
         
            +
                  attr_reader(:event_codes)
         
     | 
| 
       135 
137 
     | 
    
         
             
                  # @return [Array<Parameter>] Collection of {Parameter} objects
         
     | 
| 
       136 
     | 
    
         
            -
                  attr_reader( 
     | 
| 
      
 138 
     | 
    
         
            +
                  attr_reader(:parameters)
         
     | 
| 
       137 
139 
     | 
    
         
             
                  # @return [Array<Resource> Collection of {Resource} objects
         
     | 
| 
       138 
     | 
    
         
            -
                  attr_reader( 
     | 
| 
      
 140 
     | 
    
         
            +
                  attr_reader(:resources)
         
     | 
| 
       139 
141 
     | 
    
         
             
                  # @return [Array<Area>] Collection of {Area} objects
         
     | 
| 
       140 
     | 
    
         
            -
                  attr_reader( 
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
      
 142 
     | 
    
         
            +
                  attr_reader(:areas)
         
     | 
| 
       142 
143 
     | 
    
         | 
| 
       143 
144 
     | 
    
         
             
                  # Initialises a new Info object which will be yielded to an attached block if given
         
     | 
| 
       144 
145 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -150,15 +151,15 @@ module RCAP 
     | 
|
| 
       150 
151 
     | 
    
         
             
                    @parameters     = []
         
     | 
| 
       151 
152 
     | 
    
         
             
                    @resources      = []
         
     | 
| 
       152 
153 
     | 
    
         
             
                    @areas          = []
         
     | 
| 
       153 
     | 
    
         
            -
                    yield( 
     | 
| 
      
 154 
     | 
    
         
            +
                    yield(self) if block_given?
         
     | 
| 
       154 
155 
     | 
    
         
             
                  end
         
     | 
| 
       155 
156 
     | 
    
         | 
| 
       156 
157 
     | 
    
         
             
                  # Creates a new EventCode object and adds it to the event_codes array.
         
     | 
| 
       157 
158 
     | 
    
         
             
                  #
         
     | 
| 
       158 
159 
     | 
    
         
             
                  # @return [EventCode]
         
     | 
| 
       159 
160 
     | 
    
         
             
                  def add_event_code
         
     | 
| 
       160 
     | 
    
         
            -
                    event_code =  
     | 
| 
       161 
     | 
    
         
            -
                    yield( 
     | 
| 
      
 161 
     | 
    
         
            +
                    event_code = event_code_class.new
         
     | 
| 
      
 162 
     | 
    
         
            +
                    yield(event_code) if block_given?
         
     | 
| 
       162 
163 
     | 
    
         
             
                    @event_codes << event_code
         
     | 
| 
       163 
164 
     | 
    
         
             
                    event_code
         
     | 
| 
       164 
165 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -167,8 +168,8 @@ module RCAP 
     | 
|
| 
       167 
168 
     | 
    
         
             
                  #
         
     | 
| 
       168 
169 
     | 
    
         
             
                  # @return [Parameter]
         
     | 
| 
       169 
170 
     | 
    
         
             
                  def add_parameter
         
     | 
| 
       170 
     | 
    
         
            -
                    parameter =  
     | 
| 
       171 
     | 
    
         
            -
                    yield( 
     | 
| 
      
 171 
     | 
    
         
            +
                    parameter = parameter_class.new
         
     | 
| 
      
 172 
     | 
    
         
            +
                    yield(parameter) if block_given?
         
     | 
| 
       172 
173 
     | 
    
         
             
                    @parameters << parameter
         
     | 
| 
       173 
174 
     | 
    
         
             
                    parameter
         
     | 
| 
       174 
175 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -177,8 +178,8 @@ module RCAP 
     | 
|
| 
       177 
178 
     | 
    
         
             
                  #
         
     | 
| 
       178 
179 
     | 
    
         
             
                  # @return [Resource]
         
     | 
| 
       179 
180 
     | 
    
         
             
                  def add_resource
         
     | 
| 
       180 
     | 
    
         
            -
                    resource =  
     | 
| 
       181 
     | 
    
         
            -
                    yield( 
     | 
| 
      
 181 
     | 
    
         
            +
                    resource = resource_class.new
         
     | 
| 
      
 182 
     | 
    
         
            +
                    yield(resource) if block_given?
         
     | 
| 
       182 
183 
     | 
    
         
             
                    @resources << resource
         
     | 
| 
       183 
184 
     | 
    
         
             
                    resource
         
     | 
| 
       184 
185 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -187,123 +188,119 @@ module RCAP 
     | 
|
| 
       187 
188 
     | 
    
         
             
                  #
         
     | 
| 
       188 
189 
     | 
    
         
             
                  # @return [Area]
         
     | 
| 
       189 
190 
     | 
    
         
             
                  def add_area
         
     | 
| 
       190 
     | 
    
         
            -
                    area =  
     | 
| 
       191 
     | 
    
         
            -
                    yield( 
     | 
| 
      
 191 
     | 
    
         
            +
                    area = area_class.new
         
     | 
| 
      
 192 
     | 
    
         
            +
                    yield(area) if block_given?
         
     | 
| 
       192 
193 
     | 
    
         
             
                    @areas << area
         
     | 
| 
       193 
194 
     | 
    
         
             
                    area
         
     | 
| 
       194 
195 
     | 
    
         
             
                  end
         
     | 
| 
       195 
196 
     | 
    
         | 
| 
       196 
197 
     | 
    
         
             
                  # @return [REXML::Element]
         
     | 
| 
       197 
198 
     | 
    
         
             
                  def to_xml_element
         
     | 
| 
       198 
     | 
    
         
            -
                    xml_element = REXML::Element.new( 
     | 
| 
       199 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
      
 199 
     | 
    
         
            +
                    xml_element = REXML::Element.new(XML_ELEMENT_NAME)
         
     | 
| 
      
 200 
     | 
    
         
            +
                    xml_element.add_element(LANGUAGE_ELEMENT_NAME).add_text(@language) if @language
         
     | 
| 
       200 
201 
     | 
    
         
             
                    @categories.each do |category|
         
     | 
| 
       201 
     | 
    
         
            -
                      xml_element.add_element( 
     | 
| 
      
 202 
     | 
    
         
            +
                      xml_element.add_element(CATEGORY_ELEMENT_NAME).add_text(category)
         
     | 
| 
       202 
203 
     | 
    
         
             
                    end
         
     | 
| 
       203 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       204 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       205 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       206 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       207 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
      
 204 
     | 
    
         
            +
                    xml_element.add_element(EVENT_ELEMENT_NAME).add_text(@event)
         
     | 
| 
      
 205 
     | 
    
         
            +
                    xml_element.add_element(URGENCY_ELEMENT_NAME).add_text(@urgency)
         
     | 
| 
      
 206 
     | 
    
         
            +
                    xml_element.add_element(SEVERITY_ELEMENT_NAME).add_text(@severity)
         
     | 
| 
      
 207 
     | 
    
         
            +
                    xml_element.add_element(CERTAINTY_ELEMENT_NAME).add_text(@certainty)
         
     | 
| 
      
 208 
     | 
    
         
            +
                    xml_element.add_element(AUDIENCE_ELEMENT_NAME).add_text(@audience) if @audience
         
     | 
| 
       208 
209 
     | 
    
         
             
                    @event_codes.each do |event_code|
         
     | 
| 
       209 
     | 
    
         
            -
                      xml_element.add_element( 
     | 
| 
      
 210 
     | 
    
         
            +
                      xml_element.add_element(event_code.to_xml_element)
         
     | 
| 
       210 
211 
     | 
    
         
             
                    end
         
     | 
| 
       211 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       212 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       213 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       214 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       215 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       216 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       217 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       218 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
       219 
     | 
    
         
            -
                    xml_element.add_element( 
     | 
| 
      
 212 
     | 
    
         
            +
                    xml_element.add_element(EFFECTIVE_ELEMENT_NAME).add_text(@effective.to_s_for_cap) if @effective
         
     | 
| 
      
 213 
     | 
    
         
            +
                    xml_element.add_element(ONSET_ELEMENT_NAME).add_text(@onset.to_s_for_cap)         if @onset
         
     | 
| 
      
 214 
     | 
    
         
            +
                    xml_element.add_element(EXPIRES_ELEMENT_NAME).add_text(@expires.to_s_for_cap)     if @expires
         
     | 
| 
      
 215 
     | 
    
         
            +
                    xml_element.add_element(SENDER_NAME_ELEMENT_NAME).add_text(@sender_name)          if @sender_name
         
     | 
| 
      
 216 
     | 
    
         
            +
                    xml_element.add_element(HEADLINE_ELEMENT_NAME).add_text(@headline)                if @headline
         
     | 
| 
      
 217 
     | 
    
         
            +
                    xml_element.add_element(DESCRIPTION_ELEMENT_NAME).add_text(@description)          if @description
         
     | 
| 
      
 218 
     | 
    
         
            +
                    xml_element.add_element(INSTRUCTION_ELEMENT_NAME).add_text(@instruction)          if @instruction
         
     | 
| 
      
 219 
     | 
    
         
            +
                    xml_element.add_element(WEB_ELEMENT_NAME).add_text(@web)                          if @web
         
     | 
| 
      
 220 
     | 
    
         
            +
                    xml_element.add_element(CONTACT_ELEMENT_NAME).add_text(@contact)                  if @contact
         
     | 
| 
       220 
221 
     | 
    
         
             
                    @parameters.each do |parameter|
         
     | 
| 
       221 
     | 
    
         
            -
                      xml_element.add_element( 
     | 
| 
      
 222 
     | 
    
         
            +
                      xml_element.add_element(parameter.to_xml_element)
         
     | 
| 
       222 
223 
     | 
    
         
             
                    end
         
     | 
| 
       223 
224 
     | 
    
         
             
                    @resources.each do |resource|
         
     | 
| 
       224 
     | 
    
         
            -
                      xml_element.add_element( 
     | 
| 
      
 225 
     | 
    
         
            +
                      xml_element.add_element(resource.to_xml_element)
         
     | 
| 
       225 
226 
     | 
    
         
             
                    end
         
     | 
| 
       226 
227 
     | 
    
         
             
                    @areas.each do |area|
         
     | 
| 
       227 
     | 
    
         
            -
                      xml_element.add_element( 
     | 
| 
      
 228 
     | 
    
         
            +
                      xml_element.add_element(area.to_xml_element)
         
     | 
| 
       228 
229 
     | 
    
         
             
                    end
         
     | 
| 
       229 
230 
     | 
    
         
             
                    xml_element
         
     | 
| 
       230 
231 
     | 
    
         
             
                  end
         
     | 
| 
       231 
232 
     | 
    
         | 
| 
       232 
233 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       233 
234 
     | 
    
         
             
                  def to_xml
         
     | 
| 
       234 
     | 
    
         
            -
                     
     | 
| 
      
 235 
     | 
    
         
            +
                    to_xml_element.to_s
         
     | 
| 
       235 
236 
     | 
    
         
             
                  end
         
     | 
| 
       236 
237 
     | 
    
         | 
| 
       237 
238 
     | 
    
         
             
                  # @param [REXML::Element] info_xml_element
         
     | 
| 
       238 
239 
     | 
    
         
             
                  # @return [Info]
         
     | 
| 
       239 
     | 
    
         
            -
                  def self.from_xml_element( 
     | 
| 
       240 
     | 
    
         
            -
                     
     | 
| 
       241 
     | 
    
         
            -
                      info.language 
     | 
| 
      
 240 
     | 
    
         
            +
                  def self.from_xml_element(info_xml_element)
         
     | 
| 
      
 241 
     | 
    
         
            +
                    new do |info|
         
     | 
| 
      
 242 
     | 
    
         
            +
                      info.language = RCAP.xpath_text(info_xml_element, LANGUAGE_XPATH, info.xmlns) || DEFAULT_LANGUAGE
         
     | 
| 
       242 
243 
     | 
    
         | 
| 
       243 
     | 
    
         
            -
                      RCAP.xpath_match( 
     | 
| 
      
 244 
     | 
    
         
            +
                      RCAP.xpath_match(info_xml_element, CATEGORY_XPATH, info.xmlns).each do |element|
         
     | 
| 
       244 
245 
     | 
    
         
             
                        info.categories << element.text
         
     | 
| 
       245 
246 
     | 
    
         
             
                      end
         
     | 
| 
       246 
247 
     | 
    
         | 
| 
       247 
     | 
    
         
            -
                      info.event          = RCAP.xpath_text( 
     | 
| 
       248 
     | 
    
         
            -
                      info.urgency        = RCAP.xpath_text( 
     | 
| 
       249 
     | 
    
         
            -
                      info.severity       = RCAP.xpath_text( 
     | 
| 
       250 
     | 
    
         
            -
                      info.certainty      = RCAP.xpath_text( 
     | 
| 
       251 
     | 
    
         
            -
                      info.audience       = RCAP.xpath_text( 
     | 
| 
       252 
     | 
    
         
            -
                      info.effective      = RCAP.parse_datetime( 
     | 
| 
       253 
     | 
    
         
            -
                      info.onset          = RCAP.parse_datetime( 
     | 
| 
       254 
     | 
    
         
            -
                      info.expires        = RCAP.parse_datetime( 
     | 
| 
       255 
     | 
    
         
            -
                      info.sender_name    = RCAP.xpath_text( 
     | 
| 
       256 
     | 
    
         
            -
                      info.headline       = RCAP.xpath_text( 
     | 
| 
       257 
     | 
    
         
            -
                      info.description    = RCAP.xpath_text( 
     | 
| 
       258 
     | 
    
         
            -
                      info.instruction    = RCAP.xpath_text( 
     | 
| 
       259 
     | 
    
         
            -
                      info.web            = RCAP.xpath_text( 
     | 
| 
       260 
     | 
    
         
            -
                      info.contact        = RCAP.xpath_text( 
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
                      RCAP.xpath_match( 
     | 
| 
       263 
     | 
    
         
            -
                        info.event_codes << info.event_code_class.from_xml_element( 
     | 
| 
      
 248 
     | 
    
         
            +
                      info.event          = RCAP.xpath_text(info_xml_element, EVENT_XPATH, info.xmlns)
         
     | 
| 
      
 249 
     | 
    
         
            +
                      info.urgency        = RCAP.xpath_text(info_xml_element, URGENCY_XPATH, info.xmlns)
         
     | 
| 
      
 250 
     | 
    
         
            +
                      info.severity       = RCAP.xpath_text(info_xml_element, SEVERITY_XPATH, info.xmlns)
         
     | 
| 
      
 251 
     | 
    
         
            +
                      info.certainty      = RCAP.xpath_text(info_xml_element, CERTAINTY_XPATH, info.xmlns)
         
     | 
| 
      
 252 
     | 
    
         
            +
                      info.audience       = RCAP.xpath_text(info_xml_element, AUDIENCE_XPATH, info.xmlns)
         
     | 
| 
      
 253 
     | 
    
         
            +
                      info.effective      = RCAP.parse_datetime(RCAP.xpath_text(info_xml_element, EFFECTIVE_XPATH, info.xmlns))
         
     | 
| 
      
 254 
     | 
    
         
            +
                      info.onset          = RCAP.parse_datetime(RCAP.xpath_text(info_xml_element, ONSET_XPATH, info.xmlns))
         
     | 
| 
      
 255 
     | 
    
         
            +
                      info.expires        = RCAP.parse_datetime(RCAP.xpath_text(info_xml_element, EXPIRES_XPATH, info.xmlns))
         
     | 
| 
      
 256 
     | 
    
         
            +
                      info.sender_name    = RCAP.xpath_text(info_xml_element, SENDER_NAME_XPATH, info.xmlns)
         
     | 
| 
      
 257 
     | 
    
         
            +
                      info.headline       = RCAP.xpath_text(info_xml_element, HEADLINE_XPATH, info.xmlns)
         
     | 
| 
      
 258 
     | 
    
         
            +
                      info.description    = RCAP.xpath_text(info_xml_element, DESCRIPTION_XPATH, info.xmlns)
         
     | 
| 
      
 259 
     | 
    
         
            +
                      info.instruction    = RCAP.xpath_text(info_xml_element, INSTRUCTION_XPATH, info.xmlns)
         
     | 
| 
      
 260 
     | 
    
         
            +
                      info.web            = RCAP.xpath_text(info_xml_element, WEB_XPATH, info.xmlns)
         
     | 
| 
      
 261 
     | 
    
         
            +
                      info.contact        = RCAP.xpath_text(info_xml_element, CONTACT_XPATH, info.xmlns)
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
                      RCAP.xpath_match(info_xml_element, info.event_code_class::XPATH, info.xmlns).each do |element|
         
     | 
| 
      
 264 
     | 
    
         
            +
                        info.event_codes << info.event_code_class.from_xml_element(element)
         
     | 
| 
       264 
265 
     | 
    
         
             
                      end
         
     | 
| 
       265 
266 
     | 
    
         | 
| 
       266 
     | 
    
         
            -
                      RCAP.xpath_match( 
     | 
| 
       267 
     | 
    
         
            -
                        info.parameters <<  info.parameter_class.from_xml_element( 
     | 
| 
      
 267 
     | 
    
         
            +
                      RCAP.xpath_match(info_xml_element, info.parameter_class::XPATH, info.xmlns).each do |element|
         
     | 
| 
      
 268 
     | 
    
         
            +
                        info.parameters <<  info.parameter_class.from_xml_element(element)
         
     | 
| 
       268 
269 
     | 
    
         
             
                      end
         
     | 
| 
       269 
270 
     | 
    
         | 
| 
       270 
     | 
    
         
            -
                      RCAP.xpath_match( 
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
      
 271 
     | 
    
         
            +
                      RCAP.xpath_match(info_xml_element, info.resource_class::XPATH, info.xmlns).each do |element|
         
     | 
| 
      
 272 
     | 
    
         
            +
                        info.resources << info.resource_class.from_xml_element(element)
         
     | 
| 
       272 
273 
     | 
    
         
             
                      end
         
     | 
| 
       273 
274 
     | 
    
         | 
| 
       274 
     | 
    
         
            -
                      RCAP.xpath_match( 
     | 
| 
       275 
     | 
    
         
            -
                        info.areas << info.area_class.from_xml_element( 
     | 
| 
      
 275 
     | 
    
         
            +
                      RCAP.xpath_match(info_xml_element, info.area_class::XPATH, info.xmlns).each do |element|
         
     | 
| 
      
 276 
     | 
    
         
            +
                        info.areas << info.area_class.from_xml_element(element)
         
     | 
| 
       276 
277 
     | 
    
         
             
                      end
         
     | 
| 
       277 
278 
     | 
    
         
             
                    end
         
     | 
| 
       278 
279 
     | 
    
         
             
                  end
         
     | 
| 
       279 
280 
     | 
    
         | 
| 
       280 
281 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       281 
282 
     | 
    
         
             
                  def inspect
         
     | 
| 
       282 
     | 
    
         
            -
                    info_inspect = "Language:       #{ 
     | 
| 
       283 
     | 
    
         
            -
                    "Categories:     #{ 
     | 
| 
       284 
     | 
    
         
            -
                    "Event:          #{ 
     | 
| 
       285 
     | 
    
         
            -
                    "Urgency:        #{ 
     | 
| 
       286 
     | 
    
         
            -
                    "Severity:       #{ 
     | 
| 
       287 
     | 
    
         
            -
                    "Certainty:      #{ 
     | 
| 
       288 
     | 
    
         
            -
                    "Audience:       #{ 
     | 
| 
       289 
     | 
    
         
            -
                    "Event Codes:    #{ 
     | 
| 
       290 
     | 
    
         
            -
                    "Effective:      #{ 
     | 
| 
       291 
     | 
    
         
            -
                    "Onset:          #{ 
     | 
| 
       292 
     | 
    
         
            -
                    "Expires:        #{ 
     | 
| 
       293 
     | 
    
         
            -
                    "Sender Name:    #{ 
     | 
| 
       294 
     | 
    
         
            -
                    "Headline:       #{ 
     | 
| 
       295 
     | 
    
         
            -
                    "Description:\n"+
         
     | 
| 
       296 
     | 
    
         
            -
                      @ 
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
                    " 
     | 
| 
       299 
     | 
    
         
            -
                    " 
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
                      @ 
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
                      @resources.map{ |resource| "  " + resource.inspect }.join( "\n" )+"\n"+
         
     | 
| 
       304 
     | 
    
         
            -
                      "Area:\n"+
         
     | 
| 
       305 
     | 
    
         
            -
                      @areas.map{ |area| "  #{ area }" }.join( "\n" )+"\n"
         
     | 
| 
       306 
     | 
    
         
            -
                    RCAP.format_lines_for_inspect( 'INFO', info_inspect )
         
     | 
| 
      
 283 
     | 
    
         
            +
                    info_inspect = "Language:       #{@language}\n"\
         
     | 
| 
      
 284 
     | 
    
         
            +
                    "Categories:     #{@categories.to_s_for_cap}\n"\
         
     | 
| 
      
 285 
     | 
    
         
            +
                    "Event:          #{@event}\n"\
         
     | 
| 
      
 286 
     | 
    
         
            +
                    "Urgency:        #{@urgency}\n"\
         
     | 
| 
      
 287 
     | 
    
         
            +
                    "Severity:       #{@severity}\n"\
         
     | 
| 
      
 288 
     | 
    
         
            +
                    "Certainty:      #{@certainty}\n"\
         
     | 
| 
      
 289 
     | 
    
         
            +
                    "Audience:       #{@audience}\n"\
         
     | 
| 
      
 290 
     | 
    
         
            +
                    "Event Codes:    #{@event_codes.inspect}\n"\
         
     | 
| 
      
 291 
     | 
    
         
            +
                    "Effective:      #{@effective}\n"\
         
     | 
| 
      
 292 
     | 
    
         
            +
                    "Onset:          #{@onset}\n"\
         
     | 
| 
      
 293 
     | 
    
         
            +
                    "Expires:        #{@expires}\n"\
         
     | 
| 
      
 294 
     | 
    
         
            +
                    "Sender Name:    #{@sender_name}\n"\
         
     | 
| 
      
 295 
     | 
    
         
            +
                    "Headline:       #{@headline}\n"\
         
     | 
| 
      
 296 
     | 
    
         
            +
                    "Description:\n" + @description.to_s.lines.map { |line| '  ' + line }.join("\n") + "\n"\
         
     | 
| 
      
 297 
     | 
    
         
            +
                      "Instruction:    #{@instruction}\n"\
         
     | 
| 
      
 298 
     | 
    
         
            +
                    "Web:            #{@web}\n"\
         
     | 
| 
      
 299 
     | 
    
         
            +
                    "Contact:        #{@contact}\n"\
         
     | 
| 
      
 300 
     | 
    
         
            +
                    "Parameters:\n" + @parameters.map { |parameter| '  ' + parameter.inspect }.join("\n") + "\n"\
         
     | 
| 
      
 301 
     | 
    
         
            +
                      "Resources:\n" + @resources.map { |resource| '  ' + resource.inspect }.join("\n") + "\n"\
         
     | 
| 
      
 302 
     | 
    
         
            +
                      "Area:\n" + @areas.map { |area| "  #{area}" }.join("\n") + "\n"
         
     | 
| 
      
 303 
     | 
    
         
            +
                    RCAP.format_lines_for_inspect('INFO', info_inspect)
         
     | 
| 
       307 
304 
     | 
    
         
             
                  end
         
     | 
| 
       308 
305 
     | 
    
         | 
| 
       309 
306 
     | 
    
         
             
                  # Returns a string representation of the event of the form
         
     | 
| 
         @@ -311,7 +308,7 @@ module RCAP 
     | 
|
| 
       311 
308 
     | 
    
         
             
                  #
         
     | 
| 
       312 
309 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       313 
310 
     | 
    
         
             
                  def to_s
         
     | 
| 
       314 
     | 
    
         
            -
                    "#{ 
     | 
| 
      
 311 
     | 
    
         
            +
                    "#{@event}(#{@urgency}/#{@severity}/#{@certainty})"
         
     | 
| 
       315 
312 
     | 
    
         
             
                  end
         
     | 
| 
       316 
313 
     | 
    
         | 
| 
       317 
314 
     | 
    
         
             
                  LANGUAGE_YAML       = 'Language'
         
     | 
| 
         @@ -337,78 +334,78 @@ module RCAP 
     | 
|
| 
       337 
334 
     | 
    
         | 
| 
       338 
335 
     | 
    
         
             
                  # @return [Hash]
         
     | 
| 
       339 
336 
     | 
    
         
             
                  def to_yaml_data
         
     | 
| 
       340 
     | 
    
         
            -
                    parameter_to_hash =  
     | 
| 
       341 
     | 
    
         
            -
             
     | 
| 
       342 
     | 
    
         
            -
                    RCAP.attribute_values_to_hash( 
     | 
| 
       343 
     | 
    
         
            -
             
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
             
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
       348 
     | 
    
         
            -
             
     | 
| 
       349 
     | 
    
         
            -
             
     | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
       352 
     | 
    
         
            -
             
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
             
     | 
| 
       355 
     | 
    
         
            -
             
     | 
| 
       356 
     | 
    
         
            -
             
     | 
| 
       357 
     | 
    
         
            -
             
     | 
| 
       358 
     | 
    
         
            -
             
     | 
| 
       359 
     | 
    
         
            -
             
     | 
| 
       360 
     | 
    
         
            -
             
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
      
 337 
     | 
    
         
            +
                    parameter_to_hash = ->(hash, parameter) { hash.merge(parameter.name => parameter.value) }
         
     | 
| 
      
 338 
     | 
    
         
            +
             
     | 
| 
      
 339 
     | 
    
         
            +
                    RCAP.attribute_values_to_hash([LANGUAGE_YAML,       @language],
         
     | 
| 
      
 340 
     | 
    
         
            +
                                                  [CATEGORIES_YAML,     @categories],
         
     | 
| 
      
 341 
     | 
    
         
            +
                                                  [EVENT_YAML,          @event],
         
     | 
| 
      
 342 
     | 
    
         
            +
                                                  [URGENCY_YAML,        @urgency],
         
     | 
| 
      
 343 
     | 
    
         
            +
                                                  [SEVERITY_YAML,       @severity],
         
     | 
| 
      
 344 
     | 
    
         
            +
                                                  [CERTAINTY_YAML,      @certainty],
         
     | 
| 
      
 345 
     | 
    
         
            +
                                                  [AUDIENCE_YAML,       @audience],
         
     | 
| 
      
 346 
     | 
    
         
            +
                                                  [EFFECTIVE_YAML,      @effective],
         
     | 
| 
      
 347 
     | 
    
         
            +
                                                  [ONSET_YAML,          @onset],
         
     | 
| 
      
 348 
     | 
    
         
            +
                                                  [EXPIRES_YAML,        @expires],
         
     | 
| 
      
 349 
     | 
    
         
            +
                                                  [SENDER_NAME_YAML,    @sender_name],
         
     | 
| 
      
 350 
     | 
    
         
            +
                                                  [HEADLINE_YAML,       @headline],
         
     | 
| 
      
 351 
     | 
    
         
            +
                                                  [DESCRIPTION_YAML,    @description],
         
     | 
| 
      
 352 
     | 
    
         
            +
                                                  [INSTRUCTION_YAML,    @instruction],
         
     | 
| 
      
 353 
     | 
    
         
            +
                                                  [WEB_YAML,            @web],
         
     | 
| 
      
 354 
     | 
    
         
            +
                                                  [CONTACT_YAML,        @contact],
         
     | 
| 
      
 355 
     | 
    
         
            +
                                                  [EVENT_CODES_YAML,    @event_codes.inject({}, ¶meter_to_hash)],
         
     | 
| 
      
 356 
     | 
    
         
            +
                                                  [PARAMETERS_YAML,     @parameters.inject({}, ¶meter_to_hash)],
         
     | 
| 
      
 357 
     | 
    
         
            +
                                                  [RESOURCES_YAML,      @resources.map(&:to_yaml_data)],
         
     | 
| 
      
 358 
     | 
    
         
            +
                                                  [AREAS_YAML,          @areas.map(&:to_yaml_data)])
         
     | 
| 
       362 
359 
     | 
    
         
             
                  end
         
     | 
| 
       363 
360 
     | 
    
         | 
| 
       364 
361 
     | 
    
         
             
                  # @return [String]
         
     | 
| 
       365 
     | 
    
         
            -
                  def to_yaml( 
     | 
| 
       366 
     | 
    
         
            -
                     
     | 
| 
      
 362 
     | 
    
         
            +
                  def to_yaml(options = {})
         
     | 
| 
      
 363 
     | 
    
         
            +
                    to_yaml_data.to_yaml(options)
         
     | 
| 
       367 
364 
     | 
    
         
             
                  end
         
     | 
| 
       368 
365 
     | 
    
         | 
| 
       369 
366 
     | 
    
         
             
                  # @param [Hash] info_yaml_data
         
     | 
| 
       370 
367 
     | 
    
         
             
                  # @return [Info]
         
     | 
| 
       371 
     | 
    
         
            -
                  def self.from_yaml_data( 
     | 
| 
       372 
     | 
    
         
            -
                     
     | 
| 
       373 
     | 
    
         
            -
                      info.language 
     | 
| 
       374 
     | 
    
         
            -
                      Array( 
     | 
| 
      
 368 
     | 
    
         
            +
                  def self.from_yaml_data(info_yaml_data)
         
     | 
| 
      
 369 
     | 
    
         
            +
                    new do |info|
         
     | 
| 
      
 370 
     | 
    
         
            +
                      info.language = info_yaml_data [LANGUAGE_YAML]
         
     | 
| 
      
 371 
     | 
    
         
            +
                      Array(info_yaml_data [CATEGORIES_YAML]).each do |category|
         
     | 
| 
       375 
372 
     | 
    
         
             
                        info.categories << category
         
     | 
| 
       376 
373 
     | 
    
         
             
                      end
         
     | 
| 
       377 
     | 
    
         
            -
                      info.event       = RCAP.strip_if_given( 
     | 
| 
       378 
     | 
    
         
            -
                      info.urgency     = RCAP.strip_if_given( 
     | 
| 
       379 
     | 
    
         
            -
                      info.severity    = RCAP.strip_if_given( 
     | 
| 
       380 
     | 
    
         
            -
                      info.certainty   = RCAP.strip_if_given( 
     | 
| 
       381 
     | 
    
         
            -
                      info.audience    = RCAP.strip_if_given( 
     | 
| 
       382 
     | 
    
         
            -
                      info.effective   = RCAP.parse_datetime( 
     | 
| 
       383 
     | 
    
         
            -
                      info.onset       = RCAP.parse_datetime( 
     | 
| 
       384 
     | 
    
         
            -
                      info.expires     = RCAP.parse_datetime( 
     | 
| 
       385 
     | 
    
         
            -
                      info.sender_name = RCAP.strip_if_given( 
     | 
| 
       386 
     | 
    
         
            -
                      info.headline    = RCAP.strip_if_given( 
     | 
| 
       387 
     | 
    
         
            -
                      info.description = RCAP.strip_if_given( 
     | 
| 
       388 
     | 
    
         
            -
                      info.instruction = RCAP.strip_if_given( 
     | 
| 
       389 
     | 
    
         
            -
                      info.web         = RCAP.strip_if_given( 
     | 
| 
       390 
     | 
    
         
            -
                      info.contact     = RCAP.strip_if_given( 
     | 
| 
       391 
     | 
    
         
            -
             
     | 
| 
       392 
     | 
    
         
            -
                      Array( 
     | 
| 
      
 374 
     | 
    
         
            +
                      info.event       = RCAP.strip_if_given(info_yaml_data [EVENT_YAML])
         
     | 
| 
      
 375 
     | 
    
         
            +
                      info.urgency     = RCAP.strip_if_given(info_yaml_data [URGENCY_YAML])
         
     | 
| 
      
 376 
     | 
    
         
            +
                      info.severity    = RCAP.strip_if_given(info_yaml_data [SEVERITY_YAML])
         
     | 
| 
      
 377 
     | 
    
         
            +
                      info.certainty   = RCAP.strip_if_given(info_yaml_data [CERTAINTY_YAML])
         
     | 
| 
      
 378 
     | 
    
         
            +
                      info.audience    = RCAP.strip_if_given(info_yaml_data [AUDIENCE_YAML])
         
     | 
| 
      
 379 
     | 
    
         
            +
                      info.effective   = RCAP.parse_datetime(info_yaml_data[EFFECTIVE_YAML])
         
     | 
| 
      
 380 
     | 
    
         
            +
                      info.onset       = RCAP.parse_datetime(info_yaml_data[ONSET_YAML])
         
     | 
| 
      
 381 
     | 
    
         
            +
                      info.expires     = RCAP.parse_datetime(info_yaml_data[EXPIRES_YAML])
         
     | 
| 
      
 382 
     | 
    
         
            +
                      info.sender_name = RCAP.strip_if_given(info_yaml_data [SENDER_NAME_YAML])
         
     | 
| 
      
 383 
     | 
    
         
            +
                      info.headline    = RCAP.strip_if_given(info_yaml_data [HEADLINE_YAML])
         
     | 
| 
      
 384 
     | 
    
         
            +
                      info.description = RCAP.strip_if_given(info_yaml_data [DESCRIPTION_YAML])
         
     | 
| 
      
 385 
     | 
    
         
            +
                      info.instruction = RCAP.strip_if_given(info_yaml_data [INSTRUCTION_YAML])
         
     | 
| 
      
 386 
     | 
    
         
            +
                      info.web         = RCAP.strip_if_given(info_yaml_data [WEB_YAML])
         
     | 
| 
      
 387 
     | 
    
         
            +
                      info.contact     = RCAP.strip_if_given(info_yaml_data [CONTACT_YAML])
         
     | 
| 
      
 388 
     | 
    
         
            +
             
     | 
| 
      
 389 
     | 
    
         
            +
                      Array(info_yaml_data [EVENT_CODES_YAML]).each do |name, value|
         
     | 
| 
       393 
390 
     | 
    
         
             
                        info.add_event_code do |event_code|
         
     | 
| 
       394 
     | 
    
         
            -
                          event_code.name  = RCAP.strip_if_given( 
     | 
| 
       395 
     | 
    
         
            -
                          event_code.value = RCAP.strip_if_given( 
     | 
| 
      
 391 
     | 
    
         
            +
                          event_code.name  = RCAP.strip_if_given(name)
         
     | 
| 
      
 392 
     | 
    
         
            +
                          event_code.value = RCAP.strip_if_given(value)
         
     | 
| 
       396 
393 
     | 
    
         
             
                        end
         
     | 
| 
       397 
394 
     | 
    
         
             
                      end
         
     | 
| 
       398 
395 
     | 
    
         | 
| 
       399 
     | 
    
         
            -
                      Array( 
     | 
| 
      
 396 
     | 
    
         
            +
                      Array(info_yaml_data [PARAMETERS_YAML]).each do |name, value|
         
     | 
| 
       400 
397 
     | 
    
         
             
                        info.add_parameter do |parameter|
         
     | 
| 
       401 
     | 
    
         
            -
                          parameter.name  = RCAP.strip_if_given( 
     | 
| 
       402 
     | 
    
         
            -
                          parameter.value = RCAP.strip_if_given( 
     | 
| 
      
 398 
     | 
    
         
            +
                          parameter.name  = RCAP.strip_if_given(name)
         
     | 
| 
      
 399 
     | 
    
         
            +
                          parameter.value = RCAP.strip_if_given(value)
         
     | 
| 
       403 
400 
     | 
    
         
             
                        end
         
     | 
| 
       404 
401 
     | 
    
         
             
                      end
         
     | 
| 
       405 
402 
     | 
    
         | 
| 
       406 
     | 
    
         
            -
                      Array( 
     | 
| 
       407 
     | 
    
         
            -
                        info.resources << info.resource_class.from_yaml_data( 
     | 
| 
      
 403 
     | 
    
         
            +
                      Array(info_yaml_data [RESOURCES_YAML]).each do |resource_yaml_data|
         
     | 
| 
      
 404 
     | 
    
         
            +
                        info.resources << info.resource_class.from_yaml_data(resource_yaml_data)
         
     | 
| 
       408 
405 
     | 
    
         
             
                      end
         
     | 
| 
       409 
406 
     | 
    
         | 
| 
       410 
     | 
    
         
            -
                      Array( 
     | 
| 
       411 
     | 
    
         
            -
                        info.areas << info.area_class.from_yaml_data( 
     | 
| 
      
 407 
     | 
    
         
            +
                      Array(info_yaml_data [AREAS_YAML]).each do |area_yaml_data|
         
     | 
| 
      
 408 
     | 
    
         
            +
                        info.areas << info.area_class.from_yaml_data(area_yaml_data)
         
     | 
| 
       412 
409 
     | 
    
         
             
                      end
         
     | 
| 
       413 
410 
     | 
    
         
             
                    end
         
     | 
| 
       414 
411 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -436,68 +433,72 @@ module RCAP 
     | 
|
| 
       436 
433 
     | 
    
         | 
| 
       437 
434 
     | 
    
         
             
                  # @return [Hash]
         
     | 
| 
       438 
435 
     | 
    
         
             
                  def to_h
         
     | 
| 
       439 
     | 
    
         
            -
                    RCAP.attribute_values_to_hash( 
     | 
| 
       440 
     | 
    
         
            -
             
     | 
| 
       441 
     | 
    
         
            -
             
     | 
| 
       442 
     | 
    
         
            -
             
     | 
| 
       443 
     | 
    
         
            -
             
     | 
| 
       444 
     | 
    
         
            -
             
     | 
| 
       445 
     | 
    
         
            -
             
     | 
| 
       446 
     | 
    
         
            -
             
     | 
| 
       447 
     | 
    
         
            -
             
     | 
| 
       448 
     | 
    
         
            -
             
     | 
| 
       449 
     | 
    
         
            -
             
     | 
| 
       450 
     | 
    
         
            -
             
     | 
| 
       451 
     | 
    
         
            -
             
     | 
| 
       452 
     | 
    
         
            -
             
     | 
| 
       453 
     | 
    
         
            -
             
     | 
| 
       454 
     | 
    
         
            -
             
     | 
| 
       455 
     | 
    
         
            -
             
     | 
| 
       456 
     | 
    
         
            -
             
     | 
| 
       457 
     | 
    
         
            -
             
     | 
| 
       458 
     | 
    
         
            -
             
     | 
| 
      
 436 
     | 
    
         
            +
                    RCAP.attribute_values_to_hash([LANGUAGE_KEY, @language],
         
     | 
| 
      
 437 
     | 
    
         
            +
                                                  [CATEGORIES_KEY,     @categories],
         
     | 
| 
      
 438 
     | 
    
         
            +
                                                  [EVENT_KEY,          @event],
         
     | 
| 
      
 439 
     | 
    
         
            +
                                                  [URGENCY_KEY,        @urgency],
         
     | 
| 
      
 440 
     | 
    
         
            +
                                                  [SEVERITY_KEY,       @severity],
         
     | 
| 
      
 441 
     | 
    
         
            +
                                                  [CERTAINTY_KEY,      @certainty],
         
     | 
| 
      
 442 
     | 
    
         
            +
                                                  [AUDIENCE_KEY,       @audience],
         
     | 
| 
      
 443 
     | 
    
         
            +
                                                  [EFFECTIVE_KEY,      RCAP.to_s_for_cap(@effective)],
         
     | 
| 
      
 444 
     | 
    
         
            +
                                                  [ONSET_KEY,          RCAP.to_s_for_cap(@onset)],
         
     | 
| 
      
 445 
     | 
    
         
            +
                                                  [EXPIRES_KEY,        RCAP.to_s_for_cap(@expires)],
         
     | 
| 
      
 446 
     | 
    
         
            +
                                                  [SENDER_NAME_KEY,    @sender_name],
         
     | 
| 
      
 447 
     | 
    
         
            +
                                                  [HEADLINE_KEY,       @headline],
         
     | 
| 
      
 448 
     | 
    
         
            +
                                                  [DESCRIPTION_KEY,    @description],
         
     | 
| 
      
 449 
     | 
    
         
            +
                                                  [INSTRUCTION_KEY,    @instruction],
         
     | 
| 
      
 450 
     | 
    
         
            +
                                                  [WEB_KEY,            @web],
         
     | 
| 
      
 451 
     | 
    
         
            +
                                                  [CONTACT_KEY,        @contact],
         
     | 
| 
      
 452 
     | 
    
         
            +
                                                  [RESOURCES_KEY,      @resources.map(&:to_h)],
         
     | 
| 
      
 453 
     | 
    
         
            +
                                                  [EVENT_CODES_KEY,    @event_codes.map(&:to_h)],
         
     | 
| 
      
 454 
     | 
    
         
            +
                                                  [PARAMETERS_KEY,     @parameters.map(&:to_h)],
         
     | 
| 
      
 455 
     | 
    
         
            +
                                                  [AREAS_KEY,          @areas.map(&:to_h)])
         
     | 
| 
       459 
456 
     | 
    
         
             
                  end
         
     | 
| 
       460 
457 
     | 
    
         | 
| 
       461 
458 
     | 
    
         
             
                  # @param [Hash] info_hash
         
     | 
| 
       462 
459 
     | 
    
         
             
                  # @return [Info]
         
     | 
| 
       463 
     | 
    
         
            -
                  def self.from_h( 
     | 
| 
       464 
     | 
    
         
            -
                     
     | 
| 
       465 
     | 
    
         
            -
                      info.language 
     | 
| 
       466 
     | 
    
         
            -
                      Array( 
     | 
| 
       467 
     | 
    
         
            -
                        info.categories << RCAP.strip_if_given( 
     | 
| 
      
 460 
     | 
    
         
            +
                  def self.from_h(info_hash)
         
     | 
| 
      
 461 
     | 
    
         
            +
                    new do |info|
         
     | 
| 
      
 462 
     | 
    
         
            +
                      info.language = info_hash[LANGUAGE_KEY]
         
     | 
| 
      
 463 
     | 
    
         
            +
                      Array(info_hash[CATEGORIES_KEY]).each do |category|
         
     | 
| 
      
 464 
     | 
    
         
            +
                        info.categories << RCAP.strip_if_given(category)
         
     | 
| 
       468 
465 
     | 
    
         
             
                      end
         
     | 
| 
       469 
     | 
    
         
            -
                      info.event          = RCAP.strip_if_given( 
     | 
| 
       470 
     | 
    
         
            -
                      info.urgency        = RCAP.strip_if_given( 
     | 
| 
       471 
     | 
    
         
            -
                      info.severity       = RCAP.strip_if_given( 
     | 
| 
       472 
     | 
    
         
            -
                      info.certainty      = RCAP.strip_if_given( 
     | 
| 
       473 
     | 
    
         
            -
                      info.audience       = RCAP.strip_if_given( 
     | 
| 
       474 
     | 
    
         
            -
                      info.effective      = RCAP.parse_datetime( 
     | 
| 
       475 
     | 
    
         
            -
                      info.onset          = RCAP.parse_datetime( 
     | 
| 
       476 
     | 
    
         
            -
                      info.expires        = RCAP.parse_datetime( 
     | 
| 
       477 
     | 
    
         
            -
                      info.sender_name    = RCAP.strip_if_given( 
     | 
| 
       478 
     | 
    
         
            -
                      info.headline       = RCAP.strip_if_given( 
     | 
| 
       479 
     | 
    
         
            -
                      info.description    = RCAP.strip_if_given( 
     | 
| 
       480 
     | 
    
         
            -
                      info.instruction    = RCAP.strip_if_given( 
     | 
| 
       481 
     | 
    
         
            -
                      info.web            = RCAP.strip_if_given( 
     | 
| 
       482 
     | 
    
         
            -
                      info.contact        = RCAP.strip_if_given( 
     | 
| 
       483 
     | 
    
         
            -
             
     | 
| 
       484 
     | 
    
         
            -
                      Array( 
     | 
| 
       485 
     | 
    
         
            -
                        info.resources << info.resource_class.from_h( 
     | 
| 
      
 466 
     | 
    
         
            +
                      info.event          = RCAP.strip_if_given(info_hash[EVENT_KEY])
         
     | 
| 
      
 467 
     | 
    
         
            +
                      info.urgency        = RCAP.strip_if_given(info_hash[URGENCY_KEY])
         
     | 
| 
      
 468 
     | 
    
         
            +
                      info.severity       = RCAP.strip_if_given(info_hash[SEVERITY_KEY])
         
     | 
| 
      
 469 
     | 
    
         
            +
                      info.certainty      = RCAP.strip_if_given(info_hash[CERTAINTY_KEY])
         
     | 
| 
      
 470 
     | 
    
         
            +
                      info.audience       = RCAP.strip_if_given(info_hash[AUDIENCE_KEY])
         
     | 
| 
      
 471 
     | 
    
         
            +
                      info.effective      = RCAP.parse_datetime(info_hash[EFFECTIVE_KEY])
         
     | 
| 
      
 472 
     | 
    
         
            +
                      info.onset          = RCAP.parse_datetime(info_hash[ONSET_KEY])
         
     | 
| 
      
 473 
     | 
    
         
            +
                      info.expires        = RCAP.parse_datetime(info_hash[EXPIRES_KEY])
         
     | 
| 
      
 474 
     | 
    
         
            +
                      info.sender_name    = RCAP.strip_if_given(info_hash[SENDER_NAME_KEY])
         
     | 
| 
      
 475 
     | 
    
         
            +
                      info.headline       = RCAP.strip_if_given(info_hash[HEADLINE_KEY])
         
     | 
| 
      
 476 
     | 
    
         
            +
                      info.description    = RCAP.strip_if_given(info_hash[DESCRIPTION_KEY])
         
     | 
| 
      
 477 
     | 
    
         
            +
                      info.instruction    = RCAP.strip_if_given(info_hash[INSTRUCTION_KEY])
         
     | 
| 
      
 478 
     | 
    
         
            +
                      info.web            = RCAP.strip_if_given(info_hash[WEB_KEY])
         
     | 
| 
      
 479 
     | 
    
         
            +
                      info.contact        = RCAP.strip_if_given(info_hash[CONTACT_KEY])
         
     | 
| 
      
 480 
     | 
    
         
            +
             
     | 
| 
      
 481 
     | 
    
         
            +
                      Array(info_hash[RESOURCES_KEY]).each do |resource_hash|
         
     | 
| 
      
 482 
     | 
    
         
            +
                        info.resources << info.resource_class.from_h(resource_hash)
         
     | 
| 
       486 
483 
     | 
    
         
             
                      end
         
     | 
| 
       487 
484 
     | 
    
         | 
| 
       488 
     | 
    
         
            -
                      Array( 
     | 
| 
       489 
     | 
    
         
            -
                        info.event_codes << info.event_code_class.from_h( 
     | 
| 
      
 485 
     | 
    
         
            +
                      Array(info_hash[EVENT_CODES_KEY]).each do |event_code_hash|
         
     | 
| 
      
 486 
     | 
    
         
            +
                        info.event_codes << info.event_code_class.from_h(event_code_hash)
         
     | 
| 
       490 
487 
     | 
    
         
             
                      end
         
     | 
| 
       491 
488 
     | 
    
         | 
| 
       492 
     | 
    
         
            -
                      Array( 
     | 
| 
       493 
     | 
    
         
            -
                        info.parameters << info.parameter_class.from_h( 
     | 
| 
      
 489 
     | 
    
         
            +
                      Array(info_hash[PARAMETERS_KEY]).each do |parameter_hash|
         
     | 
| 
      
 490 
     | 
    
         
            +
                        info.parameters << info.parameter_class.from_h(parameter_hash)
         
     | 
| 
       494 
491 
     | 
    
         
             
                      end
         
     | 
| 
       495 
492 
     | 
    
         | 
| 
       496 
     | 
    
         
            -
                      Array( 
     | 
| 
       497 
     | 
    
         
            -
             
     | 
| 
      
 493 
     | 
    
         
            +
                      Array(info_hash[AREAS_KEY]).each do |area_hash|
         
     | 
| 
      
 494 
     | 
    
         
            +
                        info.areas << info.area_class.from_h(area_hash)
         
     | 
| 
       498 
495 
     | 
    
         
             
                      end
         
     | 
| 
       499 
496 
     | 
    
         
             
                    end
         
     | 
| 
       500 
497 
     | 
    
         
             
                  end
         
     | 
| 
      
 498 
     | 
    
         
            +
             
     | 
| 
      
 499 
     | 
    
         
            +
                  def map_data?
         
     | 
| 
      
 500 
     | 
    
         
            +
                    @areas.any?(&:map_data?)
         
     | 
| 
      
 501 
     | 
    
         
            +
                  end
         
     | 
| 
       501 
502 
     | 
    
         
             
                end
         
     | 
| 
       502 
503 
     | 
    
         
             
              end
         
     | 
| 
       503 
504 
     | 
    
         
             
            end
         
     |