Sha256: 033e4aec12c0c13d5df76ef77ec3ba48d25f389b30908cdf326ee8aa0e3b3437

Contents?: true

Size: 1.45 KB

Versions: 58

Compression:

Stored size: 1.45 KB

Contents

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

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

require 'adiwg/mdtranslator/internal/internal_metadata_obj'
require_relative 'module_codelists'

module ADIWG
   module Mdtranslator
      module Readers
         module SbJson

            module Date

               def self.unpack(hSbJson, hCitation, hResponseObj)

                  # instance classes needed in script
                  intMetadataClass = InternalMetadata.new

                  if hSbJson.has_key?('dates')
                     hSbJson['dates'].each do |hSbDate|
                        hDate = intMetadataClass.newDate
                        aReturn = AdiwgDateTimeFun.dateTimeFromString(hSbDate['dateString'])
                        unless aReturn.nil?
                           hDate[:date] = aReturn[0]
                           hDate[:dateResolution] = aReturn[1]
                           hDate[:description] = hSbDate['label']
                           sbType = hSbDate['type']
                           adiwgType = Codelists.codelist_sb2adiwg('date_sb2adiwg', sbType)
                           type = adiwgType.nil? ? sbType : adiwgType
                           hDate[:dateType] = type
                           hCitation[:dates] << hDate
                        end
                     end
                  end

                  return hCitation

               end

            end

         end
      end
   end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.18.0rc6 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.18.0rc5 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.18.0rc4 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.18.0rc3 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.18.0rc2 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.18.0rc1 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.17.1 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.16.1 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.15.0 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.14.2 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.14.1 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.14.0 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.13.3 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.13.2 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.13.1 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.13.0 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.12.0 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.12.0.pre lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.10.0 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb