purl_fetcher-client 1.5.0 → 1.5.1
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 +5 -0
- data/lib/purl_fetcher/client/version.rb +1 -1
- data/lib/purl_fetcher/client.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123f98e808fb6578e4f194d380d4d1d651735dbe8c5114b40b4d2348eb729a8c
|
4
|
+
data.tar.gz: 66996f257ec6210d4bd822335b3511e9877122e6203f6818e7ed4b9284a53c6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a51f4a44b7b7b1bb070a7aa7f9dbe4faf8281eb5d4dd1448990104659f3ecce3ac7ce30d81aa6144579b1a801fd73a6b55bd9a7f075377e6070b2f5aa5c274b
|
7
|
+
data.tar.gz: 919bb94098bdec558dfec580bce657af55879eee46abdbedb441520f27f29557f4f583d1da8ac2446ee346f2937df80e2d980f934566bcaee973a792622f0386
|
@@ -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", [])
|
@@ -36,6 +40,7 @@ class PurlFetcher::Client::Reader
|
|
36
40
|
if defined?(Honeybadger)
|
37
41
|
Honeybadger.context({ path:, params:, response_code: response.code, body: response.body })
|
38
42
|
end
|
43
|
+
raise PurlFetcher::Client::NotFoundResponseError, "Item not found" if response.status == 404
|
39
44
|
raise PurlFetcher::Client::ResponseError, "Unsuccessful response from purl-fetcher"
|
40
45
|
end
|
41
46
|
|
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)
|