preservation-client 5.1.0 → 5.2.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
  SHA256:
3
- metadata.gz: 37cef3d8d379f6c4f512f3612539aaf3df7a39ded00a94ef6a89ff1f0a37d77a
4
- data.tar.gz: ed4a9e507f33b27bbc553ea134167c2f96d09f09ae04d0a68cd106061031ac40
3
+ metadata.gz: 264c8e3e6d57fc3e422ec89120ee8e65d3c949328b91e45d7ac619d0ee3acc6a
4
+ data.tar.gz: c98d4b2d5fb782808c53812b2858d65bc90b26a606a423227ff83849b5f6dca6
5
5
  SHA512:
6
- metadata.gz: 064c59c79d1866cb8b1d75fe0e47caf15329f0e49704d2ed676ac4908214e84c535d13fbe65f2328083e4ed64b120bd8b8f27d5bc87cbbb03245bb4d4550d8a3
7
- data.tar.gz: 193e07cbc0ba2b36fdd25a1aca99655b4996ad74e05c676d116f43dab640f1b80f99045be012f491b4165eb4a5c15810ef5063fb78302181a7d8e181f0514c7a
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.1.0)
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)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.4)
13
+ activesupport (7.0.4.2)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -20,13 +20,13 @@ GEM
20
20
  ast (2.4.2)
21
21
  byebug (11.1.3)
22
22
  coderay (1.1.3)
23
- concurrent-ruby (1.1.10)
23
+ concurrent-ruby (1.2.0)
24
24
  crack (0.4.5)
25
25
  rexml
26
26
  diff-lcs (1.5.0)
27
27
  docile (1.4.0)
28
28
  druid-tools (3.0.0)
29
- faraday (2.7.2)
29
+ faraday (2.7.4)
30
30
  faraday-net_http (>= 2.0, < 3.1)
31
31
  ruby2_keywords (>= 0.0.4)
32
32
  faraday-net_http (3.0.2)
@@ -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 (5.2.0)
39
+ moab-versioning (6.0.0)
40
40
  druid-tools (>= 1.0.0)
41
41
  json
42
42
  nokogiri
@@ -60,7 +60,7 @@ GEM
60
60
  racc (1.6.2)
61
61
  rainbow (3.1.1)
62
62
  rake (13.0.6)
63
- regexp_parser (2.6.1)
63
+ regexp_parser (2.6.2)
64
64
  rexml (3.2.5)
65
65
  rspec (3.12.0)
66
66
  rspec-core (~> 3.12.0)
@@ -71,11 +71,11 @@ GEM
71
71
  rspec-expectations (3.12.2)
72
72
  diff-lcs (>= 1.2.0, < 2.0)
73
73
  rspec-support (~> 3.12.0)
74
- rspec-mocks (3.12.2)
74
+ rspec-mocks (3.12.3)
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.43.0)
78
+ rubocop (1.44.1)
79
79
  json (~> 2.3)
80
80
  parallel (~> 1.10)
81
81
  parser (>= 3.2.0.0)
@@ -91,9 +91,9 @@ GEM
91
91
  rubocop (~> 1.41)
92
92
  rubocop-rake (0.6.0)
93
93
  rubocop (~> 1.0)
94
- rubocop-rspec (2.18.0)
94
+ rubocop-rspec (2.18.1)
95
95
  rubocop (~> 1.33)
96
- rubocop-capybara
96
+ rubocop-capybara (~> 2.17)
97
97
  ruby-progressbar (1.11.0)
98
98
  ruby2_keywords (0.0.5)
99
99
  simplecov (0.22.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.5)
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.4.4
131
+ 2.4.6
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Preservation
4
4
  class Client
5
- VERSION = '5.1.0'
5
+ VERSION = '5.2.0'
6
6
  end
7
7
  end
@@ -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
- def configure(url:, token:)
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 :url, :connection, :token
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) do |builder|
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.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-17 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport