Sha256: c4ccaee53ceccad4accfbcf049bdcf0ddeaea24d57a0c8a1c2585cfccae0270b

Contents?: true

Size: 1.87 KB

Versions: 29

Compression:

Stored size: 1.87 KB

Contents

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

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

require 'adiwg/mdtranslator/internal/internal_metadata_obj'

module ADIWG
   module Mdtranslator
      module Readers
         module SbJson

            module Provenance

               def self.unpack(hSbJson, hCitation, hResponseObj)

                  # instance classes needed in script
                  intMetadataClass = InternalMetadata.new

                  # title
                  if hSbJson.has_key?('provenance')
                     hSbProv = hSbJson['provenance']

                     if hSbProv.has_key?('dateCreated')
                        unless hSbProv['dateCreated'].nil? || hSbProv['dateCreated'] == ''
                           hDate = intMetadataClass.newDate
                           hReturn = AdiwgDateTimeFun.dateTimeFromString(hSbProv['dateCreated'])
                           hDate[:date] = hReturn[0]
                           hDate[:dateResolution] = hReturn[1]
                           hDate[:dateType] = 'creation'
                           hCitation[:dates] << hDate
                        end
                     end

                     if hSbProv.has_key?('lastUpdated')
                        unless hSbProv['lastUpdated'].nil? || hSbProv['lastUpdated'] == ''
                           hDate = intMetadataClass.newDate
                           hReturn = AdiwgDateTimeFun.dateTimeFromString(hSbProv['lastUpdated'])
                           hDate[:date] = hReturn[0]
                           hDate[:dateResolution] = hReturn[1]
                           hDate[:dateType] = 'lastUpdate'
                           hCitation[:dates] << hDate
                        end
                     end

                  end

                  return hCitation

               end

            end

         end
      end
   end
end

Version data entries

29 entries across 29 versions & 1 rubygems

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