puree 0.19.2 → 0.20.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 +8 -0
- data/lib/puree/collection.rb +16 -8
- data/lib/puree/dataset.rb +22 -1
- data/lib/puree/project.rb +1 -1
- data/lib/puree/resource.rb +14 -0
- data/lib/puree/version.rb +1 -1
- data/spec/{collection.rb → collection_spec.rb} +0 -0
- data/spec/{dataset.rb → dataset_spec.rb} +8 -0
- data/spec/{download.rb → download_spec.rb} +0 -0
- data/spec/{event.rb → event_spec.rb} +4 -0
- data/spec/{journal.rb → journal_spec.rb} +4 -0
- data/spec/{organisation.rb → organisation_spec.rb} +4 -0
- data/spec/{person.rb → person_spec.rb} +4 -0
- data/spec/{project.rb → project_spec.rb} +4 -0
- data/spec/{publication.rb → publication_spec.rb} +4 -0
- data/spec/{publisher.rb → publisher_spec.rb} +4 -0
- data/spec/{server.rb → server_spec.rb} +0 -0
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8e3d618d4573ec565f88c56bdcc6c26db76a0d
|
4
|
+
data.tar.gz: 469f6ac49d1b8359f5199fb5f5d1c77c7f61ba78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2bd320fcca56cd78069f2c22eead8284aa71bf5d25f573d2aaf92a9a36eb5fce2f70bd4a9e6cd3e0a0f743d8c642d1b14768529713316e36e9a8478edaa5511
|
7
|
+
data.tar.gz: 9e1c28522ee527b73127349f0fb8224e65583604b0d56750849a36e3ec30ab2e5d8d774a756b6866437ad09855de307b89d40a3178bba94b2da00302bece4b78
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
- Factory to make resource objects?
|
8
8
|
- Make ALL dates ISO 8601 YYYY-MM-DD, rather than mirror varying formats from Pure?
|
9
9
|
|
10
|
+
## 0.20.0 - 2017-02-03
|
11
|
+
### Added
|
12
|
+
- Dataset - spatial_point.
|
13
|
+
- Resource subclasses - locale.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Collection - array of instances.
|
17
|
+
|
10
18
|
## 0.19.2 - 2017-01-27
|
11
19
|
### Fixed
|
12
20
|
- Dataset - production, temporal extraction.
|
data/lib/puree/collection.rb
CHANGED
@@ -182,17 +182,25 @@ module Puree
|
|
182
182
|
data = []
|
183
183
|
resource_class = 'Puree::' + @resource_type.to_s.capitalize
|
184
184
|
|
185
|
-
if @options[:basic_auth] === true
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
else
|
191
|
-
|
192
|
-
end
|
185
|
+
# if @options[:basic_auth] === true
|
186
|
+
# r = Object.const_get(resource_class).new base_url: @base_url,
|
187
|
+
# username: @username,
|
188
|
+
# password: @password,
|
189
|
+
# basic_auth: true
|
190
|
+
# else
|
191
|
+
# r = Object.const_get(resource_class).new base_url: @base_url
|
192
|
+
# end
|
193
193
|
# whitelist symbol
|
194
194
|
if @api_map[:resource_type].has_key?(@resource_type)
|
195
195
|
uuid.each do |u|
|
196
|
+
if @options[:basic_auth] === true
|
197
|
+
r = Object.const_get(resource_class).new base_url: @base_url,
|
198
|
+
username: @username,
|
199
|
+
password: @password,
|
200
|
+
basic_auth: true
|
201
|
+
else
|
202
|
+
r = Object.const_get(resource_class).new base_url: @base_url
|
203
|
+
end
|
196
204
|
record = r.find uuid: u,
|
197
205
|
rendering: @options[:record_rendering]
|
198
206
|
# puts JSON.pretty_generate( record, :indent => ' ')
|
data/lib/puree/dataset.rb
CHANGED
@@ -121,13 +121,20 @@ module Puree
|
|
121
121
|
@metadata['publisher']
|
122
122
|
end
|
123
123
|
|
124
|
-
# Spatial coverage
|
124
|
+
# Spatial coverage (place names)
|
125
125
|
#
|
126
126
|
# @return [Array<String>]
|
127
127
|
def spatial
|
128
128
|
@metadata['spatial']
|
129
129
|
end
|
130
130
|
|
131
|
+
# Spatial coverage point
|
132
|
+
#
|
133
|
+
# @return [Hash]
|
134
|
+
def spatial_point
|
135
|
+
@metadata['spatial_point']
|
136
|
+
end
|
137
|
+
|
131
138
|
# Temporal coverage
|
132
139
|
#
|
133
140
|
# @return [Hash]
|
@@ -335,6 +342,7 @@ module Puree
|
|
335
342
|
end
|
336
343
|
|
337
344
|
def extract_spatial
|
345
|
+
# Data from free-form text box
|
338
346
|
path = '/geographicalCoverage/localizedString'
|
339
347
|
xpath_result = xpath_query path
|
340
348
|
data = []
|
@@ -344,6 +352,18 @@ module Puree
|
|
344
352
|
data
|
345
353
|
end
|
346
354
|
|
355
|
+
def extract_spatial_point
|
356
|
+
path = '/geoLocation/point'
|
357
|
+
xpath_result = xpath_query path
|
358
|
+
o = {}
|
359
|
+
if !xpath_result[0].nil?
|
360
|
+
arr = xpath_result.text.split(',')
|
361
|
+
o['latitude'] = arr[0].strip.to_f
|
362
|
+
o['longitude'] = arr[1].strip.to_f
|
363
|
+
end
|
364
|
+
o
|
365
|
+
end
|
366
|
+
|
347
367
|
def extract_temporal
|
348
368
|
temporal_range 'temporalCoverageStartDate', 'temporalCoverageEndDate'
|
349
369
|
end
|
@@ -377,6 +397,7 @@ module Puree
|
|
377
397
|
o['publication'] = extract_publication
|
378
398
|
o['publisher'] = extract_publisher
|
379
399
|
o['spatial'] = extract_spatial
|
400
|
+
o['spatial_point'] = extract_spatial_point
|
380
401
|
o['temporal'] = extract_temporal
|
381
402
|
o['title'] = extract_title
|
382
403
|
@metadata = o
|
data/lib/puree/project.rb
CHANGED
data/lib/puree/resource.rb
CHANGED
@@ -119,6 +119,13 @@ module Puree
|
|
119
119
|
@metadata['modified']
|
120
120
|
end
|
121
121
|
|
122
|
+
# Locale (e.g. en-GB)
|
123
|
+
#
|
124
|
+
# @return [String]
|
125
|
+
def locale
|
126
|
+
@metadata['locale']
|
127
|
+
end
|
128
|
+
|
122
129
|
# Set content from XML. In order for metadata extraction to work, the XML must have
|
123
130
|
# been retrieved using the .current version of the Pure API endpoints
|
124
131
|
#
|
@@ -154,6 +161,12 @@ module Puree
|
|
154
161
|
xpath_query_for_single_value path
|
155
162
|
end
|
156
163
|
|
164
|
+
def extract_locale
|
165
|
+
path = '/@locale'
|
166
|
+
str = xpath_query_for_single_value path
|
167
|
+
str.gsub('_','-')
|
168
|
+
end
|
169
|
+
|
157
170
|
# All metadata
|
158
171
|
#
|
159
172
|
# @return [Hash]
|
@@ -162,6 +175,7 @@ module Puree
|
|
162
175
|
o['uuid'] = extract_uuid
|
163
176
|
o['created'] = extract_created
|
164
177
|
o['modified'] = extract_modified
|
178
|
+
o['locale'] = extract_locale
|
165
179
|
o
|
166
180
|
end
|
167
181
|
|
data/lib/puree/version.rb
CHANGED
File without changes
|
@@ -64,6 +64,10 @@ describe 'Dataset' do
|
|
64
64
|
expect(@p.link).to be_an_instance_of(Array)
|
65
65
|
end
|
66
66
|
|
67
|
+
it '#locale' do
|
68
|
+
expect(@p.locale).to be_an_instance_of(String)
|
69
|
+
end
|
70
|
+
|
67
71
|
it '#metadata' do
|
68
72
|
expect(@p.metadata).to be_an_instance_of(Hash)
|
69
73
|
end
|
@@ -100,6 +104,10 @@ describe 'Dataset' do
|
|
100
104
|
expect(@p.spatial).to be_an_instance_of(Array)
|
101
105
|
end
|
102
106
|
|
107
|
+
it '#spatial_point' do
|
108
|
+
expect(@p.spatial_point).to be_an_instance_of(Hash)
|
109
|
+
end
|
110
|
+
|
103
111
|
it '#temporal' do
|
104
112
|
expect(@p.temporal).to be_an_instance_of(Hash)
|
105
113
|
end
|
File without changes
|
File without changes
|
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.20.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: 2017-
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -71,17 +71,17 @@ files:
|
|
71
71
|
- lib/puree/server.rb
|
72
72
|
- lib/puree/version.rb
|
73
73
|
- puree.gemspec
|
74
|
-
- spec/
|
75
|
-
- spec/
|
76
|
-
- spec/
|
77
|
-
- spec/
|
78
|
-
- spec/
|
79
|
-
- spec/
|
80
|
-
- spec/
|
81
|
-
- spec/
|
82
|
-
- spec/
|
83
|
-
- spec/
|
84
|
-
- spec/
|
74
|
+
- spec/collection_spec.rb
|
75
|
+
- spec/dataset_spec.rb
|
76
|
+
- spec/download_spec.rb
|
77
|
+
- spec/event_spec.rb
|
78
|
+
- spec/journal_spec.rb
|
79
|
+
- spec/organisation_spec.rb
|
80
|
+
- spec/person_spec.rb
|
81
|
+
- spec/project_spec.rb
|
82
|
+
- spec/publication_spec.rb
|
83
|
+
- spec/publisher_spec.rb
|
84
|
+
- spec/server_spec.rb
|
85
85
|
- spec/spec_helper.rb
|
86
86
|
homepage: https://aalbinclark.gitbooks.io/puree
|
87
87
|
licenses:
|
@@ -108,16 +108,16 @@ signing_key:
|
|
108
108
|
specification_version: 4
|
109
109
|
summary: A client for the Pure Research Information System API.
|
110
110
|
test_files:
|
111
|
-
- spec/
|
112
|
-
- spec/
|
113
|
-
- spec/
|
114
|
-
- spec/
|
115
|
-
- spec/
|
116
|
-
- spec/
|
117
|
-
- spec/
|
118
|
-
- spec/
|
119
|
-
- spec/
|
120
|
-
- spec/
|
121
|
-
- spec/
|
111
|
+
- spec/collection_spec.rb
|
112
|
+
- spec/dataset_spec.rb
|
113
|
+
- spec/download_spec.rb
|
114
|
+
- spec/event_spec.rb
|
115
|
+
- spec/journal_spec.rb
|
116
|
+
- spec/organisation_spec.rb
|
117
|
+
- spec/person_spec.rb
|
118
|
+
- spec/project_spec.rb
|
119
|
+
- spec/publication_spec.rb
|
120
|
+
- spec/publisher_spec.rb
|
121
|
+
- spec/server_spec.rb
|
122
122
|
- spec/spec_helper.rb
|
123
123
|
has_rdoc:
|