lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb in adiwg-mdtranslator-2.13.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb in adiwg-mdtranslator-2.13.1

- old
+ new

@@ -1,10 +1,10 @@ # unpack online resources # Reader - ADIwg JSON V1 to internal data structure # History: -# Stan Smith 2018-02-19 refactored error and warning messaging +# Stan Smith 2018-06-22 refactored error and warning messaging # Stan Smith 2016-10-03 original script # 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-15 refactored to handle namespacing readers and writers # Stan Smith 2014-12-10 changed to return nil intOlRes if input empty @@ -18,15 +18,17 @@ module Readers module MdJson module OnlineResource - def self.unpack(hOnlineRes, responseObj) + def self.unpack(hOnlineRes, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + # return nil object if input is empty if hOnlineRes.empty? - responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: online resource object is empty' + @MessagePath.issueWarning(600, responseObj, inContext) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new @@ -35,12 +37,10 @@ # resource - web link (required) if hOnlineRes.has_key?('uri') intOLRes[:olResURI] = hOnlineRes['uri'] end if intOLRes[:olResURI].nil? || intOLRes[:olResURI] == '' - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: online resource URI is missing' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueError(601, responseObj, inContext) end # resource - web link protocol if hOnlineRes.has_key?('protocol') unless hOnlineRes['protocol'] == ''