From 6c03476054fc9465c04a9b02cca3f99b1f63de5f Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 10:22:06 -0600 Subject: [PATCH] Update to handle platform without errors. --- .../readers/mdJson/modules/module_platform.rb | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb index 27477ab4..c522d30a 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -1,6 +1,6 @@ require_relative 'module_citation' require_relative 'module_identifier' -require_relative 'module_responsibileParty' +require_relative 'module_responsibleParty' require_relative 'module_acq-instrument' require_relative 'module_acq-instrumentationEventList' @@ -10,62 +10,64 @@ module Readers module MdJson module Platform - def self.unpack(hAcqPlatform, responseObj, inContext = nil) + def self.unpack(hPlatform, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson - intAcqPlatform = intMetadataClass.newPlatform + intMetadataClass = InternalMetadata.new + intPlatform = intMetadataClass.newPlatform - if hAcqPlatform.has_key('platformId') - intAcqPlatform[:platformId] = hAcqPlatform['platformId'] + if hPlatform.has_key?('platformId') + intPlatform[:platformId] = hPlatform['platformId'] else @MessagePath.issueError(460, responseObj, inContext) end - if hAcqPlatform.has_key?('citation') - hReturn = Citation.unpack(hAcqPlatform['citation'], responseObj, inContext) + if hPlatform.has_key?('citation') + hReturn = Citation.unpack(hPlatform['citation'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:citation] = hReturn + intPlatform[:citation] = hReturn end end - if hAcqPlatform.has_key?('identifier') - hReturn = Identifier.unpack(hAcqPlatform['identifier'], responseObj, inContext) + if hPlatform.has_key?('identifier') + hReturn = Identifier.unpack(hPlatform['identifier'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:identifier] = hReturn + intPlatform[:identifier] = hReturn else @MessagePath.issueError(461, responseObj, inContext) end end - if hAcqPlatform.has_key('description') - intAcqPlatform[:description] = hAcqPlatform['description'] + if hPlatform.has_key?('description') + intPlatform[:description] = hPlatform['description'] else @MessagePath.issueError(460, responseObj, inContext) end - if hAcqPlatform.has_key?('sponsor') - hReturn = ResponsibileParty.unpack(hAcqPlatform['sponsor'], responseObj, inContext) + if hPlatform.has_key?('sponsor') + hReturn = ResponsibileParty.unpack(hPlatform['sponsor'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:sponsors] = hReturn + intPlatform[:sponsors] = hReturn end end - if hAcqPlatform.has_key('instrument') - hReturn = AcqInstrument.unpack(hAcqPlatform['instrument'], responseObj, inContext) + if hPlatform.has_key?('instrument') + hReturn = AcqInstrument.unpack(hPlatform['instrument'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:instruments] = hReturn + intPlatform[:instruments] = hReturn else @MessagePath.issueError(461, responseObj, inContext) end end - if hAcqPlatform.has_key('history') - hReturn = AcqInstrumentationEventList.unpack(hAcqPlatform['history'], responseObj, inContext) + if hPlatform.has_key?('history') + hReturn = AcqInstrumentationEventList.unpack(hPlatform['history'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:history] = hReturn + intPlatform[:history] = hReturn + end end - intAcqPlatform + intPlatform end end