puree 0.10.0 → 0.11.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 +10 -0
- data/README.md +23 -2
- data/lib/puree.rb +1 -0
- data/lib/puree/collection.rb +1 -1
- data/lib/puree/dataset.rb +46 -67
- data/lib/puree/event.rb +88 -0
- data/lib/puree/map.rb +1 -0
- data/lib/puree/organisation.rb +69 -1
- data/lib/puree/person.rb +3 -3
- data/lib/puree/publication.rb +11 -17
- data/lib/puree/resource.rb +6 -2
- data/lib/puree/version.rb +1 -1
- data/spec/dataset.rb +43 -22
- data/spec/spec_helper.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5010e60daa336c9d45804049400f946af67d8d9e
|
4
|
+
data.tar.gz: 9c6d97bce8924ad81b3213c9066b344f268811ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f15e9d9255f39007b9f1659c2210cfc061298b9e33d0df8fa67bea84a8ecb0d37f5f0de20816fc2da8c97d7c650f613d6afc8fdced6bc7700621b77a376a971
|
7
|
+
data.tar.gz: 2ce7fb3d3b2a7727fc8fea763e901fcc70c50daf04ab701df90be6e63f65fdf0c3628b53e28a8068a5b48cc6a056bc94fcdfe4a321717dbe5a41b4873d83eb2d
|
data/CHANGELOG.md
CHANGED
@@ -2,9 +2,19 @@
|
|
2
2
|
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
|
+
## 0.11.0 - 2016-05-19
|
6
|
+
### Added
|
7
|
+
- Event metadata (city, country, date, description, location, title, type).
|
8
|
+
- Organisation metadata (address, email, phone, type, url).
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
- Dataset metadata (return string not array for description, title).
|
12
|
+
- Publication metadata (return string not array for description, subtitle, title).
|
13
|
+
|
5
14
|
## 0.10.0 - 2016-05-17
|
6
15
|
### Added
|
7
16
|
- Dataset metadata (associated, link, project, production as range, person for those without uuid, publication for all research outputs, publisher).
|
17
|
+
|
8
18
|
### Fixed
|
9
19
|
- Dataset metadata (description splitting, geographical stripping).
|
10
20
|
|
data/README.md
CHANGED
@@ -48,10 +48,12 @@ d.doi
|
|
48
48
|
d.file
|
49
49
|
d.geographical
|
50
50
|
d.keyword
|
51
|
+
d.link
|
51
52
|
d.person
|
52
|
-
d.project
|
53
53
|
d.production
|
54
|
+
d.project
|
54
55
|
d.publication
|
56
|
+
d.publisher
|
55
57
|
d.temporal
|
56
58
|
d.title
|
57
59
|
|
@@ -215,7 +217,7 @@ An array of research outputs associated with the dataset.
|
|
215
217
|
]
|
216
218
|
```
|
217
219
|
|
218
|
-
### temporal
|
220
|
+
### production, temporal
|
219
221
|
Date range. If year is present, month and day will have data or an empty string.
|
220
222
|
|
221
223
|
```ruby
|
@@ -233,6 +235,23 @@ Date range. If year is present, month and day will have data or an empty string.
|
|
233
235
|
}
|
234
236
|
```
|
235
237
|
|
238
|
+
## Organisation data structures
|
239
|
+
|
240
|
+
### address
|
241
|
+
An array of addresses.
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
[
|
245
|
+
{
|
246
|
+
"street"=>"Lancaster University",
|
247
|
+
"building"=>"Bowland North",
|
248
|
+
"postcode"=>"LA1 4YN",
|
249
|
+
"city"=>"Lancaster",
|
250
|
+
"country"=>"United Kingdom"
|
251
|
+
}
|
252
|
+
]
|
253
|
+
```
|
254
|
+
|
236
255
|
## Publication data structures
|
237
256
|
|
238
257
|
### file
|
@@ -281,6 +300,7 @@ Resource metadata
|
|
281
300
|
|
282
301
|
```ruby
|
283
302
|
:dataset
|
303
|
+
:event
|
284
304
|
:organisation
|
285
305
|
:person
|
286
306
|
:publication
|
@@ -298,6 +318,7 @@ Collections (for obtaining identifiers)
|
|
298
318
|
|
299
319
|
```ruby
|
300
320
|
:dataset
|
321
|
+
:event
|
301
322
|
:journal
|
302
323
|
:organisation
|
303
324
|
:person
|
data/lib/puree.rb
CHANGED
data/lib/puree/collection.rb
CHANGED
data/lib/puree/dataset.rb
CHANGED
@@ -17,8 +17,8 @@ module Puree
|
|
17
17
|
data = []
|
18
18
|
xpath_result.each { |i|
|
19
19
|
o = {}
|
20
|
-
o['url'] = i.xpath('url').text
|
21
|
-
o['description'] = i.xpath('description').text
|
20
|
+
o['url'] = i.xpath('url').text.strip
|
21
|
+
o['description'] = i.xpath('description').text.strip
|
22
22
|
data << o
|
23
23
|
}
|
24
24
|
return data.uniq
|
@@ -30,7 +30,7 @@ module Puree
|
|
30
30
|
def publisher
|
31
31
|
path = '//publisher/name'
|
32
32
|
xpath_result = xpath_query path
|
33
|
-
xpath_result ? xpath_result.text : ''
|
33
|
+
xpath_result ? xpath_result.text.strip : ''
|
34
34
|
end
|
35
35
|
|
36
36
|
# Combines project and publication
|
@@ -42,15 +42,14 @@ module Puree
|
|
42
42
|
data_arr = []
|
43
43
|
xpath_result.each { |i|
|
44
44
|
data = {}
|
45
|
-
data['type'] = i.xpath('typeClassification').text
|
46
|
-
data['title'] = i.xpath('title').text
|
47
|
-
data['uuid'] = i.attr('uuid')
|
45
|
+
data['type'] = i.xpath('typeClassification').text.strip
|
46
|
+
data['title'] = i.xpath('title').text.strip
|
47
|
+
data['uuid'] = i.attr('uuid').strip
|
48
48
|
data_arr << data
|
49
49
|
}
|
50
50
|
data_arr.uniq
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
53
|
# Project
|
55
54
|
#
|
56
55
|
# @return [Array<Hash>]
|
@@ -74,41 +73,30 @@ module Puree
|
|
74
73
|
|
75
74
|
# Title
|
76
75
|
#
|
77
|
-
# @return [
|
76
|
+
# @return [String]
|
78
77
|
def title
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
data = data['localizedString']["__content__"]
|
83
|
-
data.is_a?(Array) ? data_arr = data : data_arr << data
|
84
|
-
end
|
85
|
-
data_arr.uniq
|
78
|
+
path = '//title/localizedString'
|
79
|
+
xpath_result = xpath_query path
|
80
|
+
xpath_result ? xpath_result.text.strip : ''
|
86
81
|
end
|
87
82
|
|
88
83
|
# Keyword
|
89
84
|
#
|
90
85
|
# @return [Array<String>]
|
91
86
|
def keyword
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
data = data['keywordGroup']['keyword']['userDefinedKeyword']['freeKeyword']
|
96
|
-
data.is_a?(Array) ? data_arr = data : data_arr << data
|
97
|
-
end
|
87
|
+
path = '//keywordGroups/keywordGroup/keyword/userDefinedKeyword/freeKeyword'
|
88
|
+
xpath_result = xpath_query path
|
89
|
+
data_arr = xpath_result.map { |i| i.text.strip }
|
98
90
|
data_arr.uniq
|
99
91
|
end
|
100
92
|
|
101
93
|
# Description
|
102
94
|
#
|
103
|
-
# @return [
|
95
|
+
# @return [String]
|
104
96
|
def description
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
data = data['classificationDefinedField']['value']['localizedString']['__content__'].tr("\n", '')
|
109
|
-
data.is_a?(Array) ? data_arr = data : data_arr << data
|
110
|
-
end
|
111
|
-
data_arr.uniq
|
97
|
+
path = '//descriptions/classificationDefinedField/value/localizedString'
|
98
|
+
xpath_result = xpath_query path
|
99
|
+
xpath_result ? xpath_result.text.strip : ''
|
112
100
|
end
|
113
101
|
|
114
102
|
# Person (internal, external, other)
|
@@ -130,11 +118,11 @@ module Puree
|
|
130
118
|
data.each do |d|
|
131
119
|
person = generic_person d
|
132
120
|
if d.key? 'person'
|
133
|
-
person['uuid'] = d['person']['uuid']
|
121
|
+
person['uuid'] = d['person']['uuid'].strip
|
134
122
|
internal_persons << person
|
135
123
|
end
|
136
124
|
if d.key? 'externalPerson'
|
137
|
-
person['uuid'] = d['externalPerson']['uuid']
|
125
|
+
person['uuid'] = d['externalPerson']['uuid'].strip
|
138
126
|
external_persons << person
|
139
127
|
end
|
140
128
|
if !d.key?('person') && !d.key?('externalPerson')
|
@@ -145,11 +133,11 @@ module Puree
|
|
145
133
|
when Hash
|
146
134
|
person = generic_person data
|
147
135
|
if data.key? 'person'
|
148
|
-
person['uuid'] = data['person']['uuid']
|
136
|
+
person['uuid'] = data['person']['uuid'].strip
|
149
137
|
internal_persons << person
|
150
138
|
end
|
151
139
|
if data.key? 'externalPerson'
|
152
|
-
person['uuid'] = data['externalPerson']['uuid']
|
140
|
+
person['uuid'] = data['externalPerson']['uuid'].strip
|
153
141
|
external_persons << person
|
154
142
|
end
|
155
143
|
if !data.key?('person') && !data.key?('externalPerson')
|
@@ -206,7 +194,7 @@ module Puree
|
|
206
194
|
# @return [String]
|
207
195
|
def access
|
208
196
|
data = node 'openAccessPermission'
|
209
|
-
!data.nil? && !data.empty? ? data['term']['localizedString']["__content__"] : ''
|
197
|
+
!data.nil? && !data.empty? ? data['term']['localizedString']["__content__"].strip : ''
|
210
198
|
end
|
211
199
|
|
212
200
|
|
@@ -214,41 +202,31 @@ module Puree
|
|
214
202
|
#
|
215
203
|
# @return [Array<Hash>]
|
216
204
|
def file
|
217
|
-
|
205
|
+
path = '//documents/document'
|
206
|
+
xpath_result = xpath_query path
|
218
207
|
|
219
208
|
docs = []
|
220
|
-
if !data.nil? && !data.empty?
|
221
|
-
# convert to array
|
222
|
-
data_arr = []
|
223
|
-
if data['document'].is_a?(Array)
|
224
|
-
data_arr = data['document']
|
225
|
-
else
|
226
|
-
data_arr << data['document']
|
227
|
-
end
|
228
209
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
end
|
249
|
-
docs << doc
|
210
|
+
xpath_result.each do |d|
|
211
|
+
doc = {}
|
212
|
+
# doc['id'] = f.xpath('id').text.strip
|
213
|
+
doc['name'] = d.xpath('fileName').text.strip
|
214
|
+
doc['mime'] = d.xpath('mimeType').text.strip
|
215
|
+
doc['size'] = d.xpath('size').text.strip
|
216
|
+
doc['url'] = d.xpath('url').text.strip
|
217
|
+
doc['title'] = d.xpath('title').text.strip
|
218
|
+
# doc['createdDate'] = d.xpath('createdDate').text.strip
|
219
|
+
# doc['visibleOnPortalDate'] = d.xpath('visibleOnPortalDate').text.strip
|
220
|
+
# doc['limitedVisibility'] = d.xpath('limitedVisibility').text.strip
|
221
|
+
|
222
|
+
license = {}
|
223
|
+
license_name = d.xpath('documentLicense/term/localizedString').text.strip
|
224
|
+
license['name'] = license_name
|
225
|
+
license_url = d.xpath('documentLicense/description/localizedString').text.strip
|
226
|
+
license['url'] = license_url
|
227
|
+
doc['license'] = license
|
228
|
+
docs << doc
|
250
229
|
|
251
|
-
end
|
252
230
|
end
|
253
231
|
docs.uniq
|
254
232
|
end
|
@@ -257,8 +235,9 @@ module Puree
|
|
257
235
|
#
|
258
236
|
# @return [String]
|
259
237
|
def doi
|
260
|
-
|
261
|
-
|
238
|
+
path = '//content/doi'
|
239
|
+
xpath_result = xpath_query path
|
240
|
+
xpath_result ? xpath_result.text.strip : ''
|
262
241
|
end
|
263
242
|
|
264
243
|
# def state
|
data/lib/puree/event.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
module Puree
|
2
|
+
|
3
|
+
# Event resource
|
4
|
+
#
|
5
|
+
class Event < Resource
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super(:event)
|
9
|
+
end
|
10
|
+
|
11
|
+
# City
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
def city
|
15
|
+
path = '//city'
|
16
|
+
xpath_query(path).text.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
# Country
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
def country
|
23
|
+
path = '//country/term/localizedString'
|
24
|
+
xpath_query(path).text.strip
|
25
|
+
end
|
26
|
+
|
27
|
+
# Date
|
28
|
+
#
|
29
|
+
# @return [Hash]
|
30
|
+
def date
|
31
|
+
data = {}
|
32
|
+
path = '//dateRange'
|
33
|
+
range = xpath_query path
|
34
|
+
data['start'] = range.xpath('startDate').text.strip
|
35
|
+
data['end'] = range.xpath('startDate').text.strip
|
36
|
+
data
|
37
|
+
end
|
38
|
+
|
39
|
+
# Description
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
def description
|
43
|
+
path = '//content/description'
|
44
|
+
xpath_query(path).text.strip
|
45
|
+
end
|
46
|
+
|
47
|
+
# Location
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
def location
|
51
|
+
path = '//location'
|
52
|
+
xpath_query(path).text.strip
|
53
|
+
end
|
54
|
+
|
55
|
+
# Title
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
def title
|
59
|
+
path = '//title/localizedString'
|
60
|
+
xpath_query(path).text.strip
|
61
|
+
end
|
62
|
+
|
63
|
+
# Type
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
def type
|
67
|
+
path = '//content/typeClassification/term/localizedString'
|
68
|
+
xpath_query(path).text.strip
|
69
|
+
end
|
70
|
+
|
71
|
+
# All metadata
|
72
|
+
#
|
73
|
+
# @return [Hash]
|
74
|
+
def metadata
|
75
|
+
o = {}
|
76
|
+
o['city'] = city
|
77
|
+
o['country'] = country
|
78
|
+
o['date'] = date
|
79
|
+
o['description'] = description
|
80
|
+
o['location'] = location
|
81
|
+
o['title'] = title
|
82
|
+
o['type'] = type
|
83
|
+
o
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
data/lib/puree/map.rb
CHANGED
data/lib/puree/organisation.rb
CHANGED
@@ -8,12 +8,75 @@ module Puree
|
|
8
8
|
super(:organisation)
|
9
9
|
end
|
10
10
|
|
11
|
+
# Address
|
12
|
+
#
|
13
|
+
# @return [Array<Hash>]
|
14
|
+
def address
|
15
|
+
path = '//addresses/classifiedAddress'
|
16
|
+
xpath_result = xpath_query path
|
17
|
+
|
18
|
+
data = []
|
19
|
+
|
20
|
+
xpath_result.each do |d|
|
21
|
+
o = {}
|
22
|
+
o['street'] = d.xpath('street').text.strip
|
23
|
+
o['building'] = d.xpath('building').text.strip
|
24
|
+
o['postcode'] = d.xpath('postalCode').text.strip
|
25
|
+
o['city'] = d.xpath('city').text.strip
|
26
|
+
o['country'] = d.xpath('country/term/localizedString').text.strip
|
27
|
+
data << o
|
28
|
+
end
|
29
|
+
data.uniq
|
30
|
+
end
|
31
|
+
|
32
|
+
# Email
|
33
|
+
#
|
34
|
+
# @return [Array<String>]
|
35
|
+
def email
|
36
|
+
path = '//emails/classificationDefinedStringFieldExtension/value'
|
37
|
+
xpath_result = xpath_query path
|
38
|
+
arr = []
|
39
|
+
xpath_result.each { |i| arr << i.text.strip }
|
40
|
+
arr.uniq
|
41
|
+
end
|
42
|
+
|
11
43
|
# Name
|
12
44
|
#
|
13
45
|
# @return [String]
|
14
46
|
def name
|
15
47
|
data = node 'name'
|
16
|
-
!data.nil? && !data.empty? ? data['localizedString']['__content__'] : ''
|
48
|
+
!data.nil? && !data.empty? ? data['localizedString']['__content__'].strip : ''
|
49
|
+
end
|
50
|
+
|
51
|
+
# Phone
|
52
|
+
#
|
53
|
+
# @return [Array<String>]
|
54
|
+
def phone
|
55
|
+
path = '//phoneNumbers/classificationDefinedStringFieldExtension/value'
|
56
|
+
xpath_result = xpath_query path
|
57
|
+
arr = []
|
58
|
+
xpath_result.each { |i| arr << i.text.strip }
|
59
|
+
arr.uniq
|
60
|
+
end
|
61
|
+
|
62
|
+
# Type
|
63
|
+
#
|
64
|
+
# @return [String]
|
65
|
+
def type
|
66
|
+
path = '//content/typeClassification/term/localizedString'
|
67
|
+
xpath_result = xpath_query path
|
68
|
+
xpath_result ? xpath_result.text.strip : ''
|
69
|
+
end
|
70
|
+
|
71
|
+
# URL
|
72
|
+
#
|
73
|
+
# @return [Array<String>]
|
74
|
+
def url
|
75
|
+
path = '//content/webAddresses/classificationDefinedFieldExtension/value/localizedString'
|
76
|
+
xpath_result = xpath_query path
|
77
|
+
arr = []
|
78
|
+
xpath_result.each { |i| arr << i.text.strip }
|
79
|
+
arr.uniq
|
17
80
|
end
|
18
81
|
|
19
82
|
# All metadata
|
@@ -21,7 +84,12 @@ module Puree
|
|
21
84
|
# @return [Hash]
|
22
85
|
def metadata
|
23
86
|
o = {}
|
87
|
+
o['address'] = address
|
88
|
+
o['email'] = email
|
24
89
|
o['name'] = name
|
90
|
+
o['phone'] = phone
|
91
|
+
o['type'] = type
|
92
|
+
o['url'] = url
|
25
93
|
o
|
26
94
|
end
|
27
95
|
|
data/lib/puree/person.rb
CHANGED
@@ -48,8 +48,8 @@ module Puree
|
|
48
48
|
data = node 'name'
|
49
49
|
o = {}
|
50
50
|
if !data.nil? && !data.empty?
|
51
|
-
o['first'] = data['firstName']
|
52
|
-
o['last'] = data['lastName']
|
51
|
+
o['first'] = data['firstName'].strip
|
52
|
+
o['last'] = data['lastName'].strip
|
53
53
|
end
|
54
54
|
o
|
55
55
|
end
|
@@ -59,7 +59,7 @@ module Puree
|
|
59
59
|
# @return [String]
|
60
60
|
def orcid
|
61
61
|
data = node 'orcid'
|
62
|
-
!data.nil? && !data.empty? ? data : ''
|
62
|
+
!data.nil? && !data.empty? ? data.strip : ''
|
63
63
|
end
|
64
64
|
|
65
65
|
# All metadata
|
data/lib/puree/publication.rb
CHANGED
@@ -10,13 +10,11 @@ module Puree
|
|
10
10
|
|
11
11
|
# Description
|
12
12
|
#
|
13
|
-
# @return [
|
13
|
+
# @return [String]
|
14
14
|
def description
|
15
15
|
path = '//abstract/localizedString'
|
16
16
|
xpath_result = xpath_query path
|
17
|
-
|
18
|
-
xpath_result.each { |i| data_arr << i.text }
|
19
|
-
data_arr.uniq
|
17
|
+
xpath_result ? xpath_result.text.strip : ''
|
20
18
|
end
|
21
19
|
|
22
20
|
# Digital Object Identifier
|
@@ -25,7 +23,7 @@ module Puree
|
|
25
23
|
def doi
|
26
24
|
path = '//doi'
|
27
25
|
xpath_result = xpath_query path
|
28
|
-
xpath_result ? xpath_result.text : ''
|
26
|
+
xpath_result ? xpath_result.text.strip : ''
|
29
27
|
end
|
30
28
|
|
31
29
|
# Supporting file
|
@@ -38,10 +36,10 @@ module Puree
|
|
38
36
|
xpath_result.each do |d|
|
39
37
|
doc = {}
|
40
38
|
# doc['id'] = d.xpath('id').text
|
41
|
-
doc['name'] = d.xpath('fileName').text
|
42
|
-
doc['mime'] = d.xpath('mimeType').text
|
43
|
-
doc['size'] = d.xpath('size').text
|
44
|
-
doc['url'] = d.xpath('url').text
|
39
|
+
doc['name'] = d.xpath('fileName').text.strip
|
40
|
+
doc['mime'] = d.xpath('mimeType').text.strip
|
41
|
+
doc['size'] = d.xpath('size').text.strip
|
42
|
+
doc['url'] = d.xpath('url').text.strip
|
45
43
|
docs << doc
|
46
44
|
end
|
47
45
|
docs.uniq
|
@@ -49,24 +47,20 @@ module Puree
|
|
49
47
|
|
50
48
|
# Title
|
51
49
|
#
|
52
|
-
# @return [
|
50
|
+
# @return [String]
|
53
51
|
def title
|
54
52
|
path = '//content/title'
|
55
53
|
xpath_result = xpath_query path
|
56
|
-
|
57
|
-
xpath_result.each { |i| data_arr << i.text }
|
58
|
-
data_arr.uniq
|
54
|
+
xpath_result ? xpath_result.text.strip : ''
|
59
55
|
end
|
60
56
|
|
61
57
|
# Subtitle
|
62
58
|
#
|
63
|
-
# @return [
|
59
|
+
# @return [String]
|
64
60
|
def subtitle
|
65
61
|
path = '//content/subtitle'
|
66
62
|
xpath_result = xpath_query path
|
67
|
-
|
68
|
-
xpath_result.each { |i| data_arr << i.text }
|
69
|
-
data_arr.uniq
|
63
|
+
xpath_result ? xpath_result.text.strip : ''
|
70
64
|
end
|
71
65
|
|
72
66
|
# All metadata
|
data/lib/puree/resource.rb
CHANGED
@@ -43,7 +43,11 @@ module Puree
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
begin
|
47
|
+
@response = HTTParty.get(build_url, query: query, headers: headers, timeout: 120)
|
48
|
+
rescue HTTParty::Error => e
|
49
|
+
puts 'HttParty::Error '+ e.message
|
50
|
+
end
|
47
51
|
|
48
52
|
if get_data?
|
49
53
|
response_name = service_response_name
|
@@ -111,7 +115,7 @@ module Puree
|
|
111
115
|
@api_map[:resource_type][resource_type][:response]
|
112
116
|
end
|
113
117
|
|
114
|
-
def
|
118
|
+
def build_url
|
115
119
|
service = service_name
|
116
120
|
if @options[:latest_api] === false
|
117
121
|
service_api_mode = service
|
data/lib/puree/version.rb
CHANGED
data/spec/dataset.rb
CHANGED
@@ -20,54 +20,75 @@ describe 'Dataset' do
|
|
20
20
|
uuid: uuid
|
21
21
|
end
|
22
22
|
|
23
|
-
it '#
|
24
|
-
expect(@p.
|
23
|
+
it '#access' do
|
24
|
+
expect(@p.access).to be_an_instance_of(String)
|
25
25
|
end
|
26
26
|
|
27
|
-
it '#
|
28
|
-
expect(@p.
|
27
|
+
it '#associated' do
|
28
|
+
expect(@p.associated).to be_an_instance_of(Array)
|
29
29
|
end
|
30
30
|
|
31
|
-
it '#
|
32
|
-
expect(@p.
|
31
|
+
it '#available' do
|
32
|
+
expect(@p.available).to be_an_instance_of(Hash)
|
33
33
|
end
|
34
34
|
|
35
|
-
it '#
|
36
|
-
expect(@p.
|
35
|
+
it '#description' do
|
36
|
+
expect(@p.description).to be_an_instance_of(String)
|
37
37
|
end
|
38
38
|
|
39
|
-
it '#
|
40
|
-
expect(@p.
|
39
|
+
it '#doi' do
|
40
|
+
expect(@p.doi).to be_an_instance_of(String)
|
41
41
|
end
|
42
42
|
|
43
|
-
it '#
|
44
|
-
expect(@p.
|
43
|
+
it '#file' do
|
44
|
+
expect(@p.file).to be_an_instance_of(Array)
|
45
45
|
end
|
46
46
|
|
47
47
|
it '#geographical' do
|
48
48
|
expect(@p.geographical).to be_an_instance_of(Array)
|
49
49
|
end
|
50
50
|
|
51
|
-
it '#
|
52
|
-
expect(@p.
|
51
|
+
it '#keyword' do
|
52
|
+
expect(@p.keyword).to be_an_instance_of(Array)
|
53
53
|
end
|
54
54
|
|
55
|
-
it '#
|
56
|
-
expect(@p.
|
55
|
+
it '#link' do
|
56
|
+
expect(@p.link).to be_an_instance_of(Array)
|
57
57
|
end
|
58
58
|
|
59
|
-
it '#
|
60
|
-
expect(@p.
|
59
|
+
it '#metadata' do
|
60
|
+
expect(@p.metadata).to be_an_instance_of(Hash)
|
61
61
|
end
|
62
62
|
|
63
|
-
it '#
|
64
|
-
expect(@p.
|
63
|
+
it '#person' do
|
64
|
+
expect(@p.person).to be_an_instance_of(Hash)
|
65
65
|
end
|
66
66
|
|
67
|
-
it '#
|
68
|
-
expect(@p.
|
67
|
+
it '#production' do
|
68
|
+
expect(@p.production).to be_an_instance_of(Hash)
|
69
|
+
end
|
70
|
+
|
71
|
+
it '#project' do
|
72
|
+
expect(@p.project).to be_an_instance_of(Array)
|
69
73
|
end
|
70
74
|
|
75
|
+
it '#publication' do
|
76
|
+
expect(@p.publication).to be_an_instance_of(Array)
|
77
|
+
end
|
78
|
+
|
79
|
+
it '#publisher' do
|
80
|
+
expect(@p.publisher).to be_an_instance_of(String)
|
81
|
+
end
|
82
|
+
|
83
|
+
it '#temporal' do
|
84
|
+
expect(@p.temporal).to be_an_instance_of(Hash)
|
85
|
+
end
|
86
|
+
|
87
|
+
it '#title' do
|
88
|
+
expect(@p.title).to be_an_instance_of(String)
|
89
|
+
end
|
90
|
+
|
91
|
+
|
71
92
|
end
|
72
93
|
|
73
94
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Albin-Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/puree/collection.rb
|
57
57
|
- lib/puree/dataset.rb
|
58
58
|
- lib/puree/date.rb
|
59
|
+
- lib/puree/event.rb
|
59
60
|
- lib/puree/journal.rb
|
60
61
|
- lib/puree/map.rb
|
61
62
|
- lib/puree/organisation.rb
|