purl_fetcher-client 1.5.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/purl_fetcher/client/reader.rb +6 -1
- data/lib/purl_fetcher/client/version.rb +1 -1
- data/lib/purl_fetcher/client.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d52e033a93ce8e113f1d74cc9f30e78e3ba8b1dfb97014ac37b47d713bc3dcf
|
4
|
+
data.tar.gz: 6f7efec5ab930e23572d9f2eed03c45ec620ddc93271f4358b2a423641abbeda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec42596a113ca16234082c0655800ab610e97974342be1ea714ce2937dd3f51e2d5597632a38f51b5b1efa8ddc3bce6cb5be0cd6e2d5d2215665518e698b5b4
|
7
|
+
data.tar.gz: d11740e467d917e3fddafaf746d0810abece79cd735a8e07db1f235284b804a54b935165d3e2064fb43089dbdbd993d8f9243bad8afc8b5cf071cce565fca666
|
@@ -11,6 +11,8 @@ class PurlFetcher::Client::Reader
|
|
11
11
|
@range = {}
|
12
12
|
end
|
13
13
|
|
14
|
+
# @raise [PurlFetcher::Client::NotFoundResponseError] if item is not found
|
15
|
+
# @raise [PurlFetcher::Client::ResponseError] if the response is not successful
|
14
16
|
def collection_members(druid)
|
15
17
|
return to_enum(:collection_members, druid) unless block_given?
|
16
18
|
|
@@ -20,6 +22,8 @@ class PurlFetcher::Client::Reader
|
|
20
22
|
end
|
21
23
|
|
22
24
|
# @return [Array<Hash<String,String>>] a list of hashes where the key is a digest and the value is a filepath/filename
|
25
|
+
# @raise [PurlFetcher::Client::NotFoundResponseError] if item is not found
|
26
|
+
# @raise [PurlFetcher::Client::ResponseError] if the response is not successful
|
23
27
|
def files_by_digest(druid)
|
24
28
|
retrieve_json("/purls/druid:#{druid.delete_prefix('druid:')}", {})
|
25
29
|
.fetch("files_by_md5", [])
|
@@ -33,8 +37,9 @@ class PurlFetcher::Client::Reader
|
|
33
37
|
response = conn.get(path, params: params)
|
34
38
|
|
35
39
|
unless response.success?
|
40
|
+
raise PurlFetcher::Client::NotFoundResponseError, "Item not found" if response.status == 404
|
36
41
|
if defined?(Honeybadger)
|
37
|
-
Honeybadger.context({ path:, params:, response_code: response.
|
42
|
+
Honeybadger.context({ path:, params:, response_code: response.status, body: response.body })
|
38
43
|
end
|
39
44
|
raise PurlFetcher::Client::ResponseError, "Unsuccessful response from purl-fetcher"
|
40
45
|
end
|
data/lib/purl_fetcher/client.rb
CHANGED
@@ -24,6 +24,9 @@ module PurlFetcher
|
|
24
24
|
# Raised when the response from the server is not successful
|
25
25
|
class ResponseError < Error; end
|
26
26
|
|
27
|
+
# Raised when the response from the server indicates that the requested item is not found
|
28
|
+
class NotFoundResponseError < ResponseError; end
|
29
|
+
|
27
30
|
include Singleton
|
28
31
|
class << self
|
29
32
|
def configure(url:, logger: default_logger, token: nil)
|
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.2
|
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-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|