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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_contacts.rb', line 19
def self.unpack(hContact)
intMetadataClass = InternalMetadata.new
intCont = intMetadataClass.newContact
if hContact.has_key?('contactId')
s = hContact['contactId']
if s != ''
intCont[:contactID] = s
end
end
if hContact.has_key?('individualName')
s = hContact['individualName']
if s != ''
intCont[:indName] = s
end
end
if hContact.has_key?('organizationName')
s = hContact['organizationName']
if s != ''
intCont[:orgName] = s
end
end
if hContact.has_key?('positionName')
s = hContact['positionName']
if s != ''
intCont[:position] = s
end
end
if hContact.has_key?('onlineResource')
aOlRes = hContact['onlineResource']
aOlRes.each do |hOlRes|
unless hOlRes.empty?
intCont[:onlineRes] << Adiwg_OnlineResource.unpack(hOlRes)
end
end
end
if hContact.has_key?('contactInstructions')
s = hContact['contactInstructions']
if s != ''
intCont[:contactInstructions] = s
end
end
if hContact.has_key?('phoneBook')
aPhones = hContact['phoneBook']
aPhones.each do |hPhone|
intCont[:phones].concat(Adiwg_Phone.unpack(hPhone))
end
end
if hContact.has_key?('address')
conAddress = hContact['address']
intCont[:address] = Adiwg_Address.unpack(conAddress)
end
return intCont
end
|