puree 0.11.0 → 0.12.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: 5010e60daa336c9d45804049400f946af67d8d9e
4
- data.tar.gz: 9c6d97bce8924ad81b3213c9066b344f268811ea
3
+ metadata.gz: a22ff7fedfd49fa3ae29510a7aa3fd532e3c9838
4
+ data.tar.gz: c879d11f1bf415b156e4959be2dde9119574d962
5
5
  SHA512:
6
- metadata.gz: 1f15e9d9255f39007b9f1659c2210cfc061298b9e33d0df8fa67bea84a8ecb0d37f5f0de20816fc2da8c97d7c650f613d6afc8fdced6bc7700621b77a376a971
7
- data.tar.gz: 2ce7fb3d3b2a7727fc8fea763e901fcc70c50daf04ab701df90be6e63f65fdf0c3628b53e28a8068a5b48cc6a056bc94fcdfe4a321717dbe5a41b4873d83eb2d
6
+ metadata.gz: e3ca6c455e0773a642bd5ad0bc513dc2a940ddc7c081be05deb0bc6ccd63e11789374a0ad70a12ad4caf8eaacff3d3ececb12fcedebe966880fa01cb6a176289
7
+ data.tar.gz: cc3a510f29157231b12cb3f47b4b9790638d721583769358b236b45854b98f9d9a9f1ab895d855fd21233494b06520f3c09e7e07ebea9c79fd3223adc763daef
@@ -2,6 +2,10 @@
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.12.0 - 2016-05-20
6
+ ### Added
7
+ - Resource (created, modified, uuid).
8
+
5
9
  ## 0.11.0 - 2016-05-19
6
10
  ### Added
7
11
  - Event metadata (city, country, date, description, location, title, type).
data/README.md CHANGED
@@ -43,12 +43,14 @@ d.get uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx',
43
43
  d.access
44
44
  d.associated
45
45
  d.available
46
+ d.created
46
47
  d.description
47
48
  d.doi
48
49
  d.file
49
50
  d.geographical
50
51
  d.keyword
51
52
  d.link
53
+ d.modified
52
54
  d.person
53
55
  d.production
54
56
  d.project
@@ -94,10 +96,11 @@ uuids.each do |uuid|
94
96
  end
95
97
  ```
96
98
 
99
+ ## Data structures
97
100
 
98
- ## Dataset data structures
101
+ ### Dataset
99
102
 
100
- ### available
103
+ #### available
101
104
  Date made available. If year is present, month and day will have data or an empty string.
102
105
 
103
106
  ```ruby
@@ -108,7 +111,7 @@ Date made available. If year is present, month and day will have data or an empt
108
111
  }
109
112
  ```
110
113
 
111
- ### file
114
+ #### file
112
115
  An array of files.
113
116
 
114
117
  ```ruby
@@ -127,7 +130,7 @@ An array of files.
127
130
  ]
128
131
  ```
129
132
 
130
- ### link
133
+ #### link
131
134
  An array of links.
132
135
 
133
136
  ```ruby
@@ -139,7 +142,7 @@ An array of links.
139
142
  ]
140
143
  ```
141
144
 
142
- ### person
145
+ #### person
143
146
  Contains an array of internal persons, an array of external persons and an array of other persons.
144
147
 
145
148
  ```ruby
@@ -167,7 +170,7 @@ Contains an array of internal persons, an array of external persons and an array
167
170
  }
168
171
  ```
169
172
 
170
- ### project
173
+ #### project
171
174
  An array of projects associated with the dataset.
172
175
 
173
176
  ```ruby
@@ -179,7 +182,7 @@ An array of projects associated with the dataset.
179
182
  ]
180
183
  ```
181
184
 
182
- ### publication
185
+ #### publication
183
186
  An array of research outputs associated with the dataset.
184
187
 
185
188
  ```ruby
@@ -217,7 +220,7 @@ An array of research outputs associated with the dataset.
217
220
  ]
218
221
  ```
219
222
 
220
- ### production, temporal
223
+ #### production, temporal
221
224
  Date range. If year is present, month and day will have data or an empty string.
222
225
 
223
226
  ```ruby
@@ -235,9 +238,9 @@ Date range. If year is present, month and day will have data or an empty string.
235
238
  }
236
239
  ```
237
240
 
238
- ## Organisation data structures
241
+ ### Organisation
239
242
 
240
- ### address
243
+ #### address
241
244
  An array of addresses.
242
245
 
243
246
  ```ruby
@@ -252,9 +255,9 @@ An array of addresses.
252
255
  ]
253
256
  ```
254
257
 
255
- ## Publication data structures
258
+ ### Publication
256
259
 
257
- ### file
260
+ #### file
258
261
  An array of files.
259
262
 
260
263
  ```ruby
@@ -306,7 +309,7 @@ Resource metadata
306
309
  :publication
307
310
  ```
308
311
 
309
- Resource metadata (single hash only)
312
+ Resource metadata (system data and single hash only)
310
313
 
311
314
  ```ruby
312
315
  :journal
@@ -13,7 +13,7 @@ module Puree
13
13
  # @return [Array<Hash>]
14
14
  def link
15
15
  path = '//links/link'
16
- xpath_result = xpath_query path
16
+ xpath_result = xpath_query path
17
17
  data = []
18
18
  xpath_result.each { |i|
19
19
  o = {}
@@ -29,7 +29,7 @@ module Puree
29
29
  # @return [String]
30
30
  def publisher
31
31
  path = '//publisher/name'
32
- xpath_result = xpath_query path
32
+ xpath_result = xpath_query path
33
33
  xpath_result ? xpath_result.text.strip : ''
34
34
  end
35
35
 
@@ -76,7 +76,7 @@ module Puree
76
76
  # @return [String]
77
77
  def title
78
78
  path = '//title/localizedString'
79
- xpath_result = xpath_query path
79
+ xpath_result = xpath_query path
80
80
  xpath_result ? xpath_result.text.strip : ''
81
81
  end
82
82
 
@@ -95,7 +95,7 @@ module Puree
95
95
  # @return [String]
96
96
  def description
97
97
  path = '//descriptions/classificationDefinedField/value/localizedString'
98
- xpath_result = xpath_query path
98
+ xpath_result = xpath_query path
99
99
  xpath_result ? xpath_result.text.strip : ''
100
100
  end
101
101
 
@@ -203,7 +203,7 @@ module Puree
203
203
  # @return [Array<Hash>]
204
204
  def file
205
205
  path = '//documents/document'
206
- xpath_result = xpath_query path
206
+ xpath_result = xpath_query path
207
207
 
208
208
  docs = []
209
209
 
@@ -236,7 +236,7 @@ module Puree
236
236
  # @return [String]
237
237
  def doi
238
238
  path = '//content/doi'
239
- xpath_result = xpath_query path
239
+ xpath_result = xpath_query path
240
240
  xpath_result ? xpath_result.text.strip : ''
241
241
  end
242
242
 
@@ -250,7 +250,7 @@ module Puree
250
250
  #
251
251
  # @return [Hash]
252
252
  def metadata
253
- o = {}
253
+ o = super
254
254
  o['access'] = access
255
255
  o['associated'] = associated
256
256
  o['available'] = available
@@ -2,7 +2,7 @@ module Puree
2
2
 
3
3
  module Date
4
4
 
5
- # Converts a date with three components (year, month, day) to ISO8601 format
5
+ # Converts a date with three components (year, month, day) to ISO 8601 date format
6
6
  #
7
7
  # @param data [Hash]
8
8
  # @return [String]
@@ -17,7 +17,7 @@ module Puree
17
17
  iso_date
18
18
  end
19
19
  if !month.empty?
20
- # Add leading zero to convert to ISO 8601
20
+ # Add leading zero to convert to ISO 8601 date component
21
21
  if month.length < 2
22
22
  month.insert(0, '0')
23
23
  end
@@ -26,7 +26,7 @@ module Puree
26
26
  iso_date
27
27
  end
28
28
  if !day.empty?
29
- # Add leading zero to convert to ISO 8601
29
+ # Add leading zero to convert to ISO 8601 date component
30
30
  if day.length < 2
31
31
  day.insert(0, '0')
32
32
  end
@@ -72,7 +72,7 @@ module Puree
72
72
  #
73
73
  # @return [Hash]
74
74
  def metadata
75
- o = {}
75
+ o = super
76
76
  o['city'] = city
77
77
  o['country'] = country
78
78
  o['date'] = date
@@ -8,6 +8,13 @@ module Puree
8
8
  super(:journal)
9
9
  end
10
10
 
11
+ # All metadata
12
+ #
13
+ # @return [Hash]
14
+ def metadata
15
+ super
16
+ end
17
+
11
18
  end
12
19
 
13
20
  end
@@ -44,6 +44,7 @@ module Puree
44
44
  end
45
45
  end
46
46
 
47
+
47
48
  end
48
49
 
49
50
  end
@@ -64,7 +64,7 @@ module Puree
64
64
  # @return [String]
65
65
  def type
66
66
  path = '//content/typeClassification/term/localizedString'
67
- xpath_result = xpath_query path
67
+ xpath_result = xpath_query path
68
68
  xpath_result ? xpath_result.text.strip : ''
69
69
  end
70
70
 
@@ -73,7 +73,7 @@ module Puree
73
73
  # @return [Array<String>]
74
74
  def url
75
75
  path = '//content/webAddresses/classificationDefinedFieldExtension/value/localizedString'
76
- xpath_result = xpath_query path
76
+ xpath_result = xpath_query path
77
77
  arr = []
78
78
  xpath_result.each { |i| arr << i.text.strip }
79
79
  arr.uniq
@@ -83,7 +83,7 @@ module Puree
83
83
  #
84
84
  # @return [Hash]
85
85
  def metadata
86
- o = {}
86
+ o = super
87
87
  o['address'] = address
88
88
  o['email'] = email
89
89
  o['name'] = name
@@ -16,7 +16,7 @@ module Puree
16
16
  xpath_result = xpath_query path
17
17
  affiliations = []
18
18
  xpath_result.each { |i| affiliations << i.text }
19
- return affiliations.uniq
19
+ affiliations.uniq
20
20
  end
21
21
 
22
22
  # Image
@@ -38,7 +38,7 @@ module Puree
38
38
  xpath_result = xpath_query path
39
39
  data = []
40
40
  xpath_result.each { |i| data << i.text }
41
- return data.uniq
41
+ data.uniq
42
42
  end
43
43
 
44
44
  # Name
@@ -66,7 +66,7 @@ module Puree
66
66
  #
67
67
  # @return [Hash]
68
68
  def metadata
69
- o = {}
69
+ o = super
70
70
  o['affiliation'] = affiliation
71
71
  o['image'] = image
72
72
  o['keyword'] = keyword
@@ -8,6 +8,13 @@ module Puree
8
8
  super(:project)
9
9
  end
10
10
 
11
+ # All metadata
12
+ #
13
+ # @return [Hash]
14
+ def metadata
15
+ super
16
+ end
17
+
11
18
  end
12
19
 
13
20
  end
@@ -50,7 +50,7 @@ module Puree
50
50
  # @return [String]
51
51
  def title
52
52
  path = '//content/title'
53
- xpath_result = xpath_query path
53
+ xpath_result = xpath_query path
54
54
  xpath_result ? xpath_result.text.strip : ''
55
55
  end
56
56
 
@@ -59,7 +59,7 @@ module Puree
59
59
  # @return [String]
60
60
  def subtitle
61
61
  path = '//content/subtitle'
62
- xpath_result = xpath_query path
62
+ xpath_result = xpath_query path
63
63
  xpath_result ? xpath_result.text.strip : ''
64
64
  end
65
65
 
@@ -67,7 +67,7 @@ module Puree
67
67
  #
68
68
  # @return [Hash]
69
69
  def metadata
70
- o = {}
70
+ o = super
71
71
  o['description'] = description
72
72
  o['doi'] = doi
73
73
  o['file'] = file
@@ -8,6 +8,13 @@ module Puree
8
8
  super(:publisher)
9
9
  end
10
10
 
11
+ # All metadata
12
+ #
13
+ # @return [Hash]
14
+ def metadata
15
+ super
16
+ end
17
+
11
18
  end
12
19
 
13
20
  end
@@ -83,7 +83,40 @@ module Puree
83
83
  @content ? @content : {}
84
84
  end
85
85
 
86
+ # Created (UTC datetime)
87
+ #
88
+ # @return [String]
89
+ def created
90
+ data = node 'created'
91
+ !data.nil? && !data.empty? ? data.strip : ''
92
+ end
93
+
94
+ # Modified (UTC datetime)
95
+ #
96
+ # @return [String]
97
+ def modified
98
+ data = node 'modified'
99
+ !data.nil? && !data.empty? ? data.strip : ''
100
+ end
101
+
102
+ # UUID
103
+ #
104
+ # @return [String]
105
+ def uuid
106
+ data = node 'uuid'
107
+ !data.nil? && !data.empty? ? data.strip : ''
108
+ end
86
109
 
110
+ # All metadata
111
+ #
112
+ # @return [Hash]
113
+ def metadata
114
+ o = {}
115
+ o['uuid'] = uuid
116
+ o['created'] = created
117
+ o['modified'] = modified
118
+ o
119
+ end
87
120
 
88
121
  private
89
122
 
@@ -132,5 +165,6 @@ module Puree
132
165
  doc.xpath path
133
166
  end
134
167
 
168
+
135
169
  end
136
170
  end
@@ -1,3 +1,3 @@
1
1
  module Puree
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -32,6 +32,10 @@ describe 'Dataset' do
32
32
  expect(@p.available).to be_an_instance_of(Hash)
33
33
  end
34
34
 
35
+ it '#created' do
36
+ expect(@p.created).to be_an_instance_of(String)
37
+ end
38
+
35
39
  it '#description' do
36
40
  expect(@p.description).to be_an_instance_of(String)
37
41
  end
@@ -60,6 +64,10 @@ describe 'Dataset' do
60
64
  expect(@p.metadata).to be_an_instance_of(Hash)
61
65
  end
62
66
 
67
+ it '#modified' do
68
+ expect(@p.modified).to be_an_instance_of(String)
69
+ end
70
+
63
71
  it '#person' do
64
72
  expect(@p.person).to be_an_instance_of(Hash)
65
73
  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.11.0
4
+ version: 0.12.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-19 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty