adiwg-mdtranslator 2.0.0rc13 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_browseCategory.rb +47 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_budget.rb +79 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_contact.rb +248 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb +49 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_extent.rb +62 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_id.rb +10 -3
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb +17 -15
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_materialRequest.rb +72 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_parentId.rb +44 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_project.rb +48 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_publication.rb +77 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb +90 -7
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_spatial.rb +56 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb +125 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkDocument.rb +99 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkGraphic.rb +92 -0
- data/lib/adiwg/mdtranslator/version.rb +2 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_bodyScript.js +6 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_citation.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +29 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_codelists.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +7 -1
- metadata +18 -22
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_additionalDocumentation.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_boundingBox.rb +0 -54
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_browseGraphic.rb +0 -66
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_citation.rb +0 -125
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_contacts.rb +0 -143
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_dateTime.rb +0 -31
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_distributionInfo.rb +0 -64
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_extent.rb +0 -61
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geoCoordSystem.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geoProperties.rb +0 -91
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geographicElement.rb +0 -161
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_metadata.rb +0 -75
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_metadataInfo.rb +0 -130
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_onlineResource.rb +0 -71
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_resourceIdentifier.rb +0 -73
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_resourceInfo.rb +0 -437
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_responsibleParty.rb +0 -53
@@ -75,7 +75,11 @@ module ADIWG
|
|
75
75
|
json.email hContact[:eMailList][0] unless hContact[:eMailList].empty?
|
76
76
|
json.hours Hours.build(hContact[:hoursOfService]) unless hContact[:hoursOfService].empty?
|
77
77
|
json.instructions hContact[:contactInstructions]
|
78
|
-
json.
|
78
|
+
json.officePhone hContact[:phones].collect {|ph| ph[:phoneNumber] if
|
79
|
+
ph[:phoneServiceTypes].include?('voice')}.reject(&:nil?).first
|
80
|
+
json.faxPhone hContact[:phones].collect {|ph| ph[:phoneNumber] if
|
81
|
+
ph[:phoneServiceTypes].include?('fax')}.reject(&:nil?).first
|
82
|
+
json.ttyPhone hContact[:phones].collect {|ph| ph[:phoneNumber] if
|
79
83
|
ph[:phoneServiceTypes].include?('tty')}.reject(&:nil?).first
|
80
84
|
json.organization {json.displayText orgName} unless orgName.nil?
|
81
85
|
json.logoUrl logoUrl unless logoUrl.nil?
|
@@ -87,6 +91,8 @@ module ADIWG
|
|
87
91
|
ph[:phoneServiceTypes].include?('voice')}.reject(&:nil?).first
|
88
92
|
json.faxPhone hContact[:phones].collect {|ph| ph[:phoneNumber] if
|
89
93
|
ph[:phoneServiceTypes].include?('fax')}.reject(&:nil?).first
|
94
|
+
json.ttyPhone hContact[:phones].collect {|ph| ph[:phoneNumber] if
|
95
|
+
ph[:phoneServiceTypes].include?('tty')}.reject(&:nil?).first
|
90
96
|
end
|
91
97
|
unless hContact[:addresses].empty?
|
92
98
|
aAddress = hContact[:addresses]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adiwg-mdtranslator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stan Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-06
|
12
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -310,32 +310,28 @@ files:
|
|
310
310
|
- lib/adiwg/mdtranslator/readers/mdJson/readme.md
|
311
311
|
- lib/adiwg/mdtranslator/readers/mdJson/version.rb
|
312
312
|
- lib/adiwg/mdtranslator/readers/mdReaders.rb
|
313
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_additionalDocumentation.rb
|
314
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_boundingBox.rb
|
315
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_browseGraphic.rb
|
316
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_citation.rb
|
317
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_contacts.rb
|
318
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_dateTime.rb
|
319
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_distributionInfo.rb
|
320
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_extent.rb
|
321
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geoCoordSystem.rb
|
322
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geoProperties.rb
|
323
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geographicElement.rb
|
324
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_metadata.rb
|
325
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_metadataInfo.rb
|
326
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_onlineResource.rb
|
327
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_resourceIdentifier.rb
|
328
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_resourceInfo.rb
|
329
|
-
- lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_responsibleParty.rb
|
330
313
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_body.rb
|
314
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_browseCategory.rb
|
315
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_budget.rb
|
331
316
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_citation.rb
|
317
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_contact.rb
|
318
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb
|
319
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_extent.rb
|
332
320
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_id.rb
|
333
321
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb
|
322
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_materialRequest.rb
|
323
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_parentId.rb
|
324
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_project.rb
|
334
325
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb
|
326
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_publication.rb
|
335
327
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_purpose.rb
|
336
328
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_rights.rb
|
337
329
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb
|
330
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_spatial.rb
|
331
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb
|
338
332
|
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_titles.rb
|
333
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkDocument.rb
|
334
|
+
- lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkGraphic.rb
|
339
335
|
- lib/adiwg/mdtranslator/readers/sbJson/readme.md
|
340
336
|
- lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
|
341
337
|
- lib/adiwg/mdtranslator/readers/sbJson/version.rb
|
@@ -656,12 +652,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
656
652
|
version: '2.1'
|
657
653
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
658
654
|
requirements:
|
659
|
-
- - "
|
655
|
+
- - ">="
|
660
656
|
- !ruby/object:Gem::Version
|
661
|
-
version:
|
657
|
+
version: '0'
|
662
658
|
requirements: []
|
663
659
|
rubyforge_project:
|
664
|
-
rubygems_version: 2.
|
660
|
+
rubygems_version: 2.6.8
|
665
661
|
signing_key:
|
666
662
|
specification_version: 4
|
667
663
|
summary: The mdtranslator (metadata translator) is a tool for translating metadata
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_citation')
|
2
|
-
|
3
|
-
module ADIWG
|
4
|
-
module Mdtranslator
|
5
|
-
module Readers
|
6
|
-
module SbJson
|
7
|
-
|
8
|
-
module AdditionalDocumentation
|
9
|
-
|
10
|
-
def self.unpack(hAddDoc, responseObj)
|
11
|
-
|
12
|
-
# return nil object if input is empty
|
13
|
-
intAddDoc = nil
|
14
|
-
return if hAddDoc.empty?
|
15
|
-
|
16
|
-
# instance classes needed in script
|
17
|
-
intMetadataClass = InternalMetadata.new
|
18
|
-
intAddDoc = intMetadataClass.newAdditionalDocumentation
|
19
|
-
|
20
|
-
# additional documentation - resource type
|
21
|
-
if hAddDoc.has_key?('resourceType')
|
22
|
-
s = hAddDoc['resourceType']
|
23
|
-
if s != ''
|
24
|
-
intAddDoc[:resourceType] = s
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# additional documentation - resource citation
|
29
|
-
if hAddDoc.has_key?('citation')
|
30
|
-
hCitation = hAddDoc['citation']
|
31
|
-
unless hCitation.empty?
|
32
|
-
intAddDoc[:citation] = Citation.unpack(hCitation, responseObj)
|
33
|
-
else
|
34
|
-
responseObj[:readerExecutionMessages] << 'Additional documentation citation is empty'
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
37
|
-
end
|
38
|
-
else
|
39
|
-
responseObj[:readerExecutionMessages] << 'Additional documentation citation is missing'
|
40
|
-
responseObj[:readerExecutionPass] = false
|
41
|
-
return nil
|
42
|
-
end
|
43
|
-
|
44
|
-
return intAddDoc
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module ADIWG
|
2
|
-
module Mdtranslator
|
3
|
-
module Readers
|
4
|
-
module SbJson
|
5
|
-
|
6
|
-
module BoundingBox
|
7
|
-
|
8
|
-
def self.unpack(aBBox, responseObj)
|
9
|
-
|
10
|
-
# instance classes needed in script
|
11
|
-
intMetadataClass = InternalMetadata.new
|
12
|
-
intGeometry = intMetadataClass.newGeometry
|
13
|
-
intGeometry[:geoType] = 'BoundingBox'
|
14
|
-
|
15
|
-
# unpack GeoJSON bounding box elements
|
16
|
-
intBBox = intMetadataClass.newBoundingBox
|
17
|
-
west = aBBox[0]
|
18
|
-
south = aBBox[1]
|
19
|
-
east = aBBox[2]
|
20
|
-
north = aBBox[3]
|
21
|
-
|
22
|
-
# validate coordinates if easting +/-180 and northing +/-90
|
23
|
-
valid = false
|
24
|
-
if (180 >= west) && (west >= -180)
|
25
|
-
if (90 >= south) && (south >= -90)
|
26
|
-
if (180 >= east) && (east >= -180)
|
27
|
-
if (90 >= north) &&(north >= -90)
|
28
|
-
valid = true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# build internal geo element if valid
|
35
|
-
if valid
|
36
|
-
intBBox[:westLong] = west
|
37
|
-
intBBox[:eastLong] = east
|
38
|
-
intBBox[:southLat] = south
|
39
|
-
intBBox[:northLat] = north
|
40
|
-
intGeometry[:geometry] = intBBox
|
41
|
-
|
42
|
-
return intGeometry
|
43
|
-
else
|
44
|
-
return nil
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
module ADIWG
|
2
|
-
module Mdtranslator
|
3
|
-
module Readers
|
4
|
-
module SbJson
|
5
|
-
|
6
|
-
module BrowseGraphic
|
7
|
-
|
8
|
-
def self.unpack(hBgraphic, responseObj)
|
9
|
-
|
10
|
-
# return nil object if input is empty
|
11
|
-
intBGraphic = nil
|
12
|
-
return if hBgraphic.empty?
|
13
|
-
|
14
|
-
# instance classes needed in script
|
15
|
-
intMetadataClass = InternalMetadata.new
|
16
|
-
intBGraphic = intMetadataClass.newBrowseGraphic
|
17
|
-
|
18
|
-
# graphic - file name
|
19
|
-
if hBgraphic.has_key?('fileName')
|
20
|
-
s = hBgraphic['fileName']
|
21
|
-
if s != ''
|
22
|
-
intBGraphic[:bGName] = s
|
23
|
-
else
|
24
|
-
responseObj[:readerExecutionMessages] << 'Graphic overview name is empty'
|
25
|
-
responseObj[:readerExecutionPass] = false
|
26
|
-
return nil
|
27
|
-
end
|
28
|
-
else
|
29
|
-
responseObj[:readerExecutionMessages] << 'Graphic overview name is missing'
|
30
|
-
responseObj[:readerExecutionPass] = false
|
31
|
-
return nil
|
32
|
-
end
|
33
|
-
|
34
|
-
# graphic - file description
|
35
|
-
if hBgraphic.has_key?('fileDescription')
|
36
|
-
s = hBgraphic['fileDescription']
|
37
|
-
if s != ''
|
38
|
-
intBGraphic[:bGDescription] = s
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# graphic - file type
|
43
|
-
if hBgraphic.has_key?('fileType')
|
44
|
-
s = hBgraphic['fileType']
|
45
|
-
if s != ''
|
46
|
-
intBGraphic[:bGType] = s
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# graphic - web link
|
51
|
-
if hBgraphic.has_key?('fileUri')
|
52
|
-
s = hBgraphic['fileUri']
|
53
|
-
if s != ''
|
54
|
-
intBGraphic[:bGURI] = s
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
return intBGraphic
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_dateTime')
|
2
|
-
require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_responsibleParty')
|
3
|
-
require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_onlineResource')
|
4
|
-
require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceIdentifier')
|
5
|
-
|
6
|
-
module ADIWG
|
7
|
-
module Mdtranslator
|
8
|
-
module Readers
|
9
|
-
module SbJson
|
10
|
-
|
11
|
-
module Citation
|
12
|
-
|
13
|
-
def self.unpack(hCitation, responseObj)
|
14
|
-
|
15
|
-
# return nil object if input is empty
|
16
|
-
intCitation = nil
|
17
|
-
return if hCitation.empty?
|
18
|
-
|
19
|
-
# instance classes needed in script
|
20
|
-
intMetadataClass = InternalMetadata.new
|
21
|
-
intCitation = intMetadataClass.newCitation
|
22
|
-
|
23
|
-
# citation - title
|
24
|
-
if hCitation.has_key?('title')
|
25
|
-
s = hCitation['title']
|
26
|
-
if s != ''
|
27
|
-
intCitation[:citTitle] = s
|
28
|
-
else
|
29
|
-
responseObj[:readerExecutionMessages] << 'Citation title is empty'
|
30
|
-
responseObj[:readerExecutionPass] = false
|
31
|
-
return nil
|
32
|
-
end
|
33
|
-
else
|
34
|
-
responseObj[:readerExecutionMessages] << 'Citation title is missing'
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
37
|
-
end
|
38
|
-
|
39
|
-
# citation - alternate title
|
40
|
-
if hCitation.has_key?('alternateTitle')
|
41
|
-
s = hCitation['alternateTitle']
|
42
|
-
if s != ''
|
43
|
-
intCitation[:citAltTitle] = s
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# citation - date
|
48
|
-
if hCitation.has_key?('date')
|
49
|
-
aCitDates = hCitation['date']
|
50
|
-
unless aCitDates.empty?
|
51
|
-
aCitDates.each do |hCitDate|
|
52
|
-
if hCitDate.has_key?('date')
|
53
|
-
s = hCitDate['date']
|
54
|
-
if s != ''
|
55
|
-
intDateTime = SbDateTime.unpack(s, responseObj)
|
56
|
-
if hCitDate.has_key?('dateType')
|
57
|
-
s = hCitDate['dateType']
|
58
|
-
if s != ''
|
59
|
-
intDateTime[:dateType] = s
|
60
|
-
end
|
61
|
-
end
|
62
|
-
intCitation[:citDate] << intDateTime
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# citation - edition
|
70
|
-
if hCitation.has_key?('edition')
|
71
|
-
s = hCitation['edition']
|
72
|
-
if s != ''
|
73
|
-
intCitation[:citEdition] = s
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# citation - responsible party
|
78
|
-
if hCitation.has_key?('responsibleParty')
|
79
|
-
aRParty = hCitation['responsibleParty']
|
80
|
-
unless aRParty.empty?
|
81
|
-
aRParty.each do |hRParty|
|
82
|
-
intCitation[:citResponsibleParty] << ResponsibleParty.unpack(hRParty, responseObj)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
# citation - presentation form
|
88
|
-
if hCitation.has_key?('presentationForm')
|
89
|
-
aPForms = hCitation['presentationForm']
|
90
|
-
unless aPForms.empty?
|
91
|
-
aPForms.each do |pForm|
|
92
|
-
intCitation[:citResourceForms] << pForm
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# citation - resource identifiers
|
98
|
-
if hCitation.has_key?('identifier')
|
99
|
-
aResIds = hCitation['identifier']
|
100
|
-
aResIds.each do |hIdentifier|
|
101
|
-
unless hIdentifier.empty?
|
102
|
-
intCitation[:citResourceIds] << ResourceIdentifier.unpack(hIdentifier, responseObj)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# citation - online resources
|
108
|
-
if hCitation.has_key?('onlineResource')
|
109
|
-
aOlRes = hCitation['onlineResource']
|
110
|
-
aOlRes.each do |hOlRes|
|
111
|
-
unless hOlRes.empty?
|
112
|
-
intCitation[:citOlResources] << OnlineResource.unpack(hOlRes, responseObj)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
return intCitation
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
require 'uuidtools'
|
2
|
-
|
3
|
-
module ADIWG
|
4
|
-
module Mdtranslator
|
5
|
-
module Readers
|
6
|
-
module SbJson
|
7
|
-
module Contact
|
8
|
-
def self.unpack(hContact, responseObj)
|
9
|
-
# return nil object if input is empty
|
10
|
-
intCont = nil
|
11
|
-
return if hContact.empty?
|
12
|
-
|
13
|
-
# instance classes needed in script
|
14
|
-
intMetadataClass = InternalMetadata.new
|
15
|
-
intCont = intMetadataClass.newContact
|
16
|
-
|
17
|
-
# contact ID - required
|
18
|
-
# SB doesn't provide a contactId, so we create one
|
19
|
-
intCont[:contactId] = UUIDTools::UUID.random_create.to_s
|
20
|
-
hContact['contactId'] = intCont[:contactId]
|
21
|
-
|
22
|
-
# contact name
|
23
|
-
s = hContact['name']
|
24
|
-
if s != ''
|
25
|
-
if hContact['contactType'] == 'person'
|
26
|
-
intCont[:indName] = s
|
27
|
-
intCont[:orgName] = hContact['organization']['displayText'] unless hContact[:organization].nil?
|
28
|
-
else
|
29
|
-
intCont[:orgName] = s
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# position name
|
34
|
-
if hContact.key?('jobTitle')
|
35
|
-
s = hContact['jobTitle']
|
36
|
-
intCont[:position] = s if s != ''
|
37
|
-
end
|
38
|
-
|
39
|
-
# SB Role
|
40
|
-
if hContact.key?('type')
|
41
|
-
s = hContact['type']
|
42
|
-
intCont[:primaryRole] = s if s != ''
|
43
|
-
end
|
44
|
-
|
45
|
-
# contact instructions
|
46
|
-
if hContact.key?('instructions')
|
47
|
-
s = hContact['instructions']
|
48
|
-
intCont[:contactInstructions] = s if s != ''
|
49
|
-
end
|
50
|
-
|
51
|
-
if hContact.key?('primaryLocation')
|
52
|
-
pl = hContact['primaryLocation']
|
53
|
-
# phones - all service types
|
54
|
-
if pl.key?('officePhone')
|
55
|
-
officePhone = intMetadataClass.newPhone
|
56
|
-
|
57
|
-
# phone - service
|
58
|
-
officePhone[:phoneServiceType] = 'voice'
|
59
|
-
officePhone[:phoneName] = 'officePhone'
|
60
|
-
officePhone[:phoneNumber] = pl['officePhone']
|
61
|
-
intCont[:phones] << officePhone
|
62
|
-
end
|
63
|
-
if pl.key?('faxPhone')
|
64
|
-
faxPhone = intMetadataClass.newPhone
|
65
|
-
|
66
|
-
# phone - service
|
67
|
-
faxPhone[:phoneServiceType] = 'fax'
|
68
|
-
faxPhone[:phoneName] = 'faxPhone'
|
69
|
-
faxPhone[:phoneNumber] = pl['faxPhone']
|
70
|
-
intCont[:phones] << faxPhone
|
71
|
-
end
|
72
|
-
|
73
|
-
# address
|
74
|
-
address = pl['mailAddress'] || pl['streetAddress']
|
75
|
-
unless address.nil?
|
76
|
-
intAdd = intMetadataClass.newAddress
|
77
|
-
|
78
|
-
# address - delivery point
|
79
|
-
if address.has_key?('line1')
|
80
|
-
intAdd[:deliveryPoints] << address['line1']
|
81
|
-
end
|
82
|
-
|
83
|
-
if address.has_key?('line2')
|
84
|
-
intAdd[:deliveryPoints] << address['line2']
|
85
|
-
end
|
86
|
-
|
87
|
-
intAdd[:city] = address['city']
|
88
|
-
intAdd[:adminArea] = address['state']
|
89
|
-
intAdd[:postalCode] = address['zip']
|
90
|
-
intAdd[:country] = address['country']
|
91
|
-
|
92
|
-
if hContact['email']
|
93
|
-
intAdd[:eMailList] << hContact['email']
|
94
|
-
end
|
95
|
-
|
96
|
-
intCont[:address] = intAdd
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
intCont
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.setDefaultContacts
|
104
|
-
# add default contacts
|
105
|
-
intMetadataClass = InternalMetadata.new
|
106
|
-
aDefContacts = []
|
107
|
-
|
108
|
-
#contact for ScienceBase
|
109
|
-
intCont = intMetadataClass.newContact
|
110
|
-
intCont[:contactId] = 'SB'
|
111
|
-
intCont[:orgName] = 'ScienceBase'
|
112
|
-
|
113
|
-
intOlRes = intMetadataClass.newOnlineResource
|
114
|
-
intOlRes[:olResURI] = 'http://www.sciencebase.gov'
|
115
|
-
intOlRes[:olResName] = 'ScienceBase Homepage'
|
116
|
-
intCont[:onlineRes] << intOlRes
|
117
|
-
|
118
|
-
intAdd = intMetadataClass.newAddress
|
119
|
-
intAdd[:eMailList] << 'sciencebase@usgs.gov'
|
120
|
-
intCont[:address] = intAdd
|
121
|
-
intCont[:internal] = true
|
122
|
-
|
123
|
-
aDefContacts << intCont
|
124
|
-
|
125
|
-
# contact to support doi (digital object identifier)
|
126
|
-
intCont = intMetadataClass.newContact
|
127
|
-
intCont[:contactId] = 'ADIwgDOI'
|
128
|
-
intCont[:orgName] = 'International DOI Foundation (IDF)'
|
129
|
-
|
130
|
-
intOlRes = intMetadataClass.newOnlineResource
|
131
|
-
intOlRes[:olResURI] = 'http://www.doi.org'
|
132
|
-
intCont[:onlineRes] << intOlRes
|
133
|
-
intCont[:internal] = true
|
134
|
-
|
135
|
-
aDefContacts << intCont
|
136
|
-
|
137
|
-
aDefContacts
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|