Class: ADIWG::Mdtranslator::Writers::Fgdc::Phone
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Fgdc::Phone
- Defined in:
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ Phone
constructor
A new instance of Phone.
- #writeXML(aPhones, context = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ Phone
17 18 19 20 21 |
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb', line 17 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc end |
Instance Method Details
#writeXML(aPhones, context = nil) ⇒ Object
23 24 25 26 27 28 29 30 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 |
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb', line 23 def writeXML(aPhones, context = nil) # phone 10.5 (cntvoice) - voice phone [] (required) # <- hPhone[:phoneNumber] where hPhone[:phoneServiceTypes] = 'voice' haveVoice = false aPhones.each do |hPhone| if hPhone[:phoneServiceTypes].include?('voice') unless hPhone[:phoneNumber].nil? @xml.tag!('cntvoice', hPhone[:phoneNumber]) haveVoice = true end end end unless haveVoice @NameSpace.issueWarning(5, 'cntvoice', context) end # phone 10.6 (cnttdd) - tty phone [] # <- hPhone[:phoneNumber] where hPhone[:phoneServiceTypes] = 'tty' haveTTY = false aPhones.each do |hPhone| if hPhone[:phoneServiceTypes].include?('tty') unless hPhone[:phoneNumber].nil? @xml.tag!('cnttdd', hPhone[:phoneNumber]) haveTTY = true end end end if !haveTTY && @hResponseObj[:writerShowTags] @xml.tag!('cnttdd') end # phone 10.7 (cntfax) - fax phone [] # <- hPhone[:phoneNumber] where hPhone[:phoneServiceTypes] = ['fax' | 'facsimile'] haveFax = false aPhones.each do |hPhone| if hPhone[:phoneServiceTypes].include?('fax') || hPhone[:phoneServiceTypes].include?('facsimile') unless hPhone[:phoneNumber].nil? @xml.tag!('cntfax', hPhone[:phoneNumber]) haveFax = true end end end if !haveFax && @hResponseObj[:writerShowTags] @xml.tag!('cntfax') end end |