Class: ADIWG::Mdtranslator::Writers::Iso19115_2::CI_Contact
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19115_2::CI_Contact
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ CI_Contact
constructor
A new instance of CI_Contact.
- #writeXML(hContact) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ CI_Contact
Returns a new instance of CI_Contact.
26 27 28 29 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb', line 26 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj end |
Instance Method Details
#writeXML(hContact) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/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) # outContext outContext = 'contact information' outContext += ' ' + hContact[:name] unless hContact[:name].nil? outContext += ' (' + hContact[:contactId] + ')' unless hContact[:contactId].nil? @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, outContext) 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 |