preservation-client 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40602017c072b2c6acf9ac778a53171a10102477e0783f42c18006b6783d3cc2
|
|
4
|
+
data.tar.gz: 8069794031fff97a91cfb4a8e43dab2f4112f01659d9157aa2347c1cbf06d70e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3caae88635c58bc4ff0fdee436cad522c3442855dbc9cde2ccdda6570a9ac310f27645e6171438cc29b102c69bcb9b94d5d75e06cec443b333d3cf885c5795e
|
|
7
|
+
data.tar.gz: 459b15285b9231257d0c28da3ba22a8f40942aed7f334f8aa8dc1aa83a6bfafd3137eb214a799cdd71fac4c6760df45987b1c1b45d7b5910de227cba407b1df9
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2019-09-
|
|
3
|
+
# on 2019-09-25 11:19:34 -0700 using RuboCop version 0.74.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
# Offense count: 2
|
|
10
10
|
Metrics/AbcSize:
|
|
11
|
-
Max:
|
|
11
|
+
Max: 31
|
|
@@ -28,7 +28,7 @@ module Preservation
|
|
|
28
28
|
status_info = status_msg.blank? ? status_code : "#{status_msg} (#{status_code})"
|
|
29
29
|
object_id_info = " for #{object_id}" if object_id.present?
|
|
30
30
|
|
|
31
|
-
"Preservation::Client.#{client_method_name}#{object_id_info} got #{status_info} from Preservation
|
|
31
|
+
"Preservation::Client.#{client_method_name}#{object_id_info} got #{status_info} from Preservation at #{req_url}: #{body}"
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -15,21 +15,27 @@ module Preservation
|
|
|
15
15
|
|
|
16
16
|
# @param path [String] path to be appended to connection url (no leading slash)
|
|
17
17
|
def get_json(path, object_id, caller_method_name)
|
|
18
|
+
req_url = api_version.present? ? "#{api_version}/#{path}" : path
|
|
18
19
|
resp = connection.get do |req|
|
|
19
|
-
req.url
|
|
20
|
+
req.url req_url
|
|
20
21
|
req.headers['Content-Type'] = 'application/json'
|
|
21
22
|
req.headers['Accept'] = 'application/json'
|
|
22
23
|
end
|
|
23
24
|
return JSON.parse(resp.body).with_indifferent_access if resp.success?
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if resp.status == 404
|
|
27
|
+
errmsg = "#{object_id} not found in Preservation at #{connection.url_prefix}#{req_url}"
|
|
28
|
+
raise Preservation::Client::NotFoundError, errmsg
|
|
29
|
+
else
|
|
30
|
+
errmsg = ResponseErrorFormatter
|
|
31
|
+
.format(response: resp, object_id: object_id, client_method_name: caller_method_name)
|
|
32
|
+
raise Preservation::Client::UnexpectedResponseError, errmsg
|
|
33
|
+
end
|
|
28
34
|
rescue Faraday::ResourceNotFound => e
|
|
29
|
-
errmsg = "HTTP GET to #{connection.url_prefix}#{
|
|
35
|
+
errmsg = "HTTP GET to #{connection.url_prefix}#{req_url} failed with #{e.class}: #{e.message}"
|
|
30
36
|
raise Preservation::Client::NotFoundError, errmsg
|
|
31
37
|
rescue Faraday::ParsingError, Faraday::RetriableResponse => e
|
|
32
|
-
errmsg = "HTTP GET to #{connection.url_prefix}#{
|
|
38
|
+
errmsg = "HTTP GET to #{connection.url_prefix}#{req_url} failed with #{e.class}: #{e.message}"
|
|
33
39
|
raise Preservation::Client::UnexpectedResponseError, errmsg
|
|
34
40
|
end
|
|
35
41
|
|
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: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Naomi Dushay
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-09-
|
|
11
|
+
date: 2019-09-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|