puree 0.6.0 → 0.7.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 +5 -0
- data/lib/puree.rb +1 -0
- data/lib/puree/person.rb +33 -0
- data/lib/puree/resource.rb +9 -2
- data/lib/puree/version.rb +1 -1
- data/puree.gemspec +2 -3
- data/spec/spec_helper.rb +1 -0
- metadata +20 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7129e92fd2ea35a0f0fde2fbf9a205b4df5e3ad
|
4
|
+
data.tar.gz: 085ffa88bed9104eeb96e1ce0098c86d4da24ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a695d6a4a69ec49798dfb59199ea6f7f4bfc6d43976d8c0ff00965b88008289b236f3ab7294c55d874819e1bc2c2b2cbeaf6eb36c2a23c279adbe903808583
|
7
|
+
data.tar.gz: 7195777fc8b4ecd80b5ef5b448e5ba4a666ac58dc1e198788b37b21cda1b4003d1cfb02b046cb30f41437b4b292b55afc2fe1a7d17f6a6e674bdcde49cdec0cb
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
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.7.0 - 2016-05-10
|
6
|
+
### Added
|
7
|
+
- Person metadata (affiliation, orcid).
|
8
|
+
- Nokogiri.
|
9
|
+
|
5
10
|
## 0.6.0 - 2016-05-06
|
6
11
|
### Added
|
7
12
|
- API map factored out of Resource.
|
data/lib/puree.rb
CHANGED
data/lib/puree/person.rb
CHANGED
@@ -8,6 +8,39 @@ module Puree
|
|
8
8
|
super(:person)
|
9
9
|
end
|
10
10
|
|
11
|
+
# Affiliation
|
12
|
+
#
|
13
|
+
# @return [Array<String>]
|
14
|
+
def affiliation
|
15
|
+
path = '//organisation/name/localizedString'
|
16
|
+
xpath_result = xpath_doc.xpath path
|
17
|
+
affiliations = []
|
18
|
+
xpath_result.each { |i| affiliations << i.text }
|
19
|
+
return affiliations.uniq
|
20
|
+
end
|
21
|
+
|
22
|
+
# ORCID
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
def orcid
|
26
|
+
data = node 'orcid'
|
27
|
+
if !data.nil? && !data.empty?
|
28
|
+
!data.nil? && !data.empty? ? data : ''
|
29
|
+
else
|
30
|
+
''
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# All metadata
|
35
|
+
#
|
36
|
+
# @return [Hash]
|
37
|
+
def metadata
|
38
|
+
o = {}
|
39
|
+
o['affiliation'] = affiliation
|
40
|
+
o['orcid'] = orcid
|
41
|
+
o
|
42
|
+
end
|
43
|
+
|
11
44
|
end
|
12
45
|
|
13
46
|
end
|
data/lib/puree/resource.rb
CHANGED
@@ -88,10 +88,11 @@ module Puree
|
|
88
88
|
# Node
|
89
89
|
#
|
90
90
|
# @return [Hash]
|
91
|
-
def node(
|
92
|
-
@content ? @content
|
91
|
+
def node(*path)
|
92
|
+
@content ? @content.dig(*path) : {}
|
93
93
|
end
|
94
94
|
|
95
|
+
|
95
96
|
# Is there any data after get?
|
96
97
|
#
|
97
98
|
# @return [Boolean]
|
@@ -120,5 +121,11 @@ module Puree
|
|
120
121
|
@endpoint + '/' + service_api_mode
|
121
122
|
end
|
122
123
|
|
124
|
+
def xpath_doc
|
125
|
+
xml = @response.body
|
126
|
+
doc = Nokogiri::XML xml
|
127
|
+
doc.remove_namespaces!
|
128
|
+
end
|
129
|
+
|
123
130
|
end
|
124
131
|
end
|
data/lib/puree/version.rb
CHANGED
data/puree.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'httparty', '~> 0'
|
22
|
-
spec.
|
23
|
-
spec.add_development_dependency 'rake', '~> 0'
|
21
|
+
spec.add_runtime_dependency 'httparty', '~> 0.13', '>= 0.13.7'
|
22
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6', '>= 1.6.7.2'
|
24
23
|
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.7.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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -16,42 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.13'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.13.7
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
-
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
29
|
+
version: '0.13'
|
30
|
+
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.5'
|
32
|
+
version: 0.13.7
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
34
|
+
name: nokogiri
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
44
36
|
requirements:
|
45
37
|
- - "~>"
|
46
38
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
|
39
|
+
version: '1.6'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.6.7.2
|
43
|
+
type: :runtime
|
49
44
|
prerelease: false
|
50
45
|
version_requirements: !ruby/object:Gem::Requirement
|
51
46
|
requirements:
|
52
47
|
- - "~>"
|
53
48
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
49
|
+
version: '1.6'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.6.7.2
|
55
53
|
description: Consumes the Pure Research Information System API and facilitates post-processing
|
56
54
|
of metadata into simple data structures.
|
57
55
|
email:
|
@@ -103,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
101
|
version: '0'
|
104
102
|
requirements: []
|
105
103
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.5.1
|
107
105
|
signing_key:
|
108
106
|
specification_version: 4
|
109
107
|
summary: A client for the Pure Research Information System API.
|