puree 0.8.0 → 0.9.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: f8bc93ad5800cd2505cfb1e29dd1297e24f1314e
4
- data.tar.gz: 69057fe1977ca9ba0918ec9df90a0ad0459730df
3
+ metadata.gz: e16d74fee89f71aae7593434a3bb8041e6ae9451
4
+ data.tar.gz: 2180947af2af6b771305ac16712f447721f23f63
5
5
  SHA512:
6
- metadata.gz: e8419dade2d8cfa512fcb0afabe4c9c5db592d13c70e634272f39f945eb8a1ee66796dd1cf663294fd7b85454cb754fd5a2faf3113c2219a36542587fa4457f6
7
- data.tar.gz: 5466e882728576e0a1ae1ab2267a9b4fa1ff9771badab46b33ed9cc63d242f5cb6524ef9e21dbdce7b8ab40164704fb2bed1c09fbc973ea06c671f495e7d5bd3
6
+ metadata.gz: f56565ef90e7d266adf52c7f6a346e7e7d885e25f42064353f8b2840d6c31654d044e98d0a48f8cb677fb94f35ad47cfb26488b7db0b562cdbfe530bc93a3a6f
7
+ data.tar.gz: 360d2d041c5bb2c71739a245c4cfea4059c41c274cee2cae1289e3775bb9ab98c55297e59702e32137300e47da696d6cc17b5dd89fc4dcec261e766de46b2e47
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
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.9.0 - 2016-05-16
6
+ ### Added
7
+ - Dataset metadata (production).
8
+ - Organisation metadata (name).
9
+ - Person metadata (image, keyword, name).
10
+
5
11
  ## 0.8.0 - 2016-05-11
6
12
  ### Added
7
13
  - Publication metadata (description, doi, file, subtitle, title).
data/README.md CHANGED
@@ -40,17 +40,18 @@ d.get uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx',
40
40
  password: password
41
41
 
42
42
  # Filter metadata into simple data structures
43
- d.title
43
+ d.access
44
+ d.available
44
45
  d.description
46
+ d.doi
47
+ d.file
48
+ d.geographical
45
49
  d.keyword
46
50
  d.person
47
- d.temporal
48
- d.geographical
49
- d.file
51
+ d.production
50
52
  d.publication
51
- d.available
52
- d.access
53
- d.doi
53
+ d.temporal
54
+ d.title
54
55
 
55
56
  # Combine metadata into one simple data structure
56
57
  d.metadata
@@ -221,6 +222,7 @@ Resource metadata
221
222
 
222
223
  ```ruby
223
224
  :dataset
225
+ :organisation
224
226
  :person
225
227
  :publication
226
228
  ```
@@ -229,10 +231,7 @@ Resource metadata (single hash only)
229
231
 
230
232
  ```ruby
231
233
  :journal
232
- :organisation
233
- :person
234
234
  :project
235
- :publication
236
235
  :publisher
237
236
  ```
238
237
 
data/lib/puree/dataset.rb CHANGED
@@ -135,6 +135,14 @@ module Puree
135
135
  end
136
136
  end
137
137
 
138
+ # Date of data production
139
+ #
140
+ # @return [Hash]
141
+ def production
142
+ data = node('dateOfDataProduction')
143
+ Puree::Date.normalise(data)
144
+ end
145
+
138
146
  # Temporal coverage
139
147
  #
140
148
  # @return [Hash]
@@ -224,20 +232,23 @@ module Puree
224
232
  # @return [Hash]
225
233
  def metadata
226
234
  o = {}
227
- o['title'] = title
235
+ o['access'] = access
236
+ o['available'] = available
228
237
  o['description'] = description
238
+ o['doi'] = doi
239
+ o['file'] = file
240
+ o['geographical'] = geographical
229
241
  o['keyword'] = keyword
230
242
  o['person'] = person
231
- o['temporal'] = temporal
232
- o['geographical'] = geographical
233
- o['file'] = file
243
+ o['production'] = production
234
244
  o['publication'] = publication
235
- o['available'] = available
236
- o['access'] = access
237
- o['doi'] = doi
245
+ o['temporal'] = temporal
246
+ o['title'] = title
238
247
  o
239
248
  end
240
249
 
250
+
251
+
241
252
  private
242
253
 
243
254
  # Assembles basic information about a person
data/lib/puree/map.rb CHANGED
@@ -16,8 +16,7 @@ module Puree
16
16
  resource_type: {
17
17
  dataset: {
18
18
  service: 'datasets',
19
- response: 'GetDataSetsResponse',
20
- xpath: nil
19
+ response: 'GetDataSetsResponse'
21
20
  }
22
21
  }
23
22
  }
@@ -40,7 +39,6 @@ module Puree
40
39
  resource_type = {}
41
40
  resource_type[:service] = c
42
41
  resource_type[:response] = 'Get' + c.capitalize + 'Response'
43
- resource_type[:xpath] = nil
44
42
  @api_map[:resource_type][c.to_sym] = resource_type
45
43
  end
46
44
  end
@@ -8,6 +8,23 @@ module Puree
8
8
  super(:organisation)
9
9
  end
10
10
 
11
+ # Name
12
+ #
13
+ # @return [String]
14
+ def name
15
+ data = node 'name'
16
+ !data.nil? && !data.empty? ? data['localizedString']['__content__'] : ''
17
+ end
18
+
19
+ # All metadata
20
+ #
21
+ # @return [Hash]
22
+ def metadata
23
+ o = {}
24
+ o['name'] = name
25
+ o
26
+ end
27
+
11
28
  end
12
29
 
13
30
  end
data/lib/puree/person.rb CHANGED
@@ -19,16 +19,47 @@ module Puree
19
19
  return affiliations.uniq
20
20
  end
21
21
 
22
+ # Image
23
+ #
24
+ # @return [Array<String>]
25
+ def image
26
+ path = '//photos/file/url'
27
+ xpath_result = xpath_query path
28
+ data = []
29
+ xpath_result.each { |i| data << i.text }
30
+ data.uniq
31
+ end
32
+
33
+ # Keyword
34
+ #
35
+ # @return [Array<String>]
36
+ def keyword
37
+ path = '//keywordGroup/keyword/userDefinedKeyword/freeKeyword'
38
+ xpath_result = xpath_query path
39
+ data = []
40
+ xpath_result.each { |i| data << i.text }
41
+ return data.uniq
42
+ end
43
+
44
+ # Name
45
+ #
46
+ # @return [Hash]
47
+ def name
48
+ data = node 'name'
49
+ o = {}
50
+ if !data.nil? && !data.empty?
51
+ o['first'] = data['firstName']
52
+ o['last'] = data['lastName']
53
+ end
54
+ o
55
+ end
56
+
22
57
  # ORCID
23
58
  #
24
59
  # @return [String]
25
60
  def orcid
26
61
  data = node 'orcid'
27
- if !data.nil? && !data.empty?
28
- !data.nil? && !data.empty? ? data : ''
29
- else
30
- ''
31
- end
62
+ !data.nil? && !data.empty? ? data : ''
32
63
  end
33
64
 
34
65
  # All metadata
@@ -37,6 +68,9 @@ module Puree
37
68
  def metadata
38
69
  o = {}
39
70
  o['affiliation'] = affiliation
71
+ o['image'] = image
72
+ o['keyword'] = keyword
73
+ o['name'] = name
40
74
  o['orcid'] = orcid
41
75
  o
42
76
  end
data/lib/puree/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Puree
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.0
4
+ version: 0.9.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 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.5.1
92
+ rubygems_version: 2.2.2
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: A client for the Pure Research Information System API.