fieldhand 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 +5 -5
- data/LICENSE +1 -1
- data/README.md +10 -7
- data/lib/fieldhand.rb +2 -0
- data/lib/fieldhand/arguments.rb +2 -0
- data/lib/fieldhand/datestamp.rb +2 -0
- data/lib/fieldhand/get_record_parser.rb +2 -0
- data/lib/fieldhand/header.rb +2 -0
- data/lib/fieldhand/identify.rb +2 -0
- data/lib/fieldhand/identify_parser.rb +2 -0
- data/lib/fieldhand/list_identifiers_parser.rb +2 -0
- data/lib/fieldhand/list_metadata_formats_parser.rb +2 -0
- data/lib/fieldhand/list_records_parser.rb +2 -0
- data/lib/fieldhand/list_sets_parser.rb +2 -0
- data/lib/fieldhand/logger.rb +2 -0
- data/lib/fieldhand/metadata_format.rb +2 -0
- data/lib/fieldhand/network_errors.rb +2 -0
- data/lib/fieldhand/options.rb +14 -0
- data/lib/fieldhand/paginator.rb +40 -14
- data/lib/fieldhand/record.rb +2 -0
- data/lib/fieldhand/repository.rb +16 -10
- data/lib/fieldhand/response_parser.rb +2 -0
- data/lib/fieldhand/set.rb +2 -0
- data/spec/fieldhand/arguments_spec.rb +2 -0
- data/spec/fieldhand/datestamp_spec.rb +2 -0
- data/spec/fieldhand/header_spec.rb +2 -0
- data/spec/fieldhand/identify_spec.rb +2 -0
- data/spec/fieldhand/metadata_format_spec.rb +2 -0
- data/spec/fieldhand/options_spec.rb +30 -0
- data/spec/fieldhand/paginator_spec.rb +58 -0
- data/spec/fieldhand/record_spec.rb +1 -0
- data/spec/fieldhand/repository_spec.rb +30 -0
- data/spec/fieldhand/set_spec.rb +2 -0
- data/spec/spec_helper.rb +8 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de831124ad540a3a7de6bab3bc7554764913e7f0459f90d28ea98036137f45e3
|
4
|
+
data.tar.gz: 0fb070d672d59d83718dd4d4f468d08c44ca6f8afec8cb984ec4d7068b3a6c3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8977050a19ec07e3824fa11a2c090b2e90ec4c997db74bf40baf7a3df7811cbe0d3bd71d50dee9f5614a6e2ebf2fabe19c26f27e745e50c027b31ea6db295f7f
|
7
|
+
data.tar.gz: bfb840d375eda0660640325ed8521ff51586b726737ff0827211dd3c82f687b17cc1814c3ac30c6b40b98da0680a9ffd00133c45b5ec15032498e6361f4606db
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017-
|
3
|
+
Copyright (c) 2017-2019 Altmetric and Paul Mucur
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
# Fieldhand [![Build Status](https://travis-ci.org/
|
1
|
+
# Fieldhand [![Build Status](https://travis-ci.org/fieldhand/fieldhand.svg?branch=master)](https://travis-ci.org/fieldhand/fieldhand)
|
2
2
|
|
3
3
|
A Ruby library for harvesting metadata from [OAI-PMH](https://www.openarchives.org/OAI/openarchivesprotocol.html) repositories.
|
4
4
|
|
5
|
-
**Current version:** 0.
|
6
|
-
**Supported Ruby versions:** 1.8.7, 1.9.2, 1.9.3, 2.0, 2.1, 2.2
|
5
|
+
**Current version:** 0.12.0
|
6
|
+
**Supported Ruby versions:** 1.8.7, 1.9.2, 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
10
|
```
|
11
|
-
gem install fieldhand -v '~> 0.
|
11
|
+
gem install fieldhand -v '~> 0.12'
|
12
12
|
```
|
13
13
|
|
14
14
|
Or, in your `Gemfile`:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem 'fieldhand', '~> 0.
|
17
|
+
gem 'fieldhand', '~> 0.12'
|
18
18
|
```
|
19
19
|
|
20
20
|
## Usage
|
@@ -116,14 +116,17 @@ Fieldhand::Repository.new('http://www.example.com/oai')
|
|
116
116
|
Fieldhand::Repository.new(URI('http://www.example.com/oai'))
|
117
117
|
Fieldhand::Repository.new('http://www.example.com/oai', :logger => Logger.new(STDOUT), :timeout => 10, :bearer_token => 'decafbad')
|
118
118
|
Fieldhand::Repository.new('http://www.example.com/oai', :logger => Logger.new(STDOUT), :timeout => 10, :headers => { 'Custom header' => 'decafbad' })
|
119
|
+
Fieldhand::Repository.new('http://www.example.com/oai', :logger => Logger.new(STDOUT), :retries => 5, :interval => 30)
|
119
120
|
```
|
120
121
|
|
121
122
|
Return a new [`Repository`](#fieldhandrepository) instance accessible at the given `uri` (specified
|
122
123
|
either as a [`URI`][URI] or
|
123
|
-
something that can be coerced into a `URI` such as a `String`) with
|
124
|
+
something that can be coerced into a `URI` such as a `String`) with options passed as a `Hash`:
|
124
125
|
|
125
126
|
* `:logger`: a [`Logger`](http://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html)-compatible `logger`, defaults to a platform-specific null logger;
|
126
127
|
* `:timeout`: a `Numeric` number of seconds to wait before timing out any HTTP requests, defaults to 60;
|
128
|
+
* `:retries`: a `Numeric` maximum number of times an HTTP request will be retried before raising an error, defaults to 0;
|
129
|
+
* `:interval`: a `Numeric` number of seconds to wait before the next retry attempt, defaults to 10;
|
127
130
|
* `:bearer_token`: a `String` bearer token to authorize any HTTP requests, defaults to `nil`.
|
128
131
|
* `:headers`: a `Hash` containing custom HTTP headers, defaults to `{}`.
|
129
132
|
|
@@ -635,6 +638,6 @@ This can be used to rescue all the following child error types.
|
|
635
638
|
|
636
639
|
## License
|
637
640
|
|
638
|
-
Copyright © 2017-
|
641
|
+
Copyright © 2017-2019 Altmetric and Paul Mucur
|
639
642
|
|
640
643
|
Distributed under the MIT License.
|
data/lib/fieldhand.rb
CHANGED
data/lib/fieldhand/arguments.rb
CHANGED
data/lib/fieldhand/datestamp.rb
CHANGED
data/lib/fieldhand/header.rb
CHANGED
data/lib/fieldhand/identify.rb
CHANGED
data/lib/fieldhand/logger.rb
CHANGED
data/lib/fieldhand/options.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fieldhand/logger'
|
2
4
|
|
3
5
|
module Fieldhand
|
@@ -16,6 +18,8 @@ module Fieldhand
|
|
16
18
|
# * :logger - A `Logger`-compatible class for logging the activity of the library, defaults to a platform-specific
|
17
19
|
# null logger
|
18
20
|
# * :timeout - A `Numeric` number of seconds to wait for any HTTP requests, defaults to 60 seconds
|
21
|
+
# * :retries - A `Numeric` maximum number of times a request is retried before erroring, defaults to 0
|
22
|
+
# * :interval - A `Numeric` number of seconds before an erroring request is retried, defaults to 10
|
19
23
|
# * :bearer_token - A `String` bearer token to use when sending any HTTP requests, defaults to nil
|
20
24
|
# * :headers - A `Hash` containing custom HTTP headers, defaults to {}.
|
21
25
|
def initialize(logger_or_options = {})
|
@@ -32,6 +36,16 @@ module Fieldhand
|
|
32
36
|
options.fetch(:logger) { Logger.null }
|
33
37
|
end
|
34
38
|
|
39
|
+
# Return the current maximum number of retries.
|
40
|
+
def retries
|
41
|
+
options.fetch(:retries, 0)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Return the current retry interval in seconds.
|
45
|
+
def interval
|
46
|
+
options.fetch(:interval, 10)
|
47
|
+
end
|
48
|
+
|
35
49
|
# Return the current bearer token.
|
36
50
|
def bearer_token
|
37
51
|
options[:bearer_token]
|
data/lib/fieldhand/paginator.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fieldhand/network_errors'
|
2
4
|
require 'fieldhand/options'
|
3
5
|
require 'fieldhand/response_parser'
|
4
6
|
require 'cgi'
|
7
|
+
require 'forwardable'
|
5
8
|
require 'net/http'
|
6
9
|
require 'uri'
|
7
10
|
|
@@ -11,25 +14,28 @@ module Fieldhand
|
|
11
14
|
#
|
12
15
|
# See https://www.openarchives.org/OAI/openarchivesprotocol.html#FlowControl
|
13
16
|
class Paginator
|
14
|
-
attr_reader :uri, :
|
17
|
+
attr_reader :uri, :options, :http
|
18
|
+
|
19
|
+
extend Forwardable
|
20
|
+
def_delegators :options, :logger, :timeout, :retries, :interval, :headers
|
15
21
|
|
16
|
-
# Return a new paginator for the given repository base URI and optional
|
22
|
+
# Return a new paginator for the given repository base URI and optional
|
23
|
+
# logger, timeout, maximum number of retries, retry interval, bearer token
|
24
|
+
# and headers.
|
17
25
|
#
|
18
26
|
# The URI can be passed as either a `URI` or something that can be parsed as a URI such as a string.
|
19
27
|
#
|
20
|
-
# The logger will default to a null logger appropriate to this platform,
|
21
|
-
#
|
28
|
+
# The logger will default to a null logger appropriate to this platform,
|
29
|
+
# timeout will default to 60 seconds, maximum number of retries will
|
30
|
+
# default to 0, the retry interval will default to 10 seconds, the bearer
|
31
|
+
# token will default to nil and headers will default to empty hash.
|
22
32
|
def initialize(uri, logger_or_options = {})
|
23
33
|
@uri = uri.is_a?(::URI) ? uri : URI(uri)
|
24
|
-
|
25
|
-
options = Options.new(logger_or_options)
|
26
|
-
@logger = options.logger
|
27
|
-
@timeout = options.timeout
|
28
|
-
@headers = options.headers
|
34
|
+
@options = Options.new(logger_or_options)
|
29
35
|
|
30
36
|
@http = ::Net::HTTP.new(@uri.host, @uri.port)
|
31
|
-
@http.read_timeout = @timeout
|
32
|
-
@http.open_timeout = @timeout
|
37
|
+
@http.read_timeout = @options.timeout
|
38
|
+
@http.open_timeout = @options.timeout
|
33
39
|
@http.use_ssl = true if @uri.scheme == 'https'
|
34
40
|
end
|
35
41
|
|
@@ -75,9 +81,7 @@ module Fieldhand
|
|
75
81
|
private
|
76
82
|
|
77
83
|
def parse_response(query = {})
|
78
|
-
response =
|
79
|
-
raise ResponseError, response unless response.is_a?(::Net::HTTPSuccess)
|
80
|
-
|
84
|
+
response = retry_request(query)
|
81
85
|
response_parser = ResponseParser.new(response.body)
|
82
86
|
response_parser.errors.each do |error|
|
83
87
|
raise error
|
@@ -86,6 +90,28 @@ module Fieldhand
|
|
86
90
|
response_parser
|
87
91
|
end
|
88
92
|
|
93
|
+
def retry_request(query = {})
|
94
|
+
remaining_retries = retries
|
95
|
+
|
96
|
+
begin
|
97
|
+
ensure_successful_request(query)
|
98
|
+
rescue ResponseError => e
|
99
|
+
raise e unless remaining_retries > 0
|
100
|
+
|
101
|
+
remaining_retries -= 1
|
102
|
+
sleep(interval)
|
103
|
+
|
104
|
+
retry
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def ensure_successful_request(query = {})
|
109
|
+
response = request(query)
|
110
|
+
raise ResponseError, response unless response.is_a?(::Net::HTTPSuccess)
|
111
|
+
|
112
|
+
response
|
113
|
+
end
|
114
|
+
|
89
115
|
def request(query = {})
|
90
116
|
request_uri = uri.dup
|
91
117
|
request_uri.query = encode_query(query)
|
data/lib/fieldhand/record.rb
CHANGED
data/lib/fieldhand/repository.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fieldhand/arguments'
|
2
4
|
require 'fieldhand/get_record_parser'
|
3
5
|
require 'fieldhand/identify_parser'
|
@@ -7,6 +9,7 @@ require 'fieldhand/list_records_parser'
|
|
7
9
|
require 'fieldhand/list_sets_parser'
|
8
10
|
require 'fieldhand/options'
|
9
11
|
require 'fieldhand/paginator'
|
12
|
+
require 'forwardable'
|
10
13
|
require 'uri'
|
11
14
|
|
12
15
|
module Fieldhand
|
@@ -14,23 +17,26 @@ module Fieldhand
|
|
14
17
|
#
|
15
18
|
# See https://www.openarchives.org/OAI/openarchivesprotocol.html
|
16
19
|
class Repository
|
17
|
-
attr_reader :uri, :
|
20
|
+
attr_reader :uri, :logger_or_options
|
21
|
+
|
22
|
+
# Allow the user to query the repository's current options.
|
23
|
+
extend Forwardable
|
24
|
+
def_delegators :paginator, :logger, :timeout, :retries, :interval, :headers
|
18
25
|
|
19
|
-
# Return a new repository with the given base URL and an optional logger,
|
26
|
+
# Return a new repository with the given base URL and an optional logger,
|
27
|
+
# timeout, maximum number of retries, retry interval, bearer token and
|
28
|
+
# headers.
|
20
29
|
#
|
21
30
|
# The base URL can be passed as a `URI` or anything that can be parsed as a URI such as a string.
|
22
31
|
#
|
23
32
|
# For backward compatibility, the second argument can either be a logger or a hash containing
|
24
|
-
# a logger, timeout, bearer token and headers.
|
33
|
+
# a logger, timeout, maximum number of retries, retry interval, bearer token and headers.
|
25
34
|
#
|
26
|
-
# Defaults to using a null logger specific to this platform, a timeout of 60 seconds,
|
35
|
+
# Defaults to using a null logger specific to this platform, a timeout of 60 seconds, a maximum
|
36
|
+
# number of retries of 0, a retry interval of 10 seconds, no bearer token and no headers.
|
27
37
|
def initialize(uri, logger_or_options = {})
|
28
38
|
@uri = uri.is_a?(::URI) ? uri : URI(uri)
|
29
|
-
|
30
|
-
options = Options.new(logger_or_options)
|
31
|
-
@logger = options.logger
|
32
|
-
@timeout = options.timeout
|
33
|
-
@headers = options.headers
|
39
|
+
@logger_or_options = logger_or_options
|
34
40
|
end
|
35
41
|
|
36
42
|
# Send an Identify request to the repository and return an `Identify` response.
|
@@ -134,7 +140,7 @@ module Fieldhand
|
|
134
140
|
private
|
135
141
|
|
136
142
|
def paginator
|
137
|
-
@paginator ||= Paginator.new(uri,
|
143
|
+
@paginator ||= Paginator.new(uri, logger_or_options)
|
138
144
|
end
|
139
145
|
end
|
140
146
|
end
|
data/lib/fieldhand/set.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fieldhand/options'
|
2
4
|
|
3
5
|
module Fieldhand
|
@@ -56,6 +58,34 @@ module Fieldhand
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
61
|
+
describe '#retries' do
|
62
|
+
it 'defaults to 0' do
|
63
|
+
options = described_class.new({})
|
64
|
+
|
65
|
+
expect(options.retries).to be_zero
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'can be overridden by passing an option' do
|
69
|
+
options = described_class.new(:retries => 5)
|
70
|
+
|
71
|
+
expect(options.retries).to eq(5)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#interval' do
|
76
|
+
it 'defaults to 10' do
|
77
|
+
options = described_class.new({})
|
78
|
+
|
79
|
+
expect(options.interval).to eq(10)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'can be overridden by passing an option' do
|
83
|
+
options = described_class.new(:interval => 5)
|
84
|
+
|
85
|
+
expect(options.interval).to eq(5)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
59
89
|
describe '#bearer_token' do
|
60
90
|
it 'defaults to nil' do
|
61
91
|
options = described_class.new({})
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fieldhand/get_record_parser'
|
2
4
|
require 'fieldhand/identify_parser'
|
3
5
|
require 'fieldhand/list_metadata_formats_parser'
|
@@ -85,6 +87,25 @@ module Fieldhand
|
|
85
87
|
to raise_error(NoSetHierarchyError)
|
86
88
|
end
|
87
89
|
|
90
|
+
it 'retries unsuccessful requests' do
|
91
|
+
stub_request(:get, 'http://www.example.com/oai?verb=Identify').
|
92
|
+
to_return({ :status => 503 }, { :status => 500 }, { :status => 200, :body => fixture('identify.xml') })
|
93
|
+
|
94
|
+
paginator = described_class.new('http://www.example.com/oai', :retries => 3, :interval => 0)
|
95
|
+
|
96
|
+
expect(paginator.items('Identify', IdentifyParser).first).to be_a(Identify)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'retries each unsuccessful request separately' do
|
100
|
+
stub_request(:get, 'http://www.example.com/oai?verb=Identify').
|
101
|
+
to_return({ :status => 500 }, { :status => 200, :body => fixture('identify.xml') }, { :status => 500 }, { :status => 200, :body => fixture('identify.xml') })
|
102
|
+
|
103
|
+
paginator = described_class.new('http://www.example.com/oai', :retries => 1, :interval => 0)
|
104
|
+
paginator.items('Identify', IdentifyParser).first
|
105
|
+
|
106
|
+
expect(paginator.items('Identify', IdentifyParser).first).to be_a(Identify)
|
107
|
+
end
|
108
|
+
|
88
109
|
it 'raises a Response Error if an unsuccessful response is returned' do
|
89
110
|
stub_request(:get, 'http://www.example.com/oai?verb=Identify').
|
90
111
|
to_return(:status => 503, :body => 'Retry after 5 seconds')
|
@@ -94,6 +115,15 @@ module Fieldhand
|
|
94
115
|
to raise_error(ResponseError)
|
95
116
|
end
|
96
117
|
|
118
|
+
it 'raises a Response Error if an unsuccessful response is returned after the last retry attempt' do
|
119
|
+
stub_request(:get, 'http://www.example.com/oai?verb=Identify').
|
120
|
+
to_return({ :status => 500 }, { :status => 500 }, { :status => 500 }, { :status => 200, :body => fixture('identify.xml') })
|
121
|
+
paginator = described_class.new('http://www.example.com/oai', :retries => 2, :interval => 0)
|
122
|
+
|
123
|
+
expect { paginator.items('Identify', IdentifyParser).first }.
|
124
|
+
to raise_error(ResponseError)
|
125
|
+
end
|
126
|
+
|
97
127
|
it 'raises a Response Error containing a response object' do
|
98
128
|
stub_request(:get, 'http://www.example.com/oai?verb=Identify').
|
99
129
|
to_return(:status => 503, :body => 'Retry after 5 seconds')
|
@@ -146,6 +176,34 @@ module Fieldhand
|
|
146
176
|
end
|
147
177
|
end
|
148
178
|
|
179
|
+
describe '#retries' do
|
180
|
+
it 'defaults to 0' do
|
181
|
+
paginator = described_class.new('http://www.example.com/oai')
|
182
|
+
|
183
|
+
expect(paginator.retries).to be_zero
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'can be overridden with an option' do
|
187
|
+
paginator = described_class.new('http://www.example.com/oai', :retries => 5)
|
188
|
+
|
189
|
+
expect(paginator.retries).to eq(5)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
describe '#interval' do
|
194
|
+
it 'defaults to 10' do
|
195
|
+
paginator = described_class.new('http://www.example.com/oai')
|
196
|
+
|
197
|
+
expect(paginator.interval).to eq(10)
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'can be overridden with an option' do
|
201
|
+
paginator = described_class.new('http://www.example.com/oai', :interval => 15)
|
202
|
+
|
203
|
+
expect(paginator.interval).to eq(15)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
149
207
|
describe '#headers' do
|
150
208
|
it 'defaults to an empty hash' do
|
151
209
|
paginator = described_class.new('http://www.example.com/oai')
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fieldhand/repository'
|
2
4
|
|
3
5
|
module Fieldhand
|
@@ -256,6 +258,34 @@ module Fieldhand
|
|
256
258
|
end
|
257
259
|
end
|
258
260
|
|
261
|
+
describe '#retries' do
|
262
|
+
it 'defaults to 0' do
|
263
|
+
repository = described_class.new('http://www.example.com/oai')
|
264
|
+
|
265
|
+
expect(repository.retries).to be_zero
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'can be overridden with an option' do
|
269
|
+
repository = described_class.new('http://www.example.com/oai', :retries => 5)
|
270
|
+
|
271
|
+
expect(repository.retries).to eq(5)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe '#interval' do
|
276
|
+
it 'defaults to 10' do
|
277
|
+
repository = described_class.new('http://www.example.com/oai')
|
278
|
+
|
279
|
+
expect(repository.interval).to eq(10)
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'can be overridden with an option' do
|
283
|
+
repository = described_class.new('http://www.example.com/oai', :interval => 15)
|
284
|
+
|
285
|
+
expect(repository.interval).to eq(15)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
259
289
|
describe '#headers' do
|
260
290
|
it 'defaults to an empty hash' do
|
261
291
|
repository = described_class.new('http://www.example.com/oai')
|
data/spec/fieldhand/set_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'date'
|
2
4
|
require 'webmock/rspec'
|
3
5
|
|
6
|
+
FIXTURES_DIR = File.expand_path('../fixtures', __FILE__).freeze
|
7
|
+
|
4
8
|
RSpec.configure do |config|
|
5
9
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
6
10
|
config.filter_run_when_matching :focus
|
@@ -21,9 +25,10 @@ RSpec.configure do |config|
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def stub_oai_request(uri, fixture)
|
24
|
-
|
28
|
+
stub_request(:get, uri).to_return(:body => fixture(fixture))
|
29
|
+
end
|
25
30
|
|
26
|
-
|
27
|
-
|
31
|
+
def fixture(fixture)
|
32
|
+
File.read(File.join(FIXTURES_DIR, fixture))
|
28
33
|
end
|
29
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fieldhand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
@@ -9,10 +9,11 @@ authors:
|
|
9
9
|
- Giovanni Derks
|
10
10
|
- Abeer Salameh
|
11
11
|
- Anna Klimas
|
12
|
+
- Marco Bagnasco
|
12
13
|
autorequire:
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
|
-
date:
|
16
|
+
date: 2019-09-28 00:00:00.000000000 Z
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
18
19
|
name: ox
|
@@ -121,7 +122,7 @@ files:
|
|
121
122
|
- spec/fieldhand/repository_spec.rb
|
122
123
|
- spec/fieldhand/set_spec.rb
|
123
124
|
- spec/spec_helper.rb
|
124
|
-
homepage: https://github.com/
|
125
|
+
homepage: https://github.com/fieldhand/fieldhand
|
125
126
|
licenses:
|
126
127
|
- MIT
|
127
128
|
metadata: {}
|
@@ -140,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
- !ruby/object:Gem::Version
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
|
-
|
144
|
-
rubygems_version: 2.6.14
|
144
|
+
rubygems_version: 3.0.3
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: An OAI-PMH harvester
|