purl_fetcher-client 1.5.1 → 1.5.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26e9001f37819798fcdd911a7a98778a60dcbb6d67eb1d9bdafc2fd4e9eeb757
|
4
|
+
data.tar.gz: f57db80c799b563e0b8e0863ea35b1ffcd54413373a3f645a4478ee6f8ee571b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c177d00f8b223863246ed9641ddca70c53fe447d167b1e85ee32b13cff76ef8ee4ef91e21e21ebd6aea7b91544ecabbcab65f84232954e77c2294e0123f4f8e3
|
7
|
+
data.tar.gz: d19fe944a5839c3177e57a84fcf0241fcf2c92a13cd6a86467db22981340e65dd8c5f04452db890a510e6a78eede456dd879e9d9f80309648548c2ecc9cfcf82
|
@@ -37,10 +37,10 @@ class PurlFetcher::Client::Reader
|
|
37
37
|
response = conn.get(path, params: params)
|
38
38
|
|
39
39
|
unless response.success?
|
40
|
+
raise PurlFetcher::Client::NotFoundResponseError, "Item not found" if response.status == 404
|
40
41
|
if defined?(Honeybadger)
|
41
|
-
Honeybadger.context({ path:, params:, response_code: response.
|
42
|
+
Honeybadger.context({ path:, params:, response_code: response.status, body: response.body })
|
42
43
|
end
|
43
|
-
raise PurlFetcher::Client::NotFoundResponseError, "Item not found" if response.status == 404
|
44
44
|
raise PurlFetcher::Client::ResponseError, "Unsuccessful response from purl-fetcher"
|
45
45
|
end
|
46
46
|
|
@@ -5,6 +5,7 @@ module PurlFetcher
|
|
5
5
|
# Delete an item from the purl-fetcher cache
|
6
6
|
class Unpublish
|
7
7
|
# @param [String] druid the identifier of the item
|
8
|
+
# @raise [Purl::Fetcher::Client::AlreadyDeletedResponseError] if the item is already deleted
|
8
9
|
def self.unpublish(druid:)
|
9
10
|
new(druid:).unpublish
|
10
11
|
end
|
@@ -18,6 +19,7 @@ module PurlFetcher
|
|
18
19
|
logger.debug("Starting a unpublish request for: #{druid}")
|
19
20
|
response = client.delete(path:)
|
20
21
|
logger.debug("Unpublish request complete")
|
22
|
+
response
|
21
23
|
end
|
22
24
|
|
23
25
|
private
|
data/lib/purl_fetcher/client.rb
CHANGED
@@ -27,6 +27,9 @@ module PurlFetcher
|
|
27
27
|
# Raised when the response from the server indicates that the requested item is not found
|
28
28
|
class NotFoundResponseError < ResponseError; end
|
29
29
|
|
30
|
+
# Raised when the response from the server indicates that the requested item is already deleted
|
31
|
+
class AlreadyDeletedResponseError < ResponseError; end
|
32
|
+
|
30
33
|
include Singleton
|
31
34
|
class << self
|
32
35
|
def configure(url:, logger: default_logger, token: nil)
|
@@ -53,6 +56,7 @@ module PurlFetcher
|
|
53
56
|
def delete(path:)
|
54
57
|
response = connection.delete(path)
|
55
58
|
|
59
|
+
raise AlreadyDeletedResponseError, response.body if response.status == 409
|
56
60
|
raise "unexpected response: #{response.status} #{response.body}" unless response.success?
|
57
61
|
|
58
62
|
response.body
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purl_fetcher-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|