Module: ADIWG::Mdtranslator::Readers::SbJson::Provenance

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

Class Method Summary collapse

Class Method Details

.unpack(hSbJson, hCitation, hResponseObj) ⇒ Object



16
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
42
43
44
45
46
47
48
49
50
51
# File 'lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb', line 16

def self.unpack(hSbJson, hCitation, hResponseObj)

   # instance classes needed in script
   intMetadataClass = .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