Module: ADIWG::Mdtranslator::Readers::SbJson::Date

Defined in:
lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb

Class Method Summary collapse

Class Method Details

.unpack(hSbJson, hCitation, hResponseObj) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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