Sha256: e49392d4459ee0aad5f3bfb15f2f19ba9e2d4268ad3f5526c27cd604339dc71e

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

# unpack address
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-10-21 original script

module Adiwg_Address

	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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_address.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_address.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_address.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_address.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_address.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_address.rb