puree 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 589862f38fbdf73c8255cfd00e51191fbbdde42a
4
- data.tar.gz: 146680ea5def8f36b7a4bc377413949e2c244de4
3
+ metadata.gz: c7129e92fd2ea35a0f0fde2fbf9a205b4df5e3ad
4
+ data.tar.gz: 085ffa88bed9104eeb96e1ce0098c86d4da24ae5
5
5
  SHA512:
6
- metadata.gz: 9728d190508de23b7b08e3fb0094700f9ec190b40573d32dd8740fad263fca7447b3ff169b89eff6831dc2cf933a3cc2224e6947601610d31c203ffff615018e
7
- data.tar.gz: 470051d32055bbd820d7e44a3d931a48419a087cad860a8522c890c8e58a16321fbe60167609f25d528c38b7c8813ae764df6f037c5b4315d61c48c2abeac85f
6
+ metadata.gz: 34a695d6a4a69ec49798dfb59199ea6f7f4bfc6d43976d8c0ff00965b88008289b236f3ab7294c55d874819e1bc2c2b2cbeaf6eb36c2a23c279adbe903808583
7
+ data.tar.gz: 7195777fc8b4ecd80b5ef5b448e5ba4a666ac58dc1e198788b37b21cda1b4003d1cfb02b046cb30f41437b4b292b55afc2fe1a7d17f6a6e674bdcde49cdec0cb
@@ -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.
@@ -1,4 +1,5 @@
1
1
  require 'httparty'
2
+ require 'nokogiri'
2
3
  require 'puree/date'
3
4
  require 'puree/map'
4
5
  require 'puree/resource'
@@ -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
@@ -88,10 +88,11 @@ module Puree
88
88
  # Node
89
89
  #
90
90
  # @return [Hash]
91
- def node(name)
92
- @content ? @content[name] : {}
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
@@ -1,3 +1,3 @@
1
1
  module Puree
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -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.add_development_dependency "bundler", "~> 1.5"
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
@@ -1,4 +1,5 @@
1
1
  require 'httparty'
2
+ require 'nokogiri'
2
3
  require 'puree/date'
3
4
  require 'puree/map'
4
5
  require 'puree/resource'
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.6.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-06 00:00:00.000000000 Z
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
- - !ruby/object:Gem::Dependency
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: '1.5'
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: rake
34
+ name: nokogiri
43
35
  requirement: !ruby/object:Gem::Requirement
44
36
  requirements:
45
37
  - - "~>"
46
38
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
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: '0'
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.2.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.