Class: ADIWG::Mdtranslator::Writers::Fgdc::Address
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Fgdc::Address
- Defined in:
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ Address
constructor
A new instance of Address.
- #writeXML(hAddress, inContext = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ Address
Returns a new instance of Address.
17 18 19 20 21 |
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb', line 17 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc end |
Instance Method Details
#writeXML(hAddress, inContext = 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 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb', line 23 def writeXML(hAddress, inContext = nil) # contact 10.4 (cntaddr) - address information # contact 10.4.1 (addrtype) - address type (required) # <- hAddress[:addressTypes][0] unless hAddress[:addressTypes].empty? @xml.tag!('addrtype', hAddress[:addressTypes][0]) end if hAddress[:addressTypes].empty? @NameSpace.issueWarning(1, 'addrtype', inContext) end # contact 10.4.2 (address) - address lines # <- hAddress[:deliveryPoints] hAddress[:deliveryPoints].each do |addLine| @xml.tag!('address', addLine) end if hAddress[:deliveryPoints].empty? && @hResponseObj[:writerShowTags] @xml.tag!('address') end # contact 10.4.3 (city) - city (required) # <- hAddress[:city] unless hAddress[:city].nil? @xml.tag!('city', hAddress[:city]) end if hAddress[:city].nil? @NameSpace.issueWarning(2, 'city', inContext) end # contact 10.4.4 (state) - state (required) # <- hAddress[:adminArea] unless hAddress[:adminArea].nil? @xml.tag!('state', hAddress[:adminArea]) end if hAddress[:adminArea].nil? @NameSpace.issueWarning(3, 'state', inContext) end # contact 10.4.5 (postal) - postal code (required) # <- hAddress[:postalCode] unless hAddress[:postalCode].nil? @xml.tag!('postal', hAddress[:postalCode]) end if hAddress[:postalCode].nil? @NameSpace.issueWarning(4, 'postal', inContext) end # contact 10.4.6 (country) - country # <- hAddress[:country] unless hAddress[:country].nil? @xml.tag!('country', hAddress[:country]) end if hAddress[:country].nil? && @hResponseObj[:writerShowTags] @xml.tag!('country') end end |