Module: Adiwg_Address
- Defined in:
- lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_address.rb
Overview
History: Stan Smith 2013-10-21 original script
Class Method Summary collapse
Class Method Details
.unpack(hConAddress) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 |
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_address.rb', line 9 def self.unpack(hConAddress) # instance classes needed in script intMetadataClass = InternalMetadata.new intAdd = nil unless hConAddress.empty? intAdd = intMetadataClass.newAddress # address - delivery point if hConAddress.has_key?('deliveryPoint') dPoint = hConAddress['deliveryPoint'] dPoint.each do |addLine| intAdd[:deliveryPoints] << addLine end end # address - city if hConAddress.has_key?('city') s = hConAddress['city'] if s != '' intAdd[:city] = s end end # address - admin area if hConAddress.has_key?('administrativeArea') s = hConAddress['administrativeArea'] if s != '' intAdd[:adminArea] = s end end # address - postal code if hConAddress.has_key?('postalCode') s = hConAddress['postalCode'] if s != '' intAdd[:postalCode] = s end end # address - country if hConAddress.has_key?('country') s = hConAddress['country'] if s != '' intAdd[:country] = s end end # address - email if hConAddress.has_key?('electronicMailAddress') eMailList = hConAddress['electronicMailAddress'] eMailList.each do |email| intAdd[:eMailList] << email end end end return intAdd end |