lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb in adiwg-mdtranslator-2.13.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb in adiwg-mdtranslator-2.13.1
- old
+ new
@@ -1,10 +1,10 @@
# unpack address
# Reader - ADIwg JSON to internal data structure
# History:
-# Stan Smith 2018-02-18 refactored error and warning messaging
+# Stan Smith 2018-06-13 refactored error and warning messaging
# Stan Smith 2016-10-03 refactored for mdJson 2.0
# Stan Smith 2015-07-14 refactored to remove global namespace constants
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
# Stan Smith 2014-12-30 refactored
# ... electronicMailAddresses into internal object
@@ -17,15 +17,17 @@
module Readers
module MdJson
module Address
- def self.unpack(hAddress, responseObj)
+ def self.unpack(hAddress, responseObj, inContext = nil)
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
+
# return nil object if input is empty
if hAddress.empty?
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: address object is empty'
+ @MessagePath.issueWarning(10, responseObj, inContext)
return nil
end
# instance classes needed in script
intMetadataClass = InternalMetadata.new
@@ -38,12 +40,10 @@
intAdd[:addressTypes] << item
end
end
end
if intAdd[:addressTypes].empty?
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: address type is missing'
- responseObj[:readerExecutionPass] = false
- return nil
+ @MessagePath.issueError(11, responseObj, inContext)
end
# address - description
if hAddress.has_key?('description')
unless hAddress['description'] == ''