Sha256: 061304d0d2a1a06271c885b08020537fafe5bd2d39c18fa751b3548ae63ef49b

Contents?: true

Size: 711 Bytes

Versions: 7

Compression:

Stored size: 711 Bytes

Contents

module RCAP
  module CAP_1_2
    class Geocode < Parameter

      XML_ELEMENT_NAME = 'geocode' # :nodoc:

      XPATH = "cap:#{ XML_ELEMENT_NAME }" # :nodoc:

      def to_xml_element # :nodoc:
        xml_element = REXML::Element.new( XML_ELEMENT_NAME )
        xml_element.add_element( NAME_ELEMENT_NAME ).add_text( @name )
        xml_element.add_element( VALUE_ELEMENT_NAME ).add_text( @value )
        xml_element
      end

      def self.from_xml_element( geocode_xml_element ) # :nodoc:
        self.new( :name  => RCAP.xpath_text( geocode_xml_element, NAME_XPATH, Alert::XMLNS ),
                 :value => RCAP.xpath_text( geocode_xml_element, VALUE_XPATH, Alert::XMLNS ))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rcap-1.0.1 lib/rcap/cap_1_2/geocode.rb
rcap-1.0.0 lib/rcap/cap_1_2/geocode.rb
rcap-1.0.0.rc.5 lib/rcap/cap_1_2/geocode.rb
rcap-1.0.0.rc.4 lib/rcap/cap_1_2/geocode.rb
rcap-1.0.0.rc.3 lib/rcap/cap_1_2/geocode.rb
rcap-1.0.0.rc.2 lib/rcap/cap_1_2/geocode.rb
rcap-1.0.0.rc.1 lib/rcap/cap_1_2/geocode.rb