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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/adiwg/mdtranslator/readers/sbJson/modules/module_materialRequest.rb', line 17
def self.unpack(hSbJson, hResponseObj)
intMetadataClass = InternalMetadata.new
if hSbJson.has_key?('materialRequestInstructions')
sbRequest = hSbJson['materialRequestInstructions']
unless sbRequest.nil? || sbRequest == ''
hContact = intMetadataClass.newContact
hContact[:contactId] = UUIDTools::UUID.random_create.to_s
hContact[:name] = 'U.S. Geological Survey ScienceBase'
hContact[:contactType] = 'materialRequestInstructions'
hDistribution = intMetadataClass.newDistribution
hDistributor = intMetadataClass.newDistributor
hResponsibility = intMetadataClass.newResponsibility
hParty = intMetadataClass.newParty
hProcess = intMetadataClass.newOrderProcess
hParty[:contactId] = hContact[:contactId]
hParty[:contactType] = 'ScienceBase'
hResponsibility[:roleName] = 'distributor'
hResponsibility[:parties] << hParty
hProcess[:orderingInstructions] = sbRequest
hDistributor[:contact] = hResponsibility
hDistributor[:orderProcess] << hProcess
hDistribution[:description] = 'sbJson Material Request distributor generated by ADIwg mdTranslator'
hDistribution[:distributor] << hDistributor
return hContact, hDistribution
end
end
return nil
end
|