puree 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -2
- data/README.md +8 -2
- data/lib/puree/collection.rb +30 -21
- data/lib/puree/configuration.rb +1 -1
- data/lib/puree/dataset.rb +235 -162
- data/lib/puree/download.rb +21 -16
- data/lib/puree/event.rb +68 -34
- data/lib/puree/journal.rb +15 -7
- data/lib/puree/organisation.rb +95 -61
- data/lib/puree/person.rb +67 -39
- data/lib/puree/project.rb +100 -55
- data/lib/puree/publication.rb +118 -63
- data/lib/puree/publisher.rb +15 -9
- data/lib/puree/resource.rb +23 -24
- data/lib/puree/server.rb +24 -16
- data/lib/puree/version.rb +1 -1
- data/puree.gemspec +1 -1
- data/spec/collection.rb +4 -4
- data/spec/dataset.rb +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ddcb83b0373dc8b7ed99439c036f9df30e78e33
|
4
|
+
data.tar.gz: 725e1793dfce63c7ef1508a136e370e3854059f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec189df00f33a2024f24071ec2723e34a147bc6fad2b6bd759e5728aca27d8b434582e01502a68c8ed183abf7abd113ba8dff9734e9ea7e8e6c48aa3eaf69efc
|
7
|
+
data.tar.gz: 71c81c922c09a0b501d3229ff0dbcaa6d1d26cdd051f7224952c51e5d8a72b5c5cbf48148ef3ad63bcf93284c2ebd8cd5dda8fab11e639fdfdfa7a01cbc57f3c
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,18 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
5
|
## Unreleased
|
6
|
-
Metadata
|
7
|
-
Factory to make resource objects?
|
6
|
+
- Metadata: clipping?, externalPerson?, journal?, publisher?
|
7
|
+
- Factory to make resource objects?
|
8
|
+
- Make ALL dates ISO 8601 YYYY-MM-DD, rather than mirror varying formats from Pure?
|
9
|
+
|
10
|
+
## 0.16.0 - 2016-08-19
|
11
|
+
### Added
|
12
|
+
- Collection - instance parameter.
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Parameter endpoint renamed to base_url.
|
16
|
+
- Dataset (geographical renamed to spatial).
|
17
|
+
- Metadata methods return pre-extracted data.
|
8
18
|
|
9
19
|
## 0.15.0 - 2016-06-22
|
10
20
|
### Added
|
data/README.md
CHANGED
@@ -32,14 +32,20 @@ metadata = d.find uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
32
32
|
metadata['doi']
|
33
33
|
```
|
34
34
|
|
35
|
-
|
35
|
+
...or using a method...
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
d.doi
|
39
|
+
```
|
40
|
+
|
41
|
+
### Collection of resources
|
36
42
|
Tell Purée what you are looking for...
|
37
43
|
|
38
44
|
```ruby
|
39
45
|
c = Puree::Collection.new resource: :dataset
|
40
46
|
metadata = c.find limit: 50
|
41
47
|
```
|
42
|
-
...and get the data from an array of hashes.
|
48
|
+
...and get the data from an array of hashes or from an array of instances.
|
43
49
|
|
44
50
|
## Documentation
|
45
51
|
[API in YARD](http://www.rubydoc.info/gems/puree/frames)
|
data/lib/puree/collection.rb
CHANGED
@@ -5,18 +5,18 @@ module Puree
|
|
5
5
|
class Collection
|
6
6
|
|
7
7
|
# @param resource [Symbol]
|
8
|
-
# @param
|
9
|
-
# @param
|
10
|
-
# @param
|
11
|
-
# @param
|
8
|
+
# @param base_url [String]
|
9
|
+
# @param username [String]
|
10
|
+
# @param password [String]
|
11
|
+
# @param basic_auth [Boolean]
|
12
12
|
def initialize(resource: nil,
|
13
|
-
|
13
|
+
base_url: nil,
|
14
14
|
username: nil,
|
15
15
|
password: nil,
|
16
16
|
basic_auth: nil)
|
17
17
|
@resource_type = resource
|
18
18
|
@api_map = Puree::Map.new.get
|
19
|
-
@
|
19
|
+
@base_url = base_url.nil? ? Puree.base_url : base_url
|
20
20
|
@basic_auth = basic_auth.nil? ? Puree.basic_auth : basic_auth
|
21
21
|
if @basic_auth === true
|
22
22
|
@username = username.nil? ? Puree.username : username
|
@@ -27,14 +27,16 @@ module Puree
|
|
27
27
|
|
28
28
|
# Gets an array of objects of resource type specified in constructor
|
29
29
|
#
|
30
|
-
# @param
|
31
|
-
# @param
|
32
|
-
# @param
|
33
|
-
# @param
|
34
|
-
# @param
|
35
|
-
# @param
|
36
|
-
# @param
|
30
|
+
# @param limit [Integer]
|
31
|
+
# @param offset [Integer]
|
32
|
+
# @param created_start [String]
|
33
|
+
# @param created_end [String]
|
34
|
+
# @param modified_start [String]
|
35
|
+
# @param modified_end [String]
|
36
|
+
# @param full [Boolean]
|
37
|
+
# @param instance [Boolean]
|
37
38
|
# @return [Array<Object>]
|
39
|
+
# @return [Array<Resource subtype>]
|
38
40
|
def get(
|
39
41
|
limit: 20,
|
40
42
|
offset: 0,
|
@@ -43,6 +45,7 @@ module Puree
|
|
43
45
|
modified_start: nil,
|
44
46
|
modified_end: nil,
|
45
47
|
full: true,
|
48
|
+
instance: false,
|
46
49
|
rendering: :xml_long
|
47
50
|
)
|
48
51
|
|
@@ -58,6 +61,7 @@ module Puree
|
|
58
61
|
modified_start: modified_start,
|
59
62
|
modified_end: modified_end,
|
60
63
|
full: full,
|
64
|
+
instance: instance,
|
61
65
|
record_rendering: rendering
|
62
66
|
}
|
63
67
|
|
@@ -70,7 +74,7 @@ module Puree
|
|
70
74
|
end
|
71
75
|
|
72
76
|
# strip any trailing slash
|
73
|
-
@
|
77
|
+
@base_url = @base_url.sub(/(\/)+$/, '')
|
74
78
|
|
75
79
|
headers = {}
|
76
80
|
headers['Accept'] = 'application/xml'
|
@@ -129,7 +133,7 @@ module Puree
|
|
129
133
|
@doc = Nokogiri::XML @response.body
|
130
134
|
@doc.remove_namespaces!
|
131
135
|
|
132
|
-
code = @response.code
|
136
|
+
# code = @response.code
|
133
137
|
# body = @response.body
|
134
138
|
# puts "#{self.class.name} #{code}"
|
135
139
|
# puts "#{self.class.name} #{body}"
|
@@ -170,12 +174,12 @@ module Puree
|
|
170
174
|
resource_class = 'Puree::' + @resource_type.to_s.capitalize
|
171
175
|
|
172
176
|
if @options[:basic_auth] === true
|
173
|
-
r = Object.const_get(resource_class).new
|
177
|
+
r = Object.const_get(resource_class).new base_url: @base_url,
|
174
178
|
username: @username,
|
175
179
|
password: @password,
|
176
180
|
basic_auth: true
|
177
181
|
else
|
178
|
-
r = Object.const_get(resource_class).new
|
182
|
+
r = Object.const_get(resource_class).new base_url: @base_url
|
179
183
|
end
|
180
184
|
# whitelist symbol
|
181
185
|
if @api_map[:resource_type].has_key?(@resource_type)
|
@@ -184,7 +188,12 @@ module Puree
|
|
184
188
|
rendering: @options[:record_rendering]
|
185
189
|
# puts JSON.pretty_generate( record, :indent => ' ')
|
186
190
|
# p u
|
187
|
-
|
191
|
+
if @options[:instance]
|
192
|
+
data << r
|
193
|
+
else
|
194
|
+
# just the data
|
195
|
+
data << record
|
196
|
+
end
|
188
197
|
end
|
189
198
|
data
|
190
199
|
else
|
@@ -217,7 +226,7 @@ module Puree
|
|
217
226
|
else
|
218
227
|
service_api_mode = service + '.current'
|
219
228
|
end
|
220
|
-
@
|
229
|
+
@base_url + '/' + service_api_mode
|
221
230
|
end
|
222
231
|
|
223
232
|
def xpath_query(path)
|
@@ -227,8 +236,8 @@ module Puree
|
|
227
236
|
|
228
237
|
def missing_credentials
|
229
238
|
missing = []
|
230
|
-
if @
|
231
|
-
missing << '
|
239
|
+
if @base_url.nil?
|
240
|
+
missing << 'base_url'
|
232
241
|
end
|
233
242
|
|
234
243
|
if @options[:basic_auth] === true
|
data/lib/puree/configuration.rb
CHANGED
data/lib/puree/dataset.rb
CHANGED
@@ -4,60 +4,160 @@ module Puree
|
|
4
4
|
#
|
5
5
|
class Dataset < Resource
|
6
6
|
|
7
|
-
# @param
|
8
|
-
# @param
|
9
|
-
# @param
|
10
|
-
# @param
|
11
|
-
def initialize(
|
7
|
+
# @param base_url [String]
|
8
|
+
# @param username [String]
|
9
|
+
# @param password [String]
|
10
|
+
# @param basic_auth [Boolean]
|
11
|
+
def initialize(base_url: nil, username: nil, password: nil, basic_auth: nil)
|
12
12
|
super(api: :dataset,
|
13
|
-
|
13
|
+
base_url: base_url,
|
14
14
|
username: username,
|
15
15
|
password: password,
|
16
16
|
basic_auth: basic_auth)
|
17
17
|
end
|
18
18
|
|
19
|
+
# Open access permission
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
def access
|
23
|
+
@metadata['access']
|
24
|
+
end
|
25
|
+
|
26
|
+
# Combines project and publication
|
27
|
+
#
|
28
|
+
# @return [Array<Hash>]
|
29
|
+
def associated
|
30
|
+
@metadata['associated']
|
31
|
+
end
|
32
|
+
|
33
|
+
# Date made available
|
34
|
+
#
|
35
|
+
# @return [Hash]
|
36
|
+
def available
|
37
|
+
@metadata['available']
|
38
|
+
end
|
39
|
+
|
40
|
+
# Description
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
def description
|
44
|
+
@metadata['description']
|
45
|
+
end
|
46
|
+
|
47
|
+
# Digital Object Identifier
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
def doi
|
51
|
+
@metadata['doi']
|
52
|
+
end
|
53
|
+
|
54
|
+
# Supporting file
|
55
|
+
#
|
56
|
+
# @return [Array<Hash>]
|
57
|
+
def file
|
58
|
+
@metadata['file']
|
59
|
+
end
|
60
|
+
|
61
|
+
# Keyword
|
62
|
+
#
|
63
|
+
# @return [Array<String>]
|
64
|
+
def keyword
|
65
|
+
@metadata['keyword']
|
66
|
+
end
|
19
67
|
|
20
68
|
# Link
|
21
69
|
#
|
22
70
|
# @return [Array<Hash>]
|
23
71
|
def link
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
data.uniq
|
72
|
+
@metadata['link']
|
73
|
+
end
|
74
|
+
|
75
|
+
# Organisation
|
76
|
+
#
|
77
|
+
# @return [Array<Hash>]
|
78
|
+
def organisation
|
79
|
+
@metadata['organisation']
|
34
80
|
end
|
35
81
|
|
36
82
|
# Owner
|
37
83
|
#
|
38
84
|
# @return [Hash]
|
39
85
|
def owner
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
86
|
+
@metadata['owner']
|
87
|
+
end
|
88
|
+
|
89
|
+
# Person (internal, external, other)
|
90
|
+
#
|
91
|
+
# @return [Array<Hash>]
|
92
|
+
def person
|
93
|
+
@metadata['person']
|
94
|
+
end
|
95
|
+
|
96
|
+
# Date of data production
|
97
|
+
#
|
98
|
+
# @return [Hash]
|
99
|
+
def production
|
100
|
+
@metadata['production']
|
101
|
+
end
|
102
|
+
|
103
|
+
# Project
|
104
|
+
#
|
105
|
+
# @return [Array<Hash>]
|
106
|
+
def project
|
107
|
+
@metadata['project']
|
108
|
+
end
|
109
|
+
|
110
|
+
# Publication
|
111
|
+
#
|
112
|
+
# @return [Array<Hash>]
|
113
|
+
def publication
|
114
|
+
@metadata['publication']
|
47
115
|
end
|
48
116
|
|
49
117
|
# Publisher
|
50
118
|
#
|
51
119
|
# @return [String]
|
52
120
|
def publisher
|
53
|
-
|
54
|
-
xpath_query_for_single_value path
|
121
|
+
@metadata['publisher']
|
55
122
|
end
|
56
123
|
|
57
|
-
#
|
124
|
+
# Spatial coverage
|
58
125
|
#
|
59
|
-
# @return [Array<
|
60
|
-
def
|
126
|
+
# @return [Array<String>]
|
127
|
+
def spatial
|
128
|
+
@metadata['spatial']
|
129
|
+
end
|
130
|
+
|
131
|
+
# Temporal coverage
|
132
|
+
#
|
133
|
+
# @return [Hash]
|
134
|
+
def temporal
|
135
|
+
@metadata['temporal']
|
136
|
+
end
|
137
|
+
|
138
|
+
# Title
|
139
|
+
#
|
140
|
+
# @return [String]
|
141
|
+
def title
|
142
|
+
@metadata['title']
|
143
|
+
end
|
144
|
+
|
145
|
+
# All metadata
|
146
|
+
#
|
147
|
+
# @return [Hash]
|
148
|
+
def metadata
|
149
|
+
@metadata
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
def extract_access
|
156
|
+
path = '/openAccessPermission/term/localizedString'
|
157
|
+
xpath_query_for_single_value path
|
158
|
+
end
|
159
|
+
|
160
|
+
def extract_associated
|
61
161
|
path = '/associatedContent//relatedContent'
|
62
162
|
xpath_result = xpath_query path
|
63
163
|
data_arr = []
|
@@ -71,57 +171,71 @@ module Puree
|
|
71
171
|
data_arr.uniq
|
72
172
|
end
|
73
173
|
|
74
|
-
|
75
|
-
|
76
|
-
# @return [Array<Hash>]
|
77
|
-
def project
|
78
|
-
associated_type('Research').uniq
|
174
|
+
def extract_available
|
175
|
+
temporal_start_date 'dateMadeAvailable'
|
79
176
|
end
|
80
177
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
def publication
|
85
|
-
data_arr = []
|
86
|
-
associated.each do |i|
|
87
|
-
if i['type'] != 'Research'
|
88
|
-
data_arr << i
|
89
|
-
end
|
90
|
-
end
|
91
|
-
data_arr.uniq
|
178
|
+
def extract_description
|
179
|
+
path = '/descriptions/classificationDefinedField/value/localizedString'
|
180
|
+
xpath_query_for_single_value path
|
92
181
|
end
|
93
182
|
|
94
|
-
|
95
|
-
|
96
|
-
#
|
97
|
-
# @return [String]
|
98
|
-
def title
|
99
|
-
path = '/title/localizedString'
|
183
|
+
def extract_doi
|
184
|
+
path = '/doi'
|
100
185
|
xpath_query_for_single_value path
|
101
186
|
end
|
102
187
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
188
|
+
def extract_file
|
189
|
+
path = '/documents/document'
|
190
|
+
xpath_result = xpath_query path
|
191
|
+
|
192
|
+
docs = []
|
193
|
+
|
194
|
+
xpath_result.each do |d|
|
195
|
+
doc = {}
|
196
|
+
# doc['id'] = f.xpath('id').text.strip
|
197
|
+
doc['name'] = d.xpath('fileName').text.strip
|
198
|
+
doc['mime'] = d.xpath('mimeType').text.strip
|
199
|
+
doc['size'] = d.xpath('size').text.strip
|
200
|
+
doc['url'] = d.xpath('url').text.strip
|
201
|
+
doc['title'] = d.xpath('title').text.strip
|
202
|
+
# doc['createdDate'] = d.xpath('createdDate').text.strip
|
203
|
+
# doc['visibleOnPortalDate'] = d.xpath('visibleOnPortalDate').text.strip
|
204
|
+
# doc['limitedVisibility'] = d.xpath('limitedVisibility').text.strip
|
205
|
+
|
206
|
+
license = {}
|
207
|
+
license_name = d.xpath('documentLicense/term/localizedString').text.strip
|
208
|
+
license['name'] = license_name
|
209
|
+
license_url = d.xpath('documentLicense/description/localizedString').text.strip
|
210
|
+
license['url'] = license_url
|
211
|
+
doc['license'] = license
|
212
|
+
docs << doc
|
213
|
+
|
214
|
+
end
|
215
|
+
docs.uniq
|
216
|
+
end
|
217
|
+
|
218
|
+
def extract_keyword
|
107
219
|
path = '/keywordGroups/keywordGroup/keyword/userDefinedKeyword/freeKeyword'
|
108
220
|
xpath_result = xpath_query path
|
109
221
|
data_arr = xpath_result.map { |i| i.text.strip }
|
110
222
|
data_arr.uniq
|
111
223
|
end
|
112
224
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
225
|
+
def extract_link
|
226
|
+
path = '/links/link'
|
227
|
+
xpath_result = xpath_query path
|
228
|
+
data = []
|
229
|
+
xpath_result.each { |i|
|
230
|
+
o = {}
|
231
|
+
o['url'] = i.xpath('url').text.strip
|
232
|
+
o['description'] = i.xpath('description').text.strip
|
233
|
+
data << o
|
234
|
+
}
|
235
|
+
data.uniq
|
119
236
|
end
|
120
237
|
|
121
|
-
|
122
|
-
#
|
123
|
-
# @return [Array<Hash>]
|
124
|
-
def organisation
|
238
|
+
def extract_organisation
|
125
239
|
path = '/organisations/organisation'
|
126
240
|
xpath_result = xpath_query path
|
127
241
|
data = []
|
@@ -135,10 +249,17 @@ module Puree
|
|
135
249
|
data
|
136
250
|
end
|
137
251
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
252
|
+
def extract_owner
|
253
|
+
path = '/managedBy'
|
254
|
+
xpath_result = xpath_query path
|
255
|
+
o = {}
|
256
|
+
o['uuid'] = xpath_result.xpath('@uuid').text.strip
|
257
|
+
o['name'] = xpath_result.xpath('name/localizedString').text.strip
|
258
|
+
o['type'] = xpath_result.xpath('typeClassification/term/localizedString').text.strip
|
259
|
+
o
|
260
|
+
end
|
261
|
+
|
262
|
+
def extract_person
|
142
263
|
data = {}
|
143
264
|
# internal
|
144
265
|
path = '/persons/dataSetPersonAssociation'
|
@@ -174,17 +295,30 @@ module Puree
|
|
174
295
|
data
|
175
296
|
end
|
176
297
|
|
177
|
-
|
178
|
-
|
179
|
-
# @return [Hash]
|
180
|
-
def available
|
181
|
-
temporal_start_date 'dateMadeAvailable'
|
298
|
+
def extract_production
|
299
|
+
temporal_range 'dateOfDataProduction', 'endDateOfDataProduction'
|
182
300
|
end
|
183
301
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
302
|
+
def extract_project
|
303
|
+
associated_type('Research').uniq
|
304
|
+
end
|
305
|
+
|
306
|
+
def extract_publication
|
307
|
+
data_arr = []
|
308
|
+
extract_associated.each do |i|
|
309
|
+
if i['type'] != 'Research'
|
310
|
+
data_arr << i
|
311
|
+
end
|
312
|
+
end
|
313
|
+
data_arr.uniq
|
314
|
+
end
|
315
|
+
|
316
|
+
def extract_publisher
|
317
|
+
path = '/publisher/name'
|
318
|
+
xpath_query_for_single_value path
|
319
|
+
end
|
320
|
+
|
321
|
+
def extract_spatial
|
188
322
|
path = '/geographicalCoverage/localizedString'
|
189
323
|
xpath_result = xpath_query path
|
190
324
|
data = []
|
@@ -194,68 +328,12 @@ module Puree
|
|
194
328
|
data
|
195
329
|
end
|
196
330
|
|
197
|
-
|
198
|
-
#
|
199
|
-
# @return [Hash]
|
200
|
-
def production
|
201
|
-
temporal_range 'dateOfDataProduction', 'endDateOfDataProduction'
|
202
|
-
end
|
203
|
-
|
204
|
-
|
205
|
-
# Temporal coverage
|
206
|
-
#
|
207
|
-
# @return [Hash]
|
208
|
-
def temporal
|
331
|
+
def extract_temporal
|
209
332
|
temporal_range 'temporalCoverageStartDate', 'temporalCoverageEndDate'
|
210
333
|
end
|
211
334
|
|
212
|
-
|
213
|
-
|
214
|
-
# @return [String]
|
215
|
-
def access
|
216
|
-
path = '/openAccessPermission/term/localizedString'
|
217
|
-
xpath_query_for_single_value path
|
218
|
-
end
|
219
|
-
|
220
|
-
|
221
|
-
# Supporting file
|
222
|
-
#
|
223
|
-
# @return [Array<Hash>]
|
224
|
-
def file
|
225
|
-
path = '/documents/document'
|
226
|
-
xpath_result = xpath_query path
|
227
|
-
|
228
|
-
docs = []
|
229
|
-
|
230
|
-
xpath_result.each do |d|
|
231
|
-
doc = {}
|
232
|
-
# doc['id'] = f.xpath('id').text.strip
|
233
|
-
doc['name'] = d.xpath('fileName').text.strip
|
234
|
-
doc['mime'] = d.xpath('mimeType').text.strip
|
235
|
-
doc['size'] = d.xpath('size').text.strip
|
236
|
-
doc['url'] = d.xpath('url').text.strip
|
237
|
-
doc['title'] = d.xpath('title').text.strip
|
238
|
-
# doc['createdDate'] = d.xpath('createdDate').text.strip
|
239
|
-
# doc['visibleOnPortalDate'] = d.xpath('visibleOnPortalDate').text.strip
|
240
|
-
# doc['limitedVisibility'] = d.xpath('limitedVisibility').text.strip
|
241
|
-
|
242
|
-
license = {}
|
243
|
-
license_name = d.xpath('documentLicense/term/localizedString').text.strip
|
244
|
-
license['name'] = license_name
|
245
|
-
license_url = d.xpath('documentLicense/description/localizedString').text.strip
|
246
|
-
license['url'] = license_url
|
247
|
-
doc['license'] = license
|
248
|
-
docs << doc
|
249
|
-
|
250
|
-
end
|
251
|
-
docs.uniq
|
252
|
-
end
|
253
|
-
|
254
|
-
# Digital Object Identifier
|
255
|
-
#
|
256
|
-
# @return [String]
|
257
|
-
def doi
|
258
|
-
path = '/doi'
|
335
|
+
def extract_title
|
336
|
+
path = '/title/localizedString'
|
259
337
|
xpath_query_for_single_value path
|
260
338
|
end
|
261
339
|
|
@@ -265,34 +343,29 @@ module Puree
|
|
265
343
|
# !data.empty? ? data['startedWorkflow']['state'] : ''
|
266
344
|
# end
|
267
345
|
|
268
|
-
|
269
|
-
#
|
270
|
-
# @return [Hash]
|
271
|
-
def metadata
|
346
|
+
def combine_metadata
|
272
347
|
o = super
|
273
|
-
o['access'] =
|
274
|
-
o['associated'] =
|
275
|
-
o['available'] =
|
276
|
-
o['description'] =
|
277
|
-
o['doi'] =
|
278
|
-
o['file'] =
|
279
|
-
o['
|
280
|
-
o['
|
281
|
-
o['
|
282
|
-
o['
|
283
|
-
o['
|
284
|
-
o['
|
285
|
-
o['
|
286
|
-
o['
|
287
|
-
o['
|
288
|
-
o['
|
289
|
-
o['temporal'] =
|
290
|
-
o['title'] =
|
291
|
-
o
|
348
|
+
o['access'] = extract_access
|
349
|
+
o['associated'] = extract_associated
|
350
|
+
o['available'] = extract_available
|
351
|
+
o['description'] = extract_description
|
352
|
+
o['doi'] = extract_doi
|
353
|
+
o['file'] = extract_file
|
354
|
+
o['keyword'] = extract_keyword
|
355
|
+
o['link'] = extract_link
|
356
|
+
o['organisation'] = extract_organisation
|
357
|
+
o['owner'] = extract_owner
|
358
|
+
o['person'] = extract_person
|
359
|
+
o['project'] = extract_project
|
360
|
+
o['production'] = extract_production
|
361
|
+
o['publication'] = extract_publication
|
362
|
+
o['publisher'] = extract_publisher
|
363
|
+
o['spatial'] = extract_spatial
|
364
|
+
o['temporal'] = extract_temporal
|
365
|
+
o['title'] = extract_title
|
366
|
+
@metadata = o
|
292
367
|
end
|
293
368
|
|
294
|
-
private
|
295
|
-
|
296
369
|
# Assembles basic information about a person
|
297
370
|
#
|
298
371
|
# @param generic_data [Hash]
|
@@ -355,7 +428,7 @@ module Puree
|
|
355
428
|
#
|
356
429
|
# @return [Hash]
|
357
430
|
def associated_type(type)
|
358
|
-
associated_arr =
|
431
|
+
associated_arr = extract_associated
|
359
432
|
data_arr = []
|
360
433
|
associated_arr.each do |i|
|
361
434
|
data = {}
|