Sha256: 838fd81de0643ab81b40fcd159e671c16ca72fc320f2fd4cf4b8b38534ffb39e

Contents?: true

Size: 1.45 KB

Versions: 59

Compression:

Stored size: 1.45 KB

Contents

# unpack identifier
# Reader - ScienceBase JSON to internal data structure

# History:
#   Stan Smith 2016-06-19 original script

require 'adiwg/mdtranslator/internal/internal_metadata_obj'

module ADIWG
   module Mdtranslator
      module Readers
         module SbJson

            module Identifier

               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

            end

         end
      end
   end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.19.0.pre.beta.7 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.4 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb