class ADIWG::Mdtranslator::Writers::Iso19110::CI_Contact
Public Class Methods
new(xml, hResponseObj)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19110/classes/class_contact.rb, line 26 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj end
Public Instance Methods
writeXML(hContact)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19110/classes/class_contact.rb, line 31 def writeXML(hContact) # classes used phoneClass = CI_Telephone.new(@xml, @hResponseObj) addClass = CI_Address.new(@xml, @hResponseObj) resourceClass = CI_OnlineResource.new(@xml, @hResponseObj) @xml.tag!('gmd:CI_Contact') do # contact - phones [] (pass all phones) aPhones = hContact[:phones] unless aPhones.empty? @xml.tag!('gmd:phone') do phoneClass.writeXML(aPhones) end end if aPhones.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:phone') end # contact - address [0] hAddress = hContact[:addresses][0] aEmail = hContact[:eMailList] unless hAddress.nil? && aEmail.empty? @xml.tag!('gmd:address') do addClass.writeXML(hAddress, aEmail) end end if hAddress.nil? && hContact[:eMailList].empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:address') end # contact - online resource [0] hOlResource = hContact[:onlineResources][0] unless hOlResource.nil? @xml.tag!('gmd:onlineResource') do resourceClass.writeXML(hOlResource) end end if hOlResource.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:onlineResource') end # contact - hours of service [0] s = hContact[:hoursOfService][0] unless s.nil? @xml.tag!('gmd:hoursOfService') do @xml.tag!('gco:CharacterString', s) end end if s.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:hoursOfService') end # contact - contact instructions s = hContact[:contactInstructions] unless s.nil? @xml.tag!('gmd:contactInstructions') do @xml.tag!('gco:CharacterString', hContact[:contactInstructions]) end end if s.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:contactInstructions') end end # CI_Contact tag end