Module: Adiwg_ResourceMaintenance

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_resourceMaintenance.rb

Class Method Summary collapse

Class Method Details

.unpack(hResource) ⇒ Object



15
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
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_resourceMaintenance.rb', line 15

def self.unpack(hResource)

  # instance classes needed in script
  intMetadataClass = .new
  intResMaint = intMetadataClass.newResourceMaint

  # resource maintenance - frequency code
  if hResource.has_key?('maintenanceFrequency')
    s = hResource['maintenanceFrequency']
    if s != ''
      intResMaint[:maintFreq] = s
    end
  end

  # resource maintenance - maintenance note
  if hResource.has_key?('maintenanceNote')
    aNotes = hResource['maintenanceNote']
    unless aNotes.empty?
      intResMaint[:maintNotes] = aNotes
    end
  end

  # resource maintenance - contact
  if hResource.has_key?('maintenanceContact')
    aContact = hResource['maintenanceContact']
    unless aContact.empty?
      aContact.each do |hContact|
        intResMaint[:maintContacts] << Adiwg_ResponsibleParty.unpack(hContact)
      end
    end
  end

  return intResMaint
end