module ADIWG::Mdtranslator::Readers::SbJson::Identifier

Public Class Methods

unpack(hSbJson, hCitation, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb, line 16
def self.unpack(hSbJson, hCitation, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new

   if hSbJson.has_key?('identifiers')
      hSbJson['identifiers'].each_with_index do |hSbIdentifier, i|
         hIdentifier = intMetadataClass.newIdentifier

         unless hSbIdentifier['type'].nil? || hSbIdentifier['type'] == ''
            hIdentifier[:description] = hSbIdentifier['type']
         end
         unless hSbIdentifier['scheme'].nil? || hSbIdentifier['scheme'] == ''
            hIdentifier[:namespace] = hSbIdentifier['scheme']
         end
         unless hSbIdentifier['key'].nil? || hSbIdentifier['key'] == ''
            hIdentifier[:identifier] = hSbIdentifier['key']
         end

         hCitation[:identifiers] << hIdentifier
      end
   end

   return hCitation

end