class ADIWG::Mdtranslator::Writers::Iso19110::CI_Address

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19110/classes/class_address.rb, line 22
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Public Instance Methods

writeXML(hAddress, aEmail) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19110/classes/class_address.rb, line 27
def writeXML(hAddress, aEmail)

   @xml.tag!('gmd:CI_Address') do

      unless hAddress.nil?

         # address - address type (not used by ISO 19115-2)

         # address - description (not used by ISO 19115-2)

         # address - delivery points []
         aDeliveryPoints = hAddress[:deliveryPoints]
         aDeliveryPoints.each do |myPoint|
            @xml.tag!('gmd:deliveryPoint') do
               @xml.tag!('gco:CharacterString', myPoint)
            end
         end
         if aDeliveryPoints.empty? && @hResponseObj[:writerShowTags]
            @xml.tag!('gmd:deliveryPoint')
         end

         # address - city
         s = hAddress[:city]
         unless s.nil?
            @xml.tag!('gmd:city') do
               @xml.tag!('gco:CharacterString', s)
            end
         end
         if s.nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('gmd:city')
         end

         # address - administrative area
         s = hAddress[:adminArea]
         unless s.nil?
            @xml.tag!('gmd:administrativeArea') do
               @xml.tag!('gco:CharacterString', s)
            end
         end
         if s.nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('gmd:administrativeArea')
         end

         # address - postal code
         s = hAddress[:postalCode]
         unless s.nil?
            @xml.tag!('gmd:postalCode') do
               @xml.tag!('gco:CharacterString', s)
            end
         end
         if s.nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('gmd:postalCode')
         end

         # address - country
         s = hAddress[:country]
         unless s.nil?
            @xml.tag!('gmd:country') do
               @xml.tag!('gco:CharacterString', s)
            end
         end
         if s.nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('gmd:country')
         end

      end

      # address - email addresses []
      aEmail.each do |myEmail|
         @xml.tag!('gmd:electronicMailAddress') do
            @xml.tag!('gco:CharacterString', myEmail)
         end
      end
      if aEmail.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:electronicMailAddress')
      end

   end # CI_Address tag
end