Sha256: 64791e9a7f7add4e3f2820258fb86ab6a657b4ea47ef2f2213cf04f7fc02f024

Contents?: true

Size: 1.5 KB

Versions: 46

Compression:

Stored size: 1.5 KB

Contents

# sbJson 1.0 writer

# History:
#  Stan Smith 2017-05-15 refactored for mdJson/mdTranslator 2.0
#  Josh Bradley original script

module ADIWG
   module Mdtranslator
      module Writers
         module SbJson

            module Id

               # use metadataInfo identifier
               # else use citation identifier
               # valid identifier must have namespace = 'gov.sciencebase.catalog'
               def self.build(intObj)

                  metadataInfo = intObj[:metadata][:metadataInfo]
                  resourceInfo = intObj[:metadata][:resourceInfo]
                  hMetadataId = metadataInfo[:metadataIdentifier]
                  hCitation = resourceInfo[:citation]

                  unless hMetadataId.empty?
                     if hMetadataId[:namespace] == 'gov.sciencebase.catalog'
                        unless hMetadataId[:identifier].nil?
                           return hMetadataId[:identifier]
                        end
                     end
                  end

                  unless hCitation.empty?
                     hCitation[:identifiers].each do |hIdentifier|
                        if hIdentifier[:namespace] == 'gov.sciencebase.catalog'
                           unless hIdentifier[:identifier].nil?
                              return hIdentifier[:identifier]
                           end
                        end
                     end
                  end

                  return nil

               end

            end

         end
      end
   end
end

Version data entries

46 entries across 46 versions & 1 rubygems

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