puree 0.17.1 → 0.18.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 +4 -0
- data/PITCHME.md +108 -0
- data/README.md +1 -1
- data/lib/puree/collection.rb +26 -1
- data/lib/puree/version.rb +1 -1
- data/spec/collection.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2678f284947384cb88da1511bbdedf6cbc00314
|
4
|
+
data.tar.gz: 7d8435e7e07d5e98aa8240e1e736456503457a7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe6494c3ac14f9f20811268c5b3c65b2cd5b5f888a94113cf2f887729c3ea1998d73883193bdc0db740659f8f099f354f6767e30a0c75b00c182496cba18b13a
|
7
|
+
data.tar.gz: 1d9cf4abce07487bcf45881ebec3bbf7f6c1ab241002e1c91c0891cee3220dfccf1f82f2c65eac2e3cd19b7bc3eff6eccca0b9aa806b049d198a1bd496df39a8
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ 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.18.0 - 2016-09-20
|
11
|
+
### Added
|
12
|
+
- Collection - count of records available.
|
13
|
+
|
10
14
|
## 0.17.1 - 2016-09-08
|
11
15
|
### Fixed
|
12
16
|
- Dataset - available extraction.
|
data/PITCHME.md
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
#HSLIDE
|
2
|
+
|
3
|
+
## Rationale
|
4
|
+
|
5
|
+
Projects revealed challenges getting specific data from the Pure Research Information System API.
|
6
|
+
|
7
|
+
#VSLIDE
|
8
|
+
|
9
|
+
## DOI minting
|
10
|
+
|
11
|
+
Transforming metadata to the DataCite XML schema and minting Digital Object Identifiers.
|
12
|
+
|
13
|
+
<a href="https://github.com/lulibrary/doi" target="_blank">GitHub</a>
|
14
|
+
|
15
|
+
#VSLIDE
|
16
|
+
|
17
|
+
## Fedora repository
|
18
|
+
|
19
|
+
Transforming metadata to RDF and ingesting via REST API.
|
20
|
+
|
21
|
+
#VSLIDE
|
22
|
+
|
23
|
+
## Linked open data
|
24
|
+
|
25
|
+
Transforming metadata to RDF and publishing in Fuseki triple store.
|
26
|
+
|
27
|
+
#VSLIDE
|
28
|
+
|
29
|
+
## Primo
|
30
|
+
|
31
|
+
Enriching author metadata.
|
32
|
+
|
33
|
+
#VSLIDE
|
34
|
+
|
35
|
+
## DMAOnline
|
36
|
+
|
37
|
+
Ingesting research data management data from the Current Research Information System (CRIS) of multiple institutions.
|
38
|
+
|
39
|
+
<a href="http://dmao.info/" target="_blank">Project website</a>
|
40
|
+
|
41
|
+
#HSLIDE
|
42
|
+
|
43
|
+
## Pure API challenges
|
44
|
+
|
45
|
+
#VSLIDE
|
46
|
+
|
47
|
+
- Metadata at resource level e.g. dataset.
|
48
|
+
- Only XML available. <!-- .element: class="fragment" -->
|
49
|
+
- XML needs processing to extract specific metadata. <!-- .element: class="fragment" -->
|
50
|
+
- Local web services consuming the Pure API are not useful when contributing FOSS. <!-- .element: class="fragment" -->
|
51
|
+
|
52
|
+
#HSLIDE
|
53
|
+
|
54
|
+
## Purée: an answer to the challenges
|
55
|
+
|
56
|
+
#VSLIDE
|
57
|
+
|
58
|
+
- Consumes the Pure API.
|
59
|
+
- Metadata available in simple data structures. <!-- .element: class="fragment" -->
|
60
|
+
- No XML processing needed in any code. <!-- .element: class="fragment" -->
|
61
|
+
|
62
|
+
#VSLIDE
|
63
|
+
|
64
|
+
## Single resource
|
65
|
+
Tell Purée what you are looking for...
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
d = Puree::Dataset.new
|
69
|
+
metadata = d.find uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
70
|
+
```
|
71
|
+
...and get the data from a hash...
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
metadata['doi']
|
75
|
+
```
|
76
|
+
|
77
|
+
...or using a method...
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
d.doi
|
81
|
+
```
|
82
|
+
|
83
|
+
#VSLIDE
|
84
|
+
|
85
|
+
## Collection of resources
|
86
|
+
Tell Purée what you are looking for...
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
c = Puree::Collection.new resource: :dataset
|
90
|
+
metadata = c.find limit: 50
|
91
|
+
```
|
92
|
+
...and get the data from an array of hashes or from an array of instances.
|
93
|
+
|
94
|
+
#VSLIDE
|
95
|
+
|
96
|
+
## Location
|
97
|
+
|
98
|
+
<a href="https://rubygems.org/gems/puree" target="_blank">RubyGems</a>
|
99
|
+
|
100
|
+
<a href="https://github.com/lulibrary/puree" target="_blank">GitHub</a>
|
101
|
+
|
102
|
+
#VSLIDE
|
103
|
+
|
104
|
+
## Documentation
|
105
|
+
|
106
|
+
<a href="http://www.rubydoc.info/gems/puree" target="_blank">API in YARD</a>
|
107
|
+
|
108
|
+
<a href="https://aalbinclark.gitbooks.io/puree" target="_blank">Detailed usage in GitBook</a>
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Purée [](https://badge.fury.io/rb/puree)
|
1
|
+
# Purée [](https://badge.fury.io/rb/puree) [](https://gitpitch.com/lulibrary/puree)
|
2
2
|
Consumes the Pure Research Information System API and puts the metadata into simple data structures.
|
3
3
|
|
4
4
|
## Installation
|
data/lib/puree/collection.rb
CHANGED
@@ -65,6 +65,8 @@ module Puree
|
|
65
65
|
record_rendering: rendering
|
66
66
|
}
|
67
67
|
|
68
|
+
reset
|
69
|
+
|
68
70
|
missing = missing_credentials
|
69
71
|
if !missing.empty?
|
70
72
|
missing.each do |m|
|
@@ -88,7 +90,7 @@ module Puree
|
|
88
90
|
|
89
91
|
query['rendering'] = @options[:rendering]
|
90
92
|
|
91
|
-
if @options[:limit]
|
93
|
+
if @options[:limit] >= 0
|
92
94
|
query['window.size'] = @options[:limit]
|
93
95
|
end
|
94
96
|
|
@@ -133,6 +135,7 @@ module Puree
|
|
133
135
|
@doc = Nokogiri::XML @response.body
|
134
136
|
@doc.remove_namespaces!
|
135
137
|
|
138
|
+
@count = extract_count
|
136
139
|
# code = @response.code
|
137
140
|
# body = @response.body
|
138
141
|
# puts "#{self.class.name} #{code}"
|
@@ -157,8 +160,20 @@ module Puree
|
|
157
160
|
end
|
158
161
|
|
159
162
|
|
163
|
+
# Count of records available for a resource type
|
164
|
+
#
|
165
|
+
# @return [Integer]
|
166
|
+
def count
|
167
|
+
@count
|
168
|
+
end
|
169
|
+
|
160
170
|
private
|
161
171
|
|
172
|
+
def extract_count
|
173
|
+
path = '//count'
|
174
|
+
xpath_query_for_single_value(path).to_i
|
175
|
+
end
|
176
|
+
|
162
177
|
|
163
178
|
# Array of UUIDs
|
164
179
|
#
|
@@ -233,6 +248,11 @@ module Puree
|
|
233
248
|
@doc.xpath path
|
234
249
|
end
|
235
250
|
|
251
|
+
def xpath_query_for_single_value(path)
|
252
|
+
xpath_result = xpath_query path
|
253
|
+
xpath_result ? xpath_result.text.strip : ''
|
254
|
+
end
|
255
|
+
|
236
256
|
|
237
257
|
def missing_credentials
|
238
258
|
missing = []
|
@@ -252,6 +272,11 @@ module Puree
|
|
252
272
|
missing
|
253
273
|
end
|
254
274
|
|
275
|
+
def reset
|
276
|
+
@response = nil
|
277
|
+
@count = nil
|
278
|
+
end
|
279
|
+
|
255
280
|
alias :find :get
|
256
281
|
|
257
282
|
end
|
data/lib/puree/version.rb
CHANGED
data/spec/collection.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.18.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-09-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- CHANGELOG.md
|
51
51
|
- Gemfile
|
52
52
|
- LICENSE.txt
|
53
|
+
- PITCHME.md
|
53
54
|
- README.md
|
54
55
|
- Rakefile
|
55
56
|
- lib/puree.rb
|