module ADIWG::Mdtranslator::Readers::SbJson::Date

Public Class Methods

unpack(hSbJson, hCitation, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb, line 17
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