module ADIWG::Mdtranslator::Readers::MdJson::Funding
Public Class Methods
unpack(hFunding, responseObj)
click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb, line 19 def self.unpack(hFunding, responseObj) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson # return nil object if input is empty if hFunding.empty? @MessagePath.issueWarning(300, responseObj) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new intFunding = intMetadataClass.newFunding outContext = 'funding' # funding - description if hFunding.has_key?('description') unless hFunding['description'] == '' intFunding[:description] = hFunding['description'] end end # funding - timePeriod (required if) if hFunding.has_key?('timePeriod') hObject = hFunding['timePeriod'] unless hObject.empty? hReturn = TimePeriod.unpack(hObject, responseObj, outContext) unless hReturn.nil? intFunding[:timePeriod] = hReturn end end end # funding - allocation [] (required if) if hFunding.has_key?('allocation') aItems = hFunding['allocation'] aItems.each do |item| hReturn = Allocation.unpack(item, responseObj) unless hReturn.nil? intFunding[:allocations] << hReturn end end end # error messages if intFunding[:allocations].empty? && intFunding[:timePeriod].empty? @MessagePath.issueError(301, responseObj) end return intFunding end