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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6feda420454c2b733f415194279bfda4d17d191
4
- data.tar.gz: 383112b4f6f4d95400d94fbbcb648e8cfc3eba58
3
+ metadata.gz: 8e8e3d618d4573ec565f88c56bdcc6c26db76a0d
4
+ data.tar.gz: 469f6ac49d1b8359f5199fb5f5d1c77c7f61ba78
5
5
  SHA512:
6
- metadata.gz: 1e557f054b3c8e1f92cdc61bda7432a0c0286f6facdd26f6e1e72f93d83e0c733fa2731dff3395ec1cbf41395e8ccae5007052b19b44290098e855c1e0685412
7
- data.tar.gz: ac9f865fdc1dec1dcba40858e40838ea3741160e4bc4db039694e4dd23b2ea5d9131404b90438c50c51be2f6c1e926565c43175d758be07b910e74f6005d6d43
6
+ metadata.gz: d2bd320fcca56cd78069f2c22eead8284aa71bf5d25f573d2aaf92a9a36eb5fce2f70bd4a9e6cd3e0a0f743d8c642d1b14768529713316e36e9a8478edaa5511
7
+ data.tar.gz: 9e1c28522ee527b73127349f0fb8224e65583604b0d56750849a36e3ec30ab2e5d8d774a756b6866437ad09855de307b89d40a3178bba94b2da00302bece4b78
@@ -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.
@@ -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
- 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
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 => ' ')
@@ -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
@@ -13,7 +13,7 @@ module Puree
13
13
  base_url: base_url,
14
14
  username: username,
15
15
  password: password,
16
- bleeding: false,
16
+ bleeding: false, # stable API does not return person roles
17
17
  basic_auth: basic_auth)
18
18
  end
19
19
 
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Puree
2
2
  # Semantic version number
3
3
  #
4
- VERSION = "0.19.2"
4
+ VERSION = "0.20.0"
5
5
  end
@@ -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
@@ -52,6 +52,10 @@ describe 'Event' do
52
52
  expect(@p.location).to be_an_instance_of(String)
53
53
  end
54
54
 
55
+ it '#locale' do
56
+ expect(@p.locale).to be_an_instance_of(String)
57
+ end
58
+
55
59
  it '#metadata' do
56
60
  expect(@p.metadata).to be_an_instance_of(Hash)
57
61
  end
@@ -36,6 +36,10 @@ describe 'Journal' do
36
36
  expect(@p.issn).to be_an_instance_of(String)
37
37
  end
38
38
 
39
+ it '#locale' do
40
+ expect(@p.locale).to be_an_instance_of(String)
41
+ end
42
+
39
43
  it '#metadata' do
40
44
  expect(@p.metadata).to be_an_instance_of(Hash)
41
45
  end
@@ -40,6 +40,10 @@ describe 'Organisation' do
40
40
  expect(@p.email).to be_an_instance_of(Array)
41
41
  end
42
42
 
43
+ it '#locale' do
44
+ expect(@p.locale).to be_an_instance_of(String)
45
+ end
46
+
43
47
  it '#metadata' do
44
48
  expect(@p.metadata).to be_an_instance_of(Hash)
45
49
  end
@@ -48,6 +48,10 @@ describe 'Person' do
48
48
  expect(@p.keyword).to be_an_instance_of(Array)
49
49
  end
50
50
 
51
+ it '#locale' do
52
+ expect(@p.locale).to be_an_instance_of(String)
53
+ end
54
+
51
55
  it '#metadata' do
52
56
  expect(@p.metadata).to be_an_instance_of(Hash)
53
57
  end
@@ -40,6 +40,10 @@ describe 'Project' do
40
40
  expect(@p.description).to be_an_instance_of(String)
41
41
  end
42
42
 
43
+ it '#locale' do
44
+ expect(@p.locale).to be_an_instance_of(String)
45
+ end
46
+
43
47
  it '#metadata' do
44
48
  expect(@p.metadata).to be_an_instance_of(Hash)
45
49
  end
@@ -52,6 +52,10 @@ describe 'Publication' do
52
52
  expect(@p.file).to be_an_instance_of(Array)
53
53
  end
54
54
 
55
+ it '#locale' do
56
+ expect(@p.locale).to be_an_instance_of(String)
57
+ end
58
+
55
59
  it '#metadata' do
56
60
  expect(@p.metadata).to be_an_instance_of(Hash)
57
61
  end
@@ -32,6 +32,10 @@ describe 'Publisher' do
32
32
  expect(@p.created).to be_an_instance_of(String)
33
33
  end
34
34
 
35
+ it '#locale' do
36
+ expect(@p.locale).to be_an_instance_of(String)
37
+ end
38
+
35
39
  it '#metadata' do
36
40
  expect(@p.metadata).to be_an_instance_of(Hash)
37
41
  end
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.19.2
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-01-27 00:00:00.000000000 Z
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/collection.rb
75
- - spec/dataset.rb
76
- - spec/download.rb
77
- - spec/event.rb
78
- - spec/journal.rb
79
- - spec/organisation.rb
80
- - spec/person.rb
81
- - spec/project.rb
82
- - spec/publication.rb
83
- - spec/publisher.rb
84
- - spec/server.rb
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/collection.rb
112
- - spec/dataset.rb
113
- - spec/download.rb
114
- - spec/event.rb
115
- - spec/journal.rb
116
- - spec/organisation.rb
117
- - spec/person.rb
118
- - spec/project.rb
119
- - spec/publication.rb
120
- - spec/publisher.rb
121
- - spec/server.rb
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: