From: Farrel Lifson Date: 2009-11-04T05:32:44+09:00 Subject: RCAP - Common Alerting Protocl for Ruby OVERVIEW RCAP is an implementation of the CAP in Ruby. It allows for the creation of RCAP messages from Ruby applications and the parsing of external messages. RCAP currently supports only CAP Version 1.1. RCAP is released under the BSD License. INSTALLATION RCAP is distributed as a Ruby gem and is available from Gemcutter. If you have Gemcutter set as a source of your gems then RCAP can be installed from the command line $ gem install rcap The gem is also available for download and manual installtion at www.aimred.com/gems . WEB RESOURCES * The RCAP project page can be found at www.aimred.com/projects/rcap * The RCAP API docs can be fount at www.aimred.com/projects/rcap/api USAGE alert = Alert.new( :sender => 'cape_town_disaster_relief@capetown.municipal.za', :status => Alert::STATUS_ACTUAL, :msg_type => Alert::MSG_TYPE_ALERT, :scope => Alert::SCOPE_PUBLIC, :infos => Info.new( :event => 'Liquid Petroleoum Tanker Fire', :language => 'en-ZA', :categories => [ Info::CATEGORY_TRANSPORT, Info::CATEGORY_FIRE ], :urgency => Info::URGENCY_IMMEDIATE, :severity => Info::SEVERITY_SEVERE, :certainty => Info::CERTAINTY_OBSERVED, :headline => 'LIQUID PETROLEOUM TANKER FIRE ON N2 INCOMING FREEWAY', :description => 'A liquid petroleoum tanker has caught fire on the N2 incoming freeway 1km after the R300 interchange. Municipal fire fighting crews have been dispatched. Traffic control officers are on the scene and have diverted traffic onto alternate routes.' )) # Accessing attributes puts alert.status # Print out "Actual" puts alert.infos[0].language # Print out "en-ZA" puts alert.infos[0].categories.join( ' ' ) # Print out "Transport Fire" puts alert.to_xml # Print out CAP XML message will produce the following CAP XML Message 494207a7-f86b-4060-8318-a4b2a3ce565e cape_town_disaster_relief@capetown.municipal.za 2009-10-26T21:04:51+02:00 Actual Alert Public en-ZA Transport Fire Liquid Petroleoum Tanker Fire Immediate Severe Observed LIQUID PETROLEOUM TANKER FIRE ON N2 INCOMING FREEWAY A liquid petroleoum tanker has caught fire on the N2 incoming freeway 1km after the R300 interchange. Municipal fire fighting crews have been dispatched. Traffic control officers are on the scene and have diverted traffic onto alternate routes. Farrel Lifson -- Aimred - Ruby Development and Consulting http://www.aimred.com