rcap 1.2.0 → 1.2.1
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.
- data/.gitignore +1 -0
- data/CHANGELOG.rdoc +8 -0
- data/Rakefile +4 -2
- data/lib/extensions/array.rb +5 -0
- data/lib/extensions/date_time.rb +16 -0
- data/lib/extensions/string.rb +16 -0
- data/lib/extensions/time.rb +14 -0
- data/lib/rcap.rb +6 -1
- data/lib/rcap/alert.rb +9 -3
- data/lib/rcap/cap_1_0/area.rb +1 -4
- data/lib/rcap/cap_1_0/info.rb +2 -4
- data/lib/rcap/cap_1_0/polygon.rb +1 -4
- data/lib/rcap/cap_1_1/area.rb +1 -4
- data/lib/rcap/cap_1_1/info.rb +3 -8
- data/lib/rcap/cap_1_1/polygon.rb +1 -4
- data/lib/rcap/cap_1_2/area.rb +1 -4
- data/lib/rcap/cap_1_2/info.rb +3 -8
- data/lib/rcap/cap_1_2/polygon.rb +1 -4
- data/lib/rcap/utilities.rb +0 -42
- data/lib/rcap/version.rb +1 -1
- data/rcap.gemspec +2 -2
- data/spec/alert_spec.rb +73 -6
- data/spec/assets/amber.atom +52 -0
- data/spec/assets/canada.cap +164 -0
- data/spec/assets/earthquake.cap +96 -0
- data/spec/assets/earthquake_index.atom +11 -0
- data/spec/assets/invalid.cap +19 -0
- data/spec/assets/invalid.rss +8 -0
- data/spec/assets/invalid_element.atom +14 -0
- data/spec/assets/no_id.atom +18 -0
- data/spec/assets/no_link.atom +18 -0
- data/spec/assets/no_title.atom +18 -0
- data/spec/assets/ny_index.rss +28 -0
- data/spec/assets/weather.atom +100 -0
- data/spec/assets/weather_index.atom +83 -0
- data/spec/cap_1_0/info_spec.rb +19 -19
- data/spec/cap_1_1/info_spec.rb +20 -20
- data/spec/cap_1_2/info_spec.rb +20 -20
- metadata +71 -4
@@ -0,0 +1,100 @@
|
|
1
|
+
<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?>
|
2
|
+
<feed
|
3
|
+
xmlns = 'http://www.w3.org/2005/Atom'
|
4
|
+
xmlns:cap = 'urn:oasis:names:tc:emergency:cap:1.1'
|
5
|
+
xmlns:ha = 'http://www.alerting.net/namespace/index_1.0'
|
6
|
+
>
|
7
|
+
<!-- http-date = Mon, 30 Aug 2010 02:37:00 GMT -->
|
8
|
+
<id>http://www.weather.gov/alerts-beta/</id>
|
9
|
+
<logo>http://weather.gov/images/xml_logo.gif</logo>
|
10
|
+
<generator>NWS CAP Server</generator>
|
11
|
+
<updated>2010-08-30T14:37:00-00:00</updated>
|
12
|
+
<author>
|
13
|
+
<name>w-nws.webmaster@noaa.gov</name>
|
14
|
+
</author>
|
15
|
+
<title>Current Watches, Warnings and Advisories for the United States Issued by the National Weather Service</title>
|
16
|
+
<link href='http://www.weather.gov/alerts-beta/'/>
|
17
|
+
<entry>
|
18
|
+
<id>http://www.weather.gov/alerts-beta/wwacapget.php?x=DC20100829202900LWXAirQualityAlertLWX20100831040000DC</id>
|
19
|
+
<updated>2010-08-29T16:29:00-04:00</updated>
|
20
|
+
<published>2010-08-29T16:29:00-04:00</published>
|
21
|
+
<author>
|
22
|
+
<name>w-nws.webmaster@noaa.gov</name>
|
23
|
+
</author>
|
24
|
+
<title>Air Quality Alert issued August 29 at 4:29PM EDT expiring August 31 at 12:00AM EDT by NWS Baltimore/Washington http://www.erh.noaa.gov/lwx/</title>
|
25
|
+
<link href='http://www.weather.gov/alerts-beta/wwacapget.php?x=DC20100829202900LWXAirQualityAlertLWX20100831040000DC'/>
|
26
|
+
<summary>...AIR QUALITY ALERT IS IN EFFECT FOR MONDAY AUGUST 30 2010... THE METROPOLITAN WASHINGTON COUNCIL OF GOVERNMENTS HAS ISSUED A CODE ORANGE AIR QUALITY ALERT MONDAY FOR THE DC METRO AREA. A CODE ORANGE AIR QUALITY ALERT MEANS THAT AIR POLLUTION CONCENTRATIONS WITHIN THE REGION MAY BECOME UNHEALTHY FOR SENSITIVE GROUPS. SENSITIVE GROUPS INCLUDE CHILDREN...PEOPLE SUFFERING FROM</summary>
|
27
|
+
<content type="text/xml">
|
28
|
+
<alert xmlns = 'urn:oasis:names:tc:emergency:cap:1.1'>
|
29
|
+
<!-- http-date = Mon, 30 Aug 2010 10:07:00 GMT -->
|
30
|
+
<identifier>NOAA-NWS-ALERTS-MT20100830100700TFXFlashFloodWatchTFX20100830180000MT</identifier>
|
31
|
+
<sender>w-nws.webmaster@noaa.gov</sender>
|
32
|
+
<sent>2010-08-30T04:07:00-06:00</sent>
|
33
|
+
<status>Actual</status>
|
34
|
+
<msgType>Alert</msgType>
|
35
|
+
<scope>Public</scope>
|
36
|
+
<note>Alert for Central and Southern Lewis and Clark; Lewis and Clark (Montana) Issued by the National Weather Service</note>
|
37
|
+
<info>
|
38
|
+
<category>Met</category>
|
39
|
+
<event>Flash Flood Watch</event>
|
40
|
+
<urgency>Expected</urgency>
|
41
|
+
<severity>Severe</severity>
|
42
|
+
<certainty>Possible</certainty>
|
43
|
+
<eventCode>
|
44
|
+
<valueName>SAME</valueName>
|
45
|
+
<value>FFA</value>
|
46
|
+
</eventCode>
|
47
|
+
<effective>2010-08-30T04:07:00-06:00</effective>
|
48
|
+
<expires>2010-08-30T12:00:00-06:00</expires>
|
49
|
+
<senderName>NWS GreatFalls (Central Montana)</senderName>
|
50
|
+
<headline>Flash Flood Watch issued August 30 at 4:07AM MDT expiring August 30 at 12:00PM MDT by NWS GreatFalls</headline>
|
51
|
+
<description>...FLASH FLOOD WATCH REMAINS IN EFFECT UNTIL NOON MDT TODAY...
|
52
|
+
THE FLASH FLOOD WATCH CONTINUES FOR
|
53
|
+
* A PORTION OF SOUTHWEST MONTANA...INCLUDING THE FOLLOWING
|
54
|
+
AREA...CENTRAL AND SOUTHERN LEWIS AND CLARK.
|
55
|
+
* UNTIL NOON MDT TODAY
|
56
|
+
* ISOLATED SHOWERS ARE EXPECTED THROUGH EARLY THIS AFTERNOON.
|
57
|
+
ADDITIONAL RAINFALL TOTALS OF LESS THAN ONE QUARTER OF AN INCH
|
58
|
+
ARE EXPECTED THROUGH MIDDAY MONDAY.
|
59
|
+
* RAINFALL COULD LEAD TO LOCALIZED FLASH FLOODING AND POSSIBLE
|
60
|
+
DEBRIS FLOWS IN WILDLAND FIRE BURN AREAS INCLUDING THE DAVIS...
|
61
|
+
LAKESIDE...AND MERIWETHER FIRE AREAS.
|
62
|
+
A FLASH FLOOD WATCH MEANS THAT CONDITIONS MAY DEVELOP THAT LEAD
|
63
|
+
TO FLASH FLOODING.</description>
|
64
|
+
<instruction>A FLASH FLOOD WATCH MEANS THAT CONDITIONS MAY DEVELOP THAT LEAD
|
65
|
+
TO FLASH FLOODING. FLASH FLOODING IS A VERY DANGEROUS SITUATION.
|
66
|
+
YOU SHOULD MONITOR LATER FORECASTS AND BE PREPARED TO TAKE ACTION
|
67
|
+
SHOULD FLASH FLOOD WARNINGS BE ISSUED.</instruction>
|
68
|
+
<parameter>
|
69
|
+
<valueName>WMOHEADER</valueName>
|
70
|
+
<value></value>
|
71
|
+
</parameter>
|
72
|
+
<parameter>
|
73
|
+
<valueName>UGC</valueName>
|
74
|
+
<value>MTZ014</value>
|
75
|
+
</parameter>
|
76
|
+
<parameter>
|
77
|
+
<valueName>VTEC</valueName>
|
78
|
+
<value>/O.CON.KTFX.FF.A.0003.000000T0000Z-100830T1800Z/
|
79
|
+
/00000.0.ER.000000T0000Z.000000T0000Z.000000T0000Z.OO/</value>
|
80
|
+
</parameter>
|
81
|
+
<parameter>
|
82
|
+
<valueName>TIME...MOT...LOC</valueName>
|
83
|
+
<value></value>
|
84
|
+
</parameter>
|
85
|
+
<area>
|
86
|
+
<areaDesc>Central and Southern Lewis and Clark; Lewis and Clark</areaDesc>
|
87
|
+
<geocode>
|
88
|
+
<valueName>FIPS6</valueName>
|
89
|
+
<value>030049</value>
|
90
|
+
</geocode>
|
91
|
+
<geocode>
|
92
|
+
<valueName>UGC</valueName>
|
93
|
+
<value>MTZ014</value>
|
94
|
+
</geocode>
|
95
|
+
</area>
|
96
|
+
</info>
|
97
|
+
</alert>
|
98
|
+
</content>
|
99
|
+
</entry>
|
100
|
+
</feed>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?>
|
2
|
+
<!--
|
3
|
+
This atom/xml feed is an index to active advisories, watches and warnings issued
|
4
|
+
by the National Weather Service. This index file is not the complete Common
|
5
|
+
Alerting Protocol (CAP) alert message. To obtain the complete CAP alert,
|
6
|
+
please follow the links for each alert in this index. Also note the CAP
|
7
|
+
message uses a style sheet to convey the information in a human readable
|
8
|
+
format. Please view the source of the CAP message to see the complete data
|
9
|
+
set. Not all information in the CAP message is contained in this index of
|
10
|
+
active alerts.
|
11
|
+
-->
|
12
|
+
<feed
|
13
|
+
xmlns = 'http://www.w3.org/2005/Atom'
|
14
|
+
xmlns:cap = 'urn:oasis:names:tc:emergency:cap:1.1'
|
15
|
+
xmlns:ha = 'http://www.alerting.net/namespace/index_1.0'
|
16
|
+
>
|
17
|
+
<!-- http-date = Tue, 31 Aug 2010 02:24:00 GMT -->
|
18
|
+
<id>http://www.weather.gov/alerts-beta/</id>
|
19
|
+
<logo>http://weather.gov/images/xml_logo.gif</logo>
|
20
|
+
<generator>NWS CAP Server</generator>
|
21
|
+
<updated>2010-08-31T14:24:00-00:00</updated>
|
22
|
+
<author>
|
23
|
+
<name>w-nws.webmaster@noaa.gov</name>
|
24
|
+
</author>
|
25
|
+
<title>Current Watches, Warnings and Advisories for the United States Issued by the National Weather Service</title>
|
26
|
+
<link href='http://www.weather.gov/alerts-beta/'/>
|
27
|
+
<entry>
|
28
|
+
<id>http://www.weather.gov/alerts-beta/wwacapget.php?x=CT20100831030400OKXAirQualityAlertOKX20100901031500CT</id>
|
29
|
+
<updated>2010-08-30T23:04:00-04:00</updated>
|
30
|
+
<published>2010-08-30T23:04:00-04:00</published>
|
31
|
+
<author>
|
32
|
+
<name>w-nws.webmaster@noaa.gov</name>
|
33
|
+
</author>
|
34
|
+
<title>Air Quality Alert issued August 30 at 11:04PM EDT expiring August 31 at 11:15PM EDT by NWS NewYorkCity/Upton http://www.nws.noaa.gov/er/okx/</title>
|
35
|
+
<link href='http://www.weather.gov/alerts-beta/wwacapget.php?x=CT20100831030400OKXAirQualityAlertOKX20100901031500CT'/>
|
36
|
+
<summary>...AIR QUALITY ALERT IS IN EFFECT FROM 2 PM TUESDAY UNTIL 10 PM TUESDAY... THE CONNECTICUT DEPARTMENT OF ENVIRONMENTAL PROTECTION HAS ISSUED AN AIR QUALITY ACTION DAY FOR THE FOLLOWING COUNTIES... HOT TEMPERATURES AND ABUNDANT SUNSHINE WILL AID IN THE PRODUCTION OF GROUND-LEVEL OZONE TO THE SOUTH OF CONNECTICUT. WINDS ARE</summary>
|
37
|
+
<cap:effective>2010-08-30T23:04:00-04:00</cap:effective>
|
38
|
+
<cap:expires>2010-08-31T23:15:00-04:00</cap:expires>
|
39
|
+
<cap:status>Actual</cap:status>
|
40
|
+
<cap:msgType>Alert</cap:msgType>
|
41
|
+
<cap:category>Met</cap:category>
|
42
|
+
<cap:urgency>Unknown</cap:urgency>
|
43
|
+
<cap:severity>Unknown</cap:severity>
|
44
|
+
<cap:certainty>Unknown</cap:certainty>
|
45
|
+
<cap:areaDesc>Middlesex; New Haven; New London; Southern Middlesex; Southern New London; Washington</cap:areaDesc>
|
46
|
+
<cap:geocode>
|
47
|
+
<valueName>FIPS6</valueName>
|
48
|
+
<value>009007 009009 009011 044009</value>
|
49
|
+
</cap:geocode>
|
50
|
+
<cap:parameter>
|
51
|
+
<valueName>VTEC</valueName>
|
52
|
+
<value></value>
|
53
|
+
</cap:parameter>
|
54
|
+
</entry>
|
55
|
+
<entry>
|
56
|
+
<id>http://www.weather.gov/alerts-beta/wwacapget.php?x=DC20100830203300LWXAirQualityAlertLWX20100901040000DC</id>
|
57
|
+
<updated>2010-08-30T16:33:00-04:00</updated>
|
58
|
+
<published>2010-08-30T16:33:00-04:00</published>
|
59
|
+
<author>
|
60
|
+
<name>w-nws.webmaster@noaa.gov</name>
|
61
|
+
</author>
|
62
|
+
<title>Air Quality Alert issued August 30 at 4:33PM EDT expiring September 01 at 12:00AM EDT by NWS Baltimore/Washington http://www.erh.noaa.gov/lwx/</title>
|
63
|
+
<link href='http://www.weather.gov/alerts-beta/wwacapget.php?x=DC20100830203300LWXAirQualityAlertLWX20100901040000DC'/>
|
64
|
+
<summary>...AIR QUALITY ALERT IS IN EFFECT FOR TUESDAY AUGUST 31 2010... THE METROPOLITAN WASHINGTON COUNCIL OF GOVERNMENTS HAS ISSUED A CODE RED AIR QUALITY ALERT TUESDAY FOR THE DC METRO AREA. A CODE RED AIR QUALITY ALERT MEANS THAT AIR POLLUTION CONCENTRATIONS WITHIN THE REGION ARE UNHEALTHFUL FOR THE GENERAL POPULATION. THE EFFECTS OF AIR POLLUTION CAN BE MINIMIZED BY AVOIDING STRENUOUS</summary>
|
65
|
+
<cap:effective>2010-08-30T16:33:00-04:00</cap:effective>
|
66
|
+
<cap:expires>2010-09-01T00:00:00-04:00</cap:expires>
|
67
|
+
<cap:status>Actual</cap:status>
|
68
|
+
<cap:msgType>Alert</cap:msgType>
|
69
|
+
<cap:category>Met</cap:category>
|
70
|
+
<cap:urgency>Unknown</cap:urgency>
|
71
|
+
<cap:severity>Unknown</cap:severity>
|
72
|
+
<cap:certainty>Unknown</cap:certainty>
|
73
|
+
<cap:areaDesc>Arlington; District of Columbia; Fairfax; Montgomery; Prince Georges</cap:areaDesc>
|
74
|
+
<cap:geocode>
|
75
|
+
<valueName>FIPS6</valueName>
|
76
|
+
<value>011001 024031 024033 051013 051059</value>
|
77
|
+
</cap:geocode>
|
78
|
+
<cap:parameter>
|
79
|
+
<valueName>VTEC</valueName>
|
80
|
+
<value></value>
|
81
|
+
</cap:parameter>
|
82
|
+
</entry>
|
83
|
+
</feed>
|
data/spec/cap_1_0/info_spec.rb
CHANGED
@@ -26,25 +26,25 @@ describe( RCAP::CAP_1_0::Info ) do
|
|
26
26
|
it( 'should have no parameters' ) { @info.parameters.should( be_empty )}
|
27
27
|
|
28
28
|
shared_examples_for( 'it can parse into a CAP 1.0 Info object' ) do
|
29
|
-
it( 'should parse categories correctly' ){ @info .categories.should == @original_info.categories }
|
30
|
-
it( 'should parse event correctly' ){ @info .event.should == @original_info.event }
|
31
|
-
it( 'should parse urgency correctly' ){ @info .urgency.should == @original_info.urgency }
|
32
|
-
it( 'should parse severity correctly' ){ @info .severity.should == @original_info.severity }
|
33
|
-
it( 'should parse certainty correctly' ){ @info .certainty.should == @original_info.certainty }
|
34
|
-
it( 'should parse audience correctly' ){ @info .audience.should == @original_info.audience }
|
35
|
-
it( 'should parse effective correctly' ){ @info .effective.should( be_within(Rational( 1, 86400 )).of( @original_info.effective ))}
|
36
|
-
it( 'should parse onset correctly' ){ @info .onset.should( be_within( Rational( 1, 86400 )).of( @original_info.onset ))}
|
37
|
-
it( 'should parse expires correctly' ){ @info .expires.should( be_within( Rational( 1, 86400 )).of( @original_info.expires ))}
|
38
|
-
it( 'should parse sender_name correctly' ){ @info .sender_name.should == @original_info.sender_name }
|
39
|
-
it( 'should parse headline correctly' ){ @info .headline.should == @original_info.headline }
|
40
|
-
it( 'should parse description correctly' ){ @info .description.should == @original_info.description }
|
41
|
-
it( 'should parse instruction correctly' ){ @info .instruction.should == @original_info.instruction }
|
42
|
-
it( 'should parse web correctly' ){ @info .web.should == @original_info.web }
|
43
|
-
it( 'should parse contact correctly' ){ @info .contact.should == @original_info.contact }
|
44
|
-
it( 'should parse event_codes correctly' ){ @info .event_codes.should == @original_info.event_codes }
|
45
|
-
it( 'should parse parameters correctly' ){ @info .parameters.should == @original_info.parameters }
|
46
|
-
it( 'should parse resources correctly' ){ @info .resources.should == @original_info.resources }
|
47
|
-
it( 'should parse areas correctly' ){ @info .areas.should == @original_info.areas }
|
29
|
+
it( 'should parse categories correctly' ){ @info.categories.should_not( be_nil ) ; @info.categories.should == @original_info.categories }
|
30
|
+
it( 'should parse event correctly' ){ @info.event.should_not( be_nil ) ; @info.event.should == @original_info.event }
|
31
|
+
it( 'should parse urgency correctly' ){ @info.urgency.should_not( be_nil ) ; @info.urgency.should == @original_info.urgency }
|
32
|
+
it( 'should parse severity correctly' ){ @info.severity.should_not( be_nil ) ; @info.severity.should == @original_info.severity }
|
33
|
+
it( 'should parse certainty correctly' ){ @info.certainty.should_not( be_nil ) ; @info.certainty.should == @original_info.certainty }
|
34
|
+
it( 'should parse audience correctly' ){ @info.audience.should_not( be_nil ) ; @info.audience.should == @original_info.audience }
|
35
|
+
it( 'should parse effective correctly' ){ @info.effective.should_not( be_nil ) ; @info.effective.should( be_within(Rational( 1, 86400 )).of( @original_info.effective ))}
|
36
|
+
it( 'should parse onset correctly' ){ @info.onset.should_not( be_nil ) ; @info.onset.should( be_within( Rational( 1, 86400 )).of( @original_info.onset ))}
|
37
|
+
it( 'should parse expires correctly' ){ @info.expires.should_not( be_nil ) ; @info.expires.should( be_within( Rational( 1, 86400 )).of( @original_info.expires ))}
|
38
|
+
it( 'should parse sender_name correctly' ){ @info.sender_name.should_not( be_nil ); @info.sender_name.should == @original_info.sender_name }
|
39
|
+
it( 'should parse headline correctly' ){ @info.headline.should_not( be_nil ) ; @info.headline.should == @original_info.headline }
|
40
|
+
it( 'should parse description correctly' ){ @info.description.should_not( be_nil ); @info.description.should == @original_info.description }
|
41
|
+
it( 'should parse instruction correctly' ){ @info.instruction.should_not( be_nil ); @info.instruction.should == @original_info.instruction }
|
42
|
+
it( 'should parse web correctly' ){ @info.web.should_not( be_nil ) ; @info.web.should == @original_info.web }
|
43
|
+
it( 'should parse contact correctly' ){ @info.contact.should_not( be_nil ) ; @info.contact.should == @original_info.contact }
|
44
|
+
it( 'should parse event_codes correctly' ){ @info.event_codes.should_not( be_nil ); @info.event_codes.should == @original_info.event_codes }
|
45
|
+
it( 'should parse parameters correctly' ){ @info.parameters.should_not( be_nil ) ; @info.parameters.should == @original_info.parameters }
|
46
|
+
it( 'should parse resources correctly' ){ @info.resources.should_not( be_nil ) ; @info.resources.should == @original_info.resources }
|
47
|
+
it( 'should parse areas correctly' ){ @info.areas.should_not( be_nil ) ; @info.areas.should == @original_info.areas }
|
48
48
|
end
|
49
49
|
|
50
50
|
context( 'from XML' ) do
|
data/spec/cap_1_1/info_spec.rb
CHANGED
@@ -27,26 +27,26 @@ describe( RCAP::CAP_1_1::Info ) do
|
|
27
27
|
it( 'should have no parameters' ) { @info.parameters.should( be_empty )}
|
28
28
|
|
29
29
|
shared_examples_for( 'it can parse into a CAP 1.1 Info object' ) do
|
30
|
-
it( 'should parse categories correctly' ){ @info .categories.should == @original_info.categories }
|
31
|
-
it( 'should parse event correctly' ){ @info .event.should == @original_info.event }
|
32
|
-
it( 'should parse response_types correctly' ){ @info .response_types.should == @original_info.response_types }
|
33
|
-
it( 'should parse urgency correctly' ){ @info .urgency.should == @original_info.urgency }
|
34
|
-
it( 'should parse severity correctly' ){ @info .severity.should == @original_info.severity }
|
35
|
-
it( 'should parse certainty correctly' ){ @info .certainty.should == @original_info.certainty }
|
36
|
-
it( 'should parse audience correctly' ){ @info .audience.should == @original_info.audience }
|
37
|
-
it( 'should parse effective correctly' ){ @info .effective.should( be_within(Rational( 1, 86400 )).of( @original_info.effective ))}
|
38
|
-
it( 'should parse onset correctly' ){ @info .onset.should( be_within( Rational( 1, 86400 )).of( @original_info.onset ))}
|
39
|
-
it( 'should parse expires correctly' ){ @info .expires.should( be_within( Rational( 1, 86400 )).of( @original_info.expires ))}
|
40
|
-
it( 'should parse sender_name correctly' ){ @info .sender_name.should == @original_info.sender_name }
|
41
|
-
it( 'should parse headline correctly' ){ @info .headline.should == @original_info.headline }
|
42
|
-
it( 'should parse description correctly' ){ @info .description.should == @original_info.description }
|
43
|
-
it( 'should parse instruction correctly' ){ @info .instruction.should == @original_info.instruction }
|
44
|
-
it( 'should parse web correctly' ){ @info .web.should == @original_info.web }
|
45
|
-
it( 'should parse contact correctly' ){ @info .contact.should == @original_info.contact }
|
46
|
-
it( 'should parse event_codes correctly' ){ @info .event_codes.should == @original_info.event_codes }
|
47
|
-
it( 'should parse parameters correctly' ){ @info .parameters.should == @original_info.parameters }
|
48
|
-
it( 'should parse resources correctly' ){ @info .resources.should == @original_info.resources }
|
49
|
-
it( 'should parse areas correctly' ){ @info .areas.should == @original_info.areas }
|
30
|
+
it( 'should parse categories correctly' ){ @info.categories.should_not( be_nil ) ; @info.categories.should == @original_info.categories }
|
31
|
+
it( 'should parse event correctly' ){ @info.event.should_not( be_nil ) ; @info.event.should == @original_info.event }
|
32
|
+
it( 'should parse response_types correctly' ){ @info.response_types.should_not( be_nil ); @info.response_types.should == @original_info.response_types }
|
33
|
+
it( 'should parse urgency correctly' ){ @info.urgency.should_not( be_nil ) ; @info.urgency.should == @original_info.urgency }
|
34
|
+
it( 'should parse severity correctly' ){ @info.severity.should_not( be_nil ) ; @info.severity.should == @original_info.severity }
|
35
|
+
it( 'should parse certainty correctly' ){ @info.certainty.should_not( be_nil ) ; @info.certainty.should == @original_info.certainty }
|
36
|
+
it( 'should parse audience correctly' ){ @info.audience.should_not( be_nil ) ; @info.audience.should == @original_info.audience }
|
37
|
+
it( 'should parse effective correctly' ){ @info.effective.should_not( be_nil ) ; @info.effective.should( be_within(Rational( 1, 86400 )).of( @original_info.effective ))}
|
38
|
+
it( 'should parse onset correctly' ){ @info.onset.should_not( be_nil ) ; @info.onset.should( be_within( Rational( 1, 86400 )).of( @original_info.onset ))}
|
39
|
+
it( 'should parse expires correctly' ){ @info.expires.should_not( be_nil ) ; @info.expires.should( be_within( Rational( 1, 86400 )).of( @original_info.expires ))}
|
40
|
+
it( 'should parse sender_name correctly' ){ @info.sender_name.should_not( be_nil ) ; @info.sender_name.should == @original_info.sender_name }
|
41
|
+
it( 'should parse headline correctly' ){ @info.headline.should_not( be_nil ) ; @info.headline.should == @original_info.headline }
|
42
|
+
it( 'should parse description correctly' ){ @info.description.should_not( be_nil ) ; @info.description.should == @original_info.description }
|
43
|
+
it( 'should parse instruction correctly' ){ @info.instruction.should_not( be_nil ) ; @info.instruction.should == @original_info.instruction }
|
44
|
+
it( 'should parse web correctly' ){ @info.web.should_not( be_nil ) ; @info.web.should == @original_info.web }
|
45
|
+
it( 'should parse contact correctly' ){ @info.contact.should_not( be_nil ) ; @info.contact.should == @original_info.contact }
|
46
|
+
it( 'should parse event_codes correctly' ){ @info.event_codes.should_not( be_nil ) ; @info.event_codes.should == @original_info.event_codes }
|
47
|
+
it( 'should parse parameters correctly' ){ @info.parameters.should_not( be_nil ) ; @info.parameters.should == @original_info.parameters }
|
48
|
+
it( 'should parse resources correctly' ){ @info.resources.should_not( be_nil ) ; @info.resources.should == @original_info.resources }
|
49
|
+
it( 'should parse areas correctly' ){ @info.areas.should_not( be_nil ) ; @info.areas.should == @original_info.areas }
|
50
50
|
end
|
51
51
|
|
52
52
|
context( 'from XML' ) do
|
data/spec/cap_1_2/info_spec.rb
CHANGED
@@ -27,26 +27,26 @@ describe( RCAP::CAP_1_2::Info ) do
|
|
27
27
|
it( 'should have no parameters' ) { @info.parameters.should( be_empty )}
|
28
28
|
|
29
29
|
shared_examples_for( 'it can parse into a CAP 1.2 Info object' ) do
|
30
|
-
it( 'should parse categories correctly' ){ @info .categories.should == @original_info.categories }
|
31
|
-
it( 'should parse event correctly' ){ @info .event.should == @original_info.event }
|
32
|
-
it( 'should parse response_types correctly' ){ @info .response_types.should == @original_info.response_types }
|
33
|
-
it( 'should parse urgency correctly' ){ @info .urgency.should == @original_info.urgency }
|
34
|
-
it( 'should parse severity correctly' ){ @info .severity.should == @original_info.severity }
|
35
|
-
it( 'should parse certainty correctly' ){ @info .certainty.should == @original_info.certainty }
|
36
|
-
it( 'should parse audience correctly' ){ @info .audience.should == @original_info.audience }
|
37
|
-
it( 'should parse effective correctly' ){ @info .effective.should( be_within(Rational( 1, 86400 )).of( @original_info.effective ))}
|
38
|
-
it( 'should parse onset correctly' ){ @info .onset.should( be_within( Rational( 1, 86400 )).of( @original_info.onset ))}
|
39
|
-
it( 'should parse expires correctly' ){ @info .expires.should( be_within( Rational( 1, 86400 )).of( @original_info.expires ))}
|
40
|
-
it( 'should parse sender_name correctly' ){ @info .sender_name.should == @original_info.sender_name }
|
41
|
-
it( 'should parse headline correctly' ){ @info .headline.should == @original_info.headline }
|
42
|
-
it( 'should parse description correctly' ){ @info .description.should == @original_info.description }
|
43
|
-
it( 'should parse instruction correctly' ){ @info .instruction.should == @original_info.instruction }
|
44
|
-
it( 'should parse web correctly' ){ @info .web.should == @original_info.web }
|
45
|
-
it( 'should parse contact correctly' ){ @info .contact.should == @original_info.contact }
|
46
|
-
it( 'should parse event_codes correctly' ){ @info .event_codes.should == @original_info.event_codes }
|
47
|
-
it( 'should parse parameters correctly' ){ @info .parameters.should == @original_info.parameters }
|
48
|
-
it( 'should parse resources correctly' ){ @info .resources.should == @original_info.resources }
|
49
|
-
it( 'should parse areas correctly' ){ @info .areas.should == @original_info.areas }
|
30
|
+
it( 'should parse categories correctly' ){ @info.categories.should_not( be_nil ) ; @info.categories.should == @original_info.categories }
|
31
|
+
it( 'should parse event correctly' ){ @info.event.should_not( be_nil ) ; @info.event.should == @original_info.event }
|
32
|
+
it( 'should parse response_types correctly' ){ @info.response_types.should_not( be_nil ); @info.response_types.should == @original_info.response_types }
|
33
|
+
it( 'should parse urgency correctly' ){ @info.urgency.should_not( be_nil ) ; @info.urgency.should == @original_info.urgency }
|
34
|
+
it( 'should parse severity correctly' ){ @info.severity.should_not( be_nil ) ; @info.severity.should == @original_info.severity }
|
35
|
+
it( 'should parse certainty correctly' ){ @info.certainty.should_not( be_nil ) ; @info.certainty.should == @original_info.certainty }
|
36
|
+
it( 'should parse audience correctly' ){ @info.audience.should_not( be_nil ) ; @info.audience.should == @original_info.audience }
|
37
|
+
it( 'should parse effective correctly' ){ @info.effective.should_not( be_nil ) ; @info.effective.should( be_within(Rational( 1, 86400 )).of( @original_info.effective ))}
|
38
|
+
it( 'should parse onset correctly' ){ @info.onset.should_not( be_nil ) ; @info.onset.should( be_within( Rational( 1, 86400 )).of( @original_info.onset ))}
|
39
|
+
it( 'should parse expires correctly' ){ @info.expires.should_not( be_nil ) ; @info.expires.should( be_within( Rational( 1, 86400 )).of( @original_info.expires ))}
|
40
|
+
it( 'should parse sender_name correctly' ){ @info.sender_name.should_not( be_nil ) ; @info.sender_name.should == @original_info.sender_name }
|
41
|
+
it( 'should parse headline correctly' ){ @info.headline.should_not( be_nil ) ; @info.headline.should == @original_info.headline }
|
42
|
+
it( 'should parse description correctly' ){ @info.description.should_not( be_nil ) ; @info.description.should == @original_info.description }
|
43
|
+
it( 'should parse instruction correctly' ){ @info.instruction.should_not( be_nil ) ; @info.instruction.should == @original_info.instruction }
|
44
|
+
it( 'should parse web correctly' ){ @info.web.should_not( be_nil ) ; @info.web.should == @original_info.web }
|
45
|
+
it( 'should parse contact correctly' ){ @info.contact.should_not( be_nil ) ; @info.contact.should == @original_info.contact }
|
46
|
+
it( 'should parse event_codes correctly' ){ @info.event_codes.should_not( be_nil ) ; @info.event_codes.should == @original_info.event_codes }
|
47
|
+
it( 'should parse parameters correctly' ){ @info.parameters.should_not( be_nil ) ; @info.parameters.should == @original_info.parameters }
|
48
|
+
it( 'should parse resources correctly' ){ @info.resources.should_not( be_nil ) ; @info.resources.should == @original_info.resources }
|
49
|
+
it( 'should parse areas correctly' ){ @info.areas.should_not( be_nil ) ; @info.areas.should == @original_info.areas }
|
50
50
|
end
|
51
51
|
|
52
52
|
context( 'from XML' ) do
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Farrel Lifson
|
@@ -10,7 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-
|
18
|
+
date: 2011-10-27 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: assistance
|
@@ -20,6 +25,11 @@ dependencies:
|
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 17
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 1
|
32
|
+
- 5
|
23
33
|
version: 0.1.5
|
24
34
|
type: :runtime
|
25
35
|
version_requirements: *id001
|
@@ -31,6 +41,11 @@ dependencies:
|
|
31
41
|
requirements:
|
32
42
|
- - ">="
|
33
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 1
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 5
|
48
|
+
- 1
|
34
49
|
version: 1.5.1
|
35
50
|
type: :runtime
|
36
51
|
version_requirements: *id002
|
@@ -42,6 +57,11 @@ dependencies:
|
|
42
57
|
requirements:
|
43
58
|
- - ">="
|
44
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 15
|
61
|
+
segments:
|
62
|
+
- 2
|
63
|
+
- 1
|
64
|
+
- 2
|
45
65
|
version: 2.1.2
|
46
66
|
type: :runtime
|
47
67
|
version_requirements: *id003
|
@@ -53,18 +73,26 @@ dependencies:
|
|
53
73
|
requirements:
|
54
74
|
- - ">="
|
55
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 27
|
77
|
+
segments:
|
78
|
+
- 2
|
79
|
+
- 5
|
80
|
+
- 0
|
56
81
|
version: 2.5.0
|
57
82
|
type: :development
|
58
83
|
version_requirements: *id004
|
59
84
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
85
|
+
name: rdoc
|
61
86
|
prerelease: false
|
62
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
88
|
none: false
|
64
89
|
requirements:
|
65
90
|
- - ">="
|
66
91
|
- !ruby/object:Gem::Version
|
67
|
-
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
68
96
|
type: :development
|
69
97
|
version_requirements: *id005
|
70
98
|
- !ruby/object:Gem::Dependency
|
@@ -75,6 +103,9 @@ dependencies:
|
|
75
103
|
requirements:
|
76
104
|
- - ">="
|
77
105
|
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
78
109
|
version: "0"
|
79
110
|
type: :development
|
80
111
|
version_requirements: *id006
|
@@ -95,6 +126,10 @@ files:
|
|
95
126
|
- README.rdoc
|
96
127
|
- Rakefile
|
97
128
|
- lib/config.rb
|
129
|
+
- lib/extensions/array.rb
|
130
|
+
- lib/extensions/date_time.rb
|
131
|
+
- lib/extensions/string.rb
|
132
|
+
- lib/extensions/time.rb
|
98
133
|
- lib/rcap.rb
|
99
134
|
- lib/rcap/alert.rb
|
100
135
|
- lib/rcap/cap_1_0/alert.rb
|
@@ -132,6 +167,19 @@ files:
|
|
132
167
|
- lib/rcap/version.rb
|
133
168
|
- rcap.gemspec
|
134
169
|
- spec/alert_spec.rb
|
170
|
+
- spec/assets/amber.atom
|
171
|
+
- spec/assets/canada.cap
|
172
|
+
- spec/assets/earthquake.cap
|
173
|
+
- spec/assets/earthquake_index.atom
|
174
|
+
- spec/assets/invalid.cap
|
175
|
+
- spec/assets/invalid.rss
|
176
|
+
- spec/assets/invalid_element.atom
|
177
|
+
- spec/assets/no_id.atom
|
178
|
+
- spec/assets/no_link.atom
|
179
|
+
- spec/assets/no_title.atom
|
180
|
+
- spec/assets/ny_index.rss
|
181
|
+
- spec/assets/weather.atom
|
182
|
+
- spec/assets/weather_index.atom
|
135
183
|
- spec/cap_1_0/alert_spec.rb
|
136
184
|
- spec/cap_1_0/area_spec.rb
|
137
185
|
- spec/cap_1_0/circle_spec.rb
|
@@ -179,12 +227,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
227
|
requirements:
|
180
228
|
- - ">="
|
181
229
|
- !ruby/object:Gem::Version
|
230
|
+
hash: 3
|
231
|
+
segments:
|
232
|
+
- 0
|
182
233
|
version: "0"
|
183
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
235
|
none: false
|
185
236
|
requirements:
|
186
237
|
- - ">="
|
187
238
|
- !ruby/object:Gem::Version
|
239
|
+
hash: 3
|
240
|
+
segments:
|
241
|
+
- 0
|
188
242
|
version: "0"
|
189
243
|
requirements: []
|
190
244
|
|
@@ -195,6 +249,19 @@ specification_version: 3
|
|
195
249
|
summary: CAP(Common Alerting Protocol) API
|
196
250
|
test_files:
|
197
251
|
- spec/alert_spec.rb
|
252
|
+
- spec/assets/amber.atom
|
253
|
+
- spec/assets/canada.cap
|
254
|
+
- spec/assets/earthquake.cap
|
255
|
+
- spec/assets/earthquake_index.atom
|
256
|
+
- spec/assets/invalid.cap
|
257
|
+
- spec/assets/invalid.rss
|
258
|
+
- spec/assets/invalid_element.atom
|
259
|
+
- spec/assets/no_id.atom
|
260
|
+
- spec/assets/no_link.atom
|
261
|
+
- spec/assets/no_title.atom
|
262
|
+
- spec/assets/ny_index.rss
|
263
|
+
- spec/assets/weather.atom
|
264
|
+
- spec/assets/weather_index.atom
|
198
265
|
- spec/cap_1_0/alert_spec.rb
|
199
266
|
- spec/cap_1_0/area_spec.rb
|
200
267
|
- spec/cap_1_0/circle_spec.rb
|