preservation-client 7.0.0 → 7.0.2

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: 9ea7074b6f7968d89b5fad106ff66fe8d15b5fa1d9995396bcafb05c348bb764
4
- data.tar.gz: 0b724aabce34538335e7e1ec55fe62ad799d7d3c97c49e6e980f597ca3c05161
3
+ metadata.gz: 7c55fa0bed2687892cfd900f38fab8b3f6c7933e1117ef8feed4787cbc04fb57
4
+ data.tar.gz: 18396235dd39f9e0db02c701519b1fccf363fc6876b9da1126cf6a08810ee849
5
5
  SHA512:
6
- metadata.gz: 0435faf772dfec04d6c53c9a9c7bf5700598b1bc0b9bbb77497bb65e2e81c819474ff421cfeef5bcbcb24bafe1436546513424e1e0f81e49432bd57fd56efd35
7
- data.tar.gz: 403420c16c0f3224fe64b5a70c5ae1e80f4e80470a6a93e392abb375a8de60acced13630ebf51a49ea118874a73b101217cef8076a50ff61e7385340846f457f
6
+ metadata.gz: 888b401a7e808c4b63e23150c3285d5ce615dd013597004326dce5c9dddf0eeb434edb015d141332821d9221ba844a0e6e95b3d1297ba789c00f050e49834561
7
+ data.tar.gz: f5a11ebd6c893fb9706b311cae7659c14ece2b1cb08d3c94f34c8958522a1dd7a5b53014f398a5ae8e9b736b4dbcdb6aa7ad692a8afbacbbcaf04976847543f5
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@4.1.0
3
+ ruby-rails: sul-dlss/ruby-rails@4.2.3
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- preservation-client (7.0.0)
4
+ preservation-client (7.0.2)
5
5
  activesupport (>= 4.2, < 8)
6
6
  faraday (~> 2.0)
7
7
  moab-versioning (>= 5.0.0, < 7)
@@ -10,47 +10,66 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.7.2)
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ activesupport (7.2.2.1)
14
+ base64
15
+ benchmark (>= 0.3)
16
+ bigdecimal
17
+ concurrent-ruby (~> 1.0, >= 1.3.1)
18
+ connection_pool (>= 2.2.5)
19
+ drb
15
20
  i18n (>= 1.6, < 2)
21
+ logger (>= 1.4.2)
16
22
  minitest (>= 5.1)
17
- tzinfo (~> 2.0)
18
- addressable (2.8.5)
19
- public_suffix (>= 2.0.2, < 6.0)
23
+ securerandom (>= 0.3)
24
+ tzinfo (~> 2.0, >= 2.0.5)
25
+ addressable (2.8.7)
26
+ public_suffix (>= 2.0.2, < 7.0)
20
27
  ast (2.4.2)
21
- base64 (0.1.1)
28
+ base64 (0.2.0)
29
+ benchmark (0.4.0)
30
+ bigdecimal (3.1.9)
22
31
  byebug (11.1.3)
23
32
  coderay (1.1.3)
24
- concurrent-ruby (1.2.2)
25
- crack (0.4.5)
33
+ concurrent-ruby (1.3.5)
34
+ connection_pool (2.5.0)
35
+ crack (1.0.0)
36
+ bigdecimal
26
37
  rexml
27
- diff-lcs (1.5.0)
28
- docile (1.4.0)
38
+ diff-lcs (1.5.1)
39
+ docile (1.4.1)
40
+ drb (2.2.1)
29
41
  druid-tools (3.0.0)
30
- faraday (2.7.10)
31
- faraday-net_http (>= 2.0, < 3.1)
32
- ruby2_keywords (>= 0.0.4)
33
- faraday-net_http (3.0.2)
34
- hashdiff (1.0.1)
35
- i18n (1.14.1)
42
+ faraday (2.12.2)
43
+ faraday-net_http (>= 2.0, < 3.5)
44
+ json
45
+ logger
46
+ faraday-net_http (3.4.0)
47
+ net-http (>= 0.5.0)
48
+ hashdiff (1.1.2)
49
+ i18n (1.14.7)
36
50
  concurrent-ruby (~> 1.0)
37
- json (2.6.3)
51
+ json (2.9.1)
38
52
  language_server-protocol (3.17.0.3)
39
- method_source (1.0.0)
40
- minitest (5.19.0)
53
+ logger (1.6.5)
54
+ method_source (1.1.0)
55
+ minitest (5.25.4)
41
56
  moab-versioning (6.1.0)
42
57
  druid-tools (>= 1.0.0)
43
58
  json
44
59
  nokogiri
45
60
  nokogiri-happymapper
46
- nokogiri (1.15.4-x86_64-darwin)
61
+ net-http (0.6.0)
62
+ uri
63
+ nokogiri (1.18.2-arm64-darwin)
64
+ racc (~> 1.4)
65
+ nokogiri (1.18.2-x86_64-darwin)
47
66
  racc (~> 1.4)
48
- nokogiri (1.15.4-x86_64-linux)
67
+ nokogiri (1.18.2-x86_64-linux-gnu)
49
68
  racc (~> 1.4)
50
- nokogiri-happymapper (0.9.0)
69
+ nokogiri-happymapper (0.10.0)
51
70
  nokogiri (~> 1.5)
52
- parallel (1.23.0)
53
- parser (3.2.2.3)
71
+ parallel (1.26.3)
72
+ parser (3.3.7.0)
54
73
  ast (~> 2.4.1)
55
74
  racc
56
75
  pry (0.14.2)
@@ -59,67 +78,73 @@ GEM
59
78
  pry-byebug (3.10.1)
60
79
  byebug (~> 11.0)
61
80
  pry (>= 0.13, < 0.15)
62
- public_suffix (5.0.3)
63
- racc (1.7.1)
81
+ public_suffix (6.0.1)
82
+ racc (1.8.1)
64
83
  rainbow (3.1.1)
65
- rake (13.0.6)
66
- regexp_parser (2.8.1)
67
- rexml (3.2.6)
68
- rspec (3.12.0)
69
- rspec-core (~> 3.12.0)
70
- rspec-expectations (~> 3.12.0)
71
- rspec-mocks (~> 3.12.0)
72
- rspec-core (3.12.2)
73
- rspec-support (~> 3.12.0)
74
- rspec-expectations (3.12.3)
84
+ rake (13.2.1)
85
+ regexp_parser (2.10.0)
86
+ rexml (3.4.0)
87
+ rspec (3.13.0)
88
+ rspec-core (~> 3.13.0)
89
+ rspec-expectations (~> 3.13.0)
90
+ rspec-mocks (~> 3.13.0)
91
+ rspec-core (3.13.2)
92
+ rspec-support (~> 3.13.0)
93
+ rspec-expectations (3.13.3)
75
94
  diff-lcs (>= 1.2.0, < 2.0)
76
- rspec-support (~> 3.12.0)
77
- rspec-mocks (3.12.6)
95
+ rspec-support (~> 3.13.0)
96
+ rspec-mocks (3.13.2)
78
97
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.12.0)
80
- rspec-support (3.12.1)
81
- rubocop (1.56.1)
82
- base64 (~> 0.1.1)
98
+ rspec-support (~> 3.13.0)
99
+ rspec-support (3.13.2)
100
+ rubocop (1.71.0)
83
101
  json (~> 2.3)
84
102
  language_server-protocol (>= 3.17.0)
85
103
  parallel (~> 1.10)
86
- parser (>= 3.2.2.3)
104
+ parser (>= 3.3.0.2)
87
105
  rainbow (>= 2.2.2, < 4.0)
88
- regexp_parser (>= 1.8, < 3.0)
89
- rexml (>= 3.2.5, < 4.0)
90
- rubocop-ast (>= 1.28.1, < 2.0)
106
+ regexp_parser (>= 2.9.3, < 3.0)
107
+ rubocop-ast (>= 1.36.2, < 2.0)
91
108
  ruby-progressbar (~> 1.7)
92
- unicode-display_width (>= 2.4.0, < 3.0)
93
- rubocop-ast (1.29.0)
94
- parser (>= 3.2.1.0)
95
- rubocop-capybara (2.18.0)
109
+ unicode-display_width (>= 2.4.0, < 4.0)
110
+ rubocop-ast (1.37.0)
111
+ parser (>= 3.3.1.0)
112
+ rubocop-capybara (2.21.0)
96
113
  rubocop (~> 1.41)
97
- rubocop-factory_bot (2.23.1)
98
- rubocop (~> 1.33)
114
+ rubocop-factory_bot (2.26.1)
115
+ rubocop (~> 1.61)
99
116
  rubocop-rake (0.6.0)
100
117
  rubocop (~> 1.0)
101
- rubocop-rspec (2.23.2)
102
- rubocop (~> 1.33)
118
+ rubocop-rspec (2.31.0)
119
+ rubocop (~> 1.40)
103
120
  rubocop-capybara (~> 2.17)
104
121
  rubocop-factory_bot (~> 2.22)
122
+ rubocop-rspec_rails (~> 2.28)
123
+ rubocop-rspec_rails (2.29.1)
124
+ rubocop (~> 1.61)
105
125
  ruby-progressbar (1.13.0)
106
- ruby2_keywords (0.0.5)
126
+ securerandom (0.4.1)
107
127
  simplecov (0.22.0)
108
128
  docile (~> 1.1)
109
129
  simplecov-html (~> 0.11)
110
130
  simplecov_json_formatter (~> 0.1)
111
- simplecov-html (0.12.3)
131
+ simplecov-html (0.13.1)
112
132
  simplecov_json_formatter (0.1.4)
113
133
  tzinfo (2.0.6)
114
134
  concurrent-ruby (~> 1.0)
115
- unicode-display_width (2.4.2)
116
- webmock (3.19.0)
135
+ unicode-display_width (3.1.4)
136
+ unicode-emoji (~> 4.0, >= 4.0.4)
137
+ unicode-emoji (4.0.4)
138
+ uri (1.0.2)
139
+ webmock (3.24.0)
117
140
  addressable (>= 2.8.0)
118
141
  crack (>= 0.3.2)
119
142
  hashdiff (>= 0.4.0, < 2.0.0)
120
- zeitwerk (2.6.11)
143
+ zeitwerk (2.7.1)
121
144
 
122
145
  PLATFORMS
146
+ arm64-darwin-23
147
+ arm64-darwin-24
123
148
  x86_64-darwin-19
124
149
  x86_64-darwin-20
125
150
  x86_64-darwin-21
@@ -13,23 +13,25 @@ module Preservation
13
13
  new(response: response, object_id: object_id, client_method_name: client_method_name).format
14
14
  end
15
15
 
16
- attr_reader :req_url, :status_msg, :status_code, :body, :object_id, :client_method_name
17
-
18
16
  def initialize(response:, object_id: nil, client_method_name: nil)
19
17
  @req_url = response.env.url
20
18
  @status_msg = response.reason_phrase
21
19
  @status_code = response.status
22
20
  @body = response.body.present? ? response.body : DEFAULT_BODY
23
- @object_id = object_id
21
+ @id = object_id
24
22
  @client_method_name = client_method_name
25
23
  end
26
24
 
27
25
  def format
28
26
  status_info = status_msg.blank? ? status_code : "#{status_msg} (#{status_code})"
29
- object_id_info = " for #{object_id}" if object_id.present?
27
+ object_id_info = " for #{id}" if id.present?
30
28
 
31
29
  "Preservation::Client.#{client_method_name}#{object_id_info} got #{status_info} from Preservation at #{req_url}: #{body}"
32
30
  end
31
+
32
+ private
33
+
34
+ attr_reader :req_url, :status_msg, :status_code, :body, :id, :client_method_name
33
35
  end
34
36
  end
35
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Preservation
4
4
  class Client
5
- VERSION = '7.0.0'
5
+ VERSION = '7.0.2'
6
6
  end
7
7
  end
@@ -41,8 +41,16 @@ module Preservation
41
41
  def get(path, params, on_data:)
42
42
  return http_response(:get, path, params) unless on_data
43
43
 
44
+ req_url = "#{api_version}/#{path}"
44
45
  connection.get("#{api_version}/#{path}", params) do |req|
45
- req.options.on_data = on_data
46
+ req.options.on_data = proc do |chunk, size, env|
47
+ if env.status >= 300
48
+ errmsg = "Preservation::Client.#{caller_locations.first.label} " \
49
+ "got #{env.status} from Preservation at #{req_url}"
50
+ raise http_exception_class(env.status), errmsg
51
+ end
52
+ on_data.call(chunk, size, env)
53
+ end
46
54
  end
47
55
  end
48
56
 
@@ -101,6 +109,8 @@ module Preservation
101
109
  # @param status_code [Integer] the HTTP status code to translate to an exception class
102
110
  def http_exception_class(status_code)
103
111
  case status_code
112
+ when 404
113
+ NotFoundError
104
114
  when 423
105
115
  LockedError
106
116
  when 409
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: preservation-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-09-01 00:00:00.000000000 Z
10
+ date: 2025-01-28 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -240,7 +239,6 @@ metadata:
240
239
  homepage_uri: https://github.com/sul-dlss/preservation-client
241
240
  source_code_uri: https://github.com/sul-dlss/preservation-client.
242
241
  rubygems_mfa_required: 'true'
243
- post_install_message:
244
242
  rdoc_options: []
245
243
  require_paths:
246
244
  - lib
@@ -255,8 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
253
  - !ruby/object:Gem::Version
256
254
  version: '0'
257
255
  requirements: []
258
- rubygems_version: 3.3.7
259
- signing_key:
256
+ rubygems_version: 3.6.2
260
257
  specification_version: 4
261
258
  summary: A thin client for getting info from SDR preservation.
262
259
  test_files: []