harvestdor 0.3.1 → 0.3.2
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 +5 -5
- data/.travis.yml +14 -4
- data/{README.rdoc → README.md} +27 -25
- data/harvestdor.gemspec +2 -2
- data/lib/harvestdor/purl_xml.rb +4 -4
- data/lib/harvestdor/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +11 -13
- data/.coveralls.yml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d94db1129fe0036bed16d1d9f97054cc0c6cb986a3ae91ad714d3a28d77eaff0
|
4
|
+
data.tar.gz: ef5514a943b899b496023423835edbb1d1c1c6e68fe6affe520b5c6065410d86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd4d31e7a52f7d6b69bf84adbf26cadf248489eaaf6a74d558f8a6d65154d74589485fcec51b75c5cc9a1b12718f9af8b6465875df935d962a0e37377408f84e
|
7
|
+
data.tar.gz: 2cbcadd20302319b40a42e90e0050f93a0682efd2f494d328148807184d0e161b283520d13bc97ad7c5e886d05de506e9426e2116b173058689e51a6d932f90e
|
data/.travis.yml
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
+
dist: xenial
|
1
2
|
language: ruby
|
2
3
|
script: rake rspec
|
3
4
|
sudo: false
|
4
5
|
rvm:
|
5
|
-
- 2.
|
6
|
+
- 2.7.0
|
7
|
+
|
6
8
|
notifications:
|
7
|
-
email:
|
8
|
-
|
9
|
-
|
9
|
+
email: false
|
10
|
+
env:
|
11
|
+
global:
|
12
|
+
- CC_TEST_REPORTER_ID=533e2edef1885c87092961c61576c5723296cabda9e1be7b62d7afe95f5e7bcd
|
13
|
+
|
14
|
+
before_script:
|
15
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
16
|
+
- chmod +x ./cc-test-reporter
|
17
|
+
- ./cc-test-reporter before-build
|
18
|
+
after_script:
|
19
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Harvestdor
|
2
|
+
[](https://travis-ci.org/sul-dlss/harvestdor)
|
3
|
+
[](https://codeclimate.com/github/sul-dlss/harvestdor/coverage)
|
4
|
+
[](https://badge.fury.io/rb/harvestdor)
|
3
5
|
|
4
6
|
A Gem to harvest data from a Stanford Purl page, with convenience methods for
|
5
7
|
getting Nokogiri::XML::Document and errors when pieces are missing
|
6
8
|
|
7
|
-
|
9
|
+
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
@@ -18,11 +20,11 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
$ gem install harvestdor
|
20
22
|
|
21
|
-
|
23
|
+
## Usage
|
22
24
|
|
23
|
-
|
25
|
+
### Configuration
|
24
26
|
|
25
|
-
|
27
|
+
#### Possible configuration options (with default values unless otherwise indicated)
|
26
28
|
|
27
29
|
client = Harvestdor::Client.new({ # Example with all possible options
|
28
30
|
:log_dir => File.join(File.dirname(__FILE__), "..", "logs"),
|
@@ -30,26 +32,26 @@ Or install it yourself as:
|
|
30
32
|
:purl => 'https://purl.stanford.edu'
|
31
33
|
})
|
32
34
|
|
33
|
-
|
35
|
+
#### Option 1: use a yaml file
|
34
36
|
|
35
37
|
for contents of yml -- see spec/config/example.yml
|
36
38
|
|
37
39
|
client = Harvestdor::Client.new({:config_yml_path => path_to_my_yml})
|
38
40
|
client.mods('oo111oo2222')
|
39
41
|
|
40
|
-
|
42
|
+
#### Option 2: pass in non-default configurations as a hash
|
41
43
|
|
42
44
|
client = Harvestdor::Client.new({:purl => 'https://my_purl.org'})
|
43
45
|
client.mods('oo111oo2222')
|
44
46
|
|
45
|
-
|
47
|
+
#### Option 3: set the attributes explicitly in your code
|
46
48
|
|
47
49
|
client = Harvestdor::Client.new
|
48
50
|
client.config.purl = 'https://my_purl.org'
|
49
51
|
client.mods('oo111oo2222')
|
50
52
|
|
51
53
|
|
52
|
-
|
54
|
+
### XML from PURL pages
|
53
55
|
|
54
56
|
You can get, for example, the contentMetadata for a druid:
|
55
57
|
|
@@ -70,13 +72,13 @@ Or the MODS metadata:
|
|
70
72
|
end
|
71
73
|
|
72
74
|
Similarly for
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
- mods
|
76
|
+
- public_xml (all of it)
|
77
|
+
- content_metadata
|
78
|
+
- identity_metadata
|
79
|
+
- rights_metadata
|
80
|
+
- rdf
|
81
|
+
- dc
|
80
82
|
|
81
83
|
You can also do this from a Harvestdor::Client object, and it will use the purl from the Client.config:
|
82
84
|
|
@@ -84,16 +86,16 @@ You can also do this from a Harvestdor::Client object, and it will use the purl
|
|
84
86
|
client.identity_metadata('bb375wb8869')
|
85
87
|
|
86
88
|
|
87
|
-
|
89
|
+
## Contributing
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
- Fork it
|
92
|
+
- Create your feature branch (`git checkout -b my-new-feature`)
|
93
|
+
- Write code and tests.
|
94
|
+
- Commit your changes (`git commit -am 'Added some feature'`)
|
95
|
+
- Push to the branch (`git push origin my-new-feature`)
|
96
|
+
- Create new Pull Request
|
95
97
|
|
96
|
-
|
98
|
+
## Releases
|
97
99
|
|
98
100
|
* <b>0.0.14</b> Bug fix for compatibility with jruby
|
99
101
|
* <b>0.0.13</b> Updated to work with Faraday 0.9, releases via rubygems instead of sul-gems
|
data/harvestdor.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.add_dependency 'confstruct'
|
21
21
|
gem.add_dependency 'nokogiri'
|
22
|
-
gem.add_dependency 'faraday'
|
22
|
+
gem.add_dependency 'faraday', '~> 1'
|
23
23
|
gem.add_dependency 'net-http-persistent'
|
24
24
|
|
25
25
|
# Development dependencies
|
@@ -29,9 +29,9 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_development_dependency "yard"
|
30
30
|
# tests
|
31
31
|
gem.add_development_dependency 'rspec'
|
32
|
-
gem.add_development_dependency 'coveralls'
|
33
32
|
gem.add_development_dependency 'rubocop'
|
34
33
|
gem.add_development_dependency 'rubocop-rspec'
|
34
|
+
gem.add_development_dependency 'simplecov'
|
35
35
|
gem.add_development_dependency 'vcr'
|
36
36
|
gem.add_development_dependency 'webmock'
|
37
37
|
end
|
data/lib/harvestdor/purl_xml.rb
CHANGED
@@ -15,7 +15,7 @@ module Harvestdor
|
|
15
15
|
def self.mods druid, purl_url = Harvestdor::PURL_DEFAULT
|
16
16
|
begin
|
17
17
|
Nokogiri::XML(http_client.get("#{purl_url}/#{druid}.mods").body,nil,'UTF-8')
|
18
|
-
rescue Faraday::
|
18
|
+
rescue Faraday::ClientError
|
19
19
|
raise Harvestdor::Errors::MissingMods.new(druid)
|
20
20
|
end
|
21
21
|
end
|
@@ -30,7 +30,7 @@ module Harvestdor
|
|
30
30
|
ng_doc = Nokogiri::XML(http_client.get("#{purl_url}/#{druid}.xml").body)
|
31
31
|
raise Harvestdor::Errors::MissingPublicXml.new(druid) if !ng_doc || ng_doc.children.empty?
|
32
32
|
ng_doc
|
33
|
-
rescue Faraday::
|
33
|
+
rescue Faraday::ClientError
|
34
34
|
raise Harvestdor::Errors::MissingPurlPage.new(druid)
|
35
35
|
end
|
36
36
|
end
|
@@ -147,9 +147,9 @@ module Harvestdor
|
|
147
147
|
interval: 0.05,
|
148
148
|
interval_randomness: 0.5,
|
149
149
|
backoff_factor: 2,
|
150
|
-
exceptions: ['Errno::ECONNRESET', 'Errno::ETIMEDOUT', 'Timeout::Error', 'Faraday::
|
150
|
+
exceptions: ['Errno::ECONNRESET', 'Errno::ETIMEDOUT', 'Timeout::Error', 'Faraday::TimeoutError', 'Faraday::ConnectionFailed']
|
151
151
|
end
|
152
152
|
end
|
153
153
|
private_class_method :http_client
|
154
154
|
|
155
|
-
end # module Harvestdor
|
155
|
+
end # module Harvestdor
|
data/lib/harvestdor/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harvestdor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: confstruct
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: net-http-persistent
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rubocop
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: rubocop
|
140
|
+
name: rubocop-rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: simplecov
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -199,7 +199,6 @@ executables: []
|
|
199
199
|
extensions: []
|
200
200
|
extra_rdoc_files: []
|
201
201
|
files:
|
202
|
-
- ".coveralls.yml"
|
203
202
|
- ".gitignore"
|
204
203
|
- ".hound.yml"
|
205
204
|
- ".rubocop.yml"
|
@@ -208,7 +207,7 @@ files:
|
|
208
207
|
- ".yardopts"
|
209
208
|
- Gemfile
|
210
209
|
- LICENSE.txt
|
211
|
-
- README.
|
210
|
+
- README.md
|
212
211
|
- Rakefile
|
213
212
|
- harvestdor.gemspec
|
214
213
|
- lib/harvestdor.rb
|
@@ -246,8 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
245
|
- !ruby/object:Gem::Version
|
247
246
|
version: '0'
|
248
247
|
requirements: []
|
249
|
-
|
250
|
-
rubygems_version: 2.5.1
|
248
|
+
rubygems_version: 3.1.2
|
251
249
|
signing_key:
|
252
250
|
specification_version: 4
|
253
251
|
summary: Harvest DOR object metadata
|
data/.coveralls.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
service_name: travis-ci
|