preservation-client 5.1.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/lib/preservation/client/version.rb +1 -1
- data/lib/preservation/client.rb +11 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 264c8e3e6d57fc3e422ec89120ee8e65d3c949328b91e45d7ac619d0ee3acc6a
|
4
|
+
data.tar.gz: c98d4b2d5fb782808c53812b2858d65bc90b26a606a423227ff83849b5f6dca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea57d957febb7da750c62784e3af22213e3ae40200edb75acfc98f5eb5a9be8b03261a333cbd775a14eeb53580b8380d0d7c94828b99dd5f7b3644e3e918d67
|
7
|
+
data.tar.gz: 935c2ac4854dc91813242402fc51d6b88e00e31b70ca94a11feaf51c5acea90655bf434730afa7cca11e651f0c7fb180a6eb155fbb33adf2846859f90a5d6bc1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
preservation-client (5.
|
4
|
+
preservation-client (5.2.0)
|
5
5
|
activesupport (>= 4.2, < 8)
|
6
6
|
faraday (~> 2.0)
|
7
7
|
moab-versioning (>= 5.0.0, < 7)
|
@@ -36,7 +36,7 @@ GEM
|
|
36
36
|
json (2.6.3)
|
37
37
|
method_source (1.0.0)
|
38
38
|
minitest (5.17.0)
|
39
|
-
moab-versioning (
|
39
|
+
moab-versioning (6.0.0)
|
40
40
|
druid-tools (>= 1.0.0)
|
41
41
|
json
|
42
42
|
nokogiri
|
@@ -75,7 +75,7 @@ GEM
|
|
75
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
76
76
|
rspec-support (~> 3.12.0)
|
77
77
|
rspec-support (3.12.0)
|
78
|
-
rubocop (1.
|
78
|
+
rubocop (1.44.1)
|
79
79
|
json (~> 2.3)
|
80
80
|
parallel (~> 1.10)
|
81
81
|
parser (>= 3.2.0.0)
|
@@ -102,7 +102,7 @@ GEM
|
|
102
102
|
simplecov_json_formatter (~> 0.1)
|
103
103
|
simplecov-html (0.12.3)
|
104
104
|
simplecov_json_formatter (0.1.4)
|
105
|
-
tzinfo (2.0.
|
105
|
+
tzinfo (2.0.6)
|
106
106
|
concurrent-ruby (~> 1.0)
|
107
107
|
unicode-display_width (2.4.2)
|
108
108
|
webmock (3.18.1)
|
@@ -128,4 +128,4 @@ DEPENDENCIES
|
|
128
128
|
webmock
|
129
129
|
|
130
130
|
BUNDLED WITH
|
131
|
-
2.
|
131
|
+
2.4.6
|
data/lib/preservation/client.rb
CHANGED
@@ -32,6 +32,7 @@ module Preservation
|
|
32
32
|
class ConnectionFailedError < Error; end
|
33
33
|
|
34
34
|
DEFAULT_API_VERSION = 'v1'
|
35
|
+
DEFAULT_TIMEOUT = 300
|
35
36
|
TOKEN_HEADER = 'Authorization'
|
36
37
|
|
37
38
|
include Singleton
|
@@ -47,11 +48,13 @@ module Preservation
|
|
47
48
|
end
|
48
49
|
|
49
50
|
class << self
|
50
|
-
# @param [String] url
|
51
|
+
# @param [String] url the endpoint URL
|
51
52
|
# @param [String] token a bearer token for HTTP authentication
|
52
|
-
|
53
|
+
# @param [Integer] read_timeout the value in seconds of the read timeout
|
54
|
+
def configure(url:, token:, read_timeout: DEFAULT_TIMEOUT)
|
53
55
|
instance.url = url
|
54
56
|
instance.token = token
|
57
|
+
instance.read_timeout = read_timeout
|
55
58
|
|
56
59
|
# Force connection to be re-established when `.configure` is called
|
57
60
|
instance.connection = nil
|
@@ -62,7 +65,7 @@ module Preservation
|
|
62
65
|
delegate :objects, :update, to: :instance
|
63
66
|
end
|
64
67
|
|
65
|
-
attr_writer :
|
68
|
+
attr_writer :connection, :read_timeout, :token, :url
|
66
69
|
|
67
70
|
delegate :update, to: :catalog
|
68
71
|
|
@@ -76,8 +79,12 @@ module Preservation
|
|
76
79
|
@token || raise(Error, 'auth token has not been configured')
|
77
80
|
end
|
78
81
|
|
82
|
+
def read_timeout
|
83
|
+
@read_timeout || raise(Error, 'read timeout has not been configured')
|
84
|
+
end
|
85
|
+
|
79
86
|
def connection
|
80
|
-
@connection ||= Faraday.new(url, request: { read_timeout:
|
87
|
+
@connection ||= Faraday.new(url, request: { read_timeout: read_timeout }) do |builder|
|
81
88
|
builder.use ErrorFaradayMiddleware
|
82
89
|
builder.use Faraday::Request::UrlEncoded
|
83
90
|
builder.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x responses
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: preservation-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01
|
11
|
+
date: 2023-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -240,7 +240,7 @@ metadata:
|
|
240
240
|
homepage_uri: https://github.com/sul-dlss/preservation-client
|
241
241
|
source_code_uri: https://github.com/sul-dlss/preservation-client.
|
242
242
|
rubygems_mfa_required: 'true'
|
243
|
-
post_install_message:
|
243
|
+
post_install_message:
|
244
244
|
rdoc_options: []
|
245
245
|
require_paths:
|
246
246
|
- lib
|
@@ -255,8 +255,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: '0'
|
257
257
|
requirements: []
|
258
|
-
rubygems_version: 3.
|
259
|
-
signing_key:
|
258
|
+
rubygems_version: 3.2.32
|
259
|
+
signing_key:
|
260
260
|
specification_version: 4
|
261
261
|
summary: A thin client for getting info from SDR preservation.
|
262
262
|
test_files: []
|