globus_client 0.16.0 → 0.17.0
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 +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +11 -11
- data/lib/globus_client/endpoint.rb +3 -3
- data/lib/globus_client/errors.rb +30 -0
- data/lib/globus_client/unexpected_response.rb +7 -25
- data/lib/globus_client/version.rb +1 -1
- data/lib/globus_client.rb +1 -0
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e08e97fbfd4a9b84d55f71a12289777a097f650de25717e9823e6bc8654d2237
|
4
|
+
data.tar.gz: ca58e7a6b52206fa2bef9a57f65fb3481ceac9036d07ff3779f9a23e7fbd4b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe82ef0a3bf4bf62ba8ea77d5d504915be2ccb860c28afdd7b2fcfab7231df1df205390d712b7ac83ff21346bd6a28c29c00672fa0bc80105a2a57c82e0bb697
|
7
|
+
data.tar.gz: d26b68220d051ab56d04ed21459a29c64b62fe24aa8012760ae80e0e02d8afd28de764248a7ad69e49292683262ecdc6ce268dbd9244e6bd2b48ab5628a6ed90
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
globus_client (0.
|
4
|
+
globus_client (0.17.0)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
faraday
|
7
7
|
faraday-retry
|
@@ -26,9 +26,9 @@ GEM
|
|
26
26
|
addressable (2.8.7)
|
27
27
|
public_suffix (>= 2.0.2, < 7.0)
|
28
28
|
ast (2.4.3)
|
29
|
-
base64 (0.
|
30
|
-
benchmark (0.4.
|
31
|
-
bigdecimal (3.1
|
29
|
+
base64 (0.3.0)
|
30
|
+
benchmark (0.4.1)
|
31
|
+
bigdecimal (3.2.1)
|
32
32
|
byebug (12.0.0)
|
33
33
|
concurrent-ruby (1.3.5)
|
34
34
|
connection_pool (2.5.3)
|
@@ -64,23 +64,23 @@ GEM
|
|
64
64
|
public_suffix (6.0.2)
|
65
65
|
racc (1.8.1)
|
66
66
|
rainbow (3.1.1)
|
67
|
-
rake (13.
|
67
|
+
rake (13.3.0)
|
68
68
|
regexp_parser (2.10.0)
|
69
69
|
rexml (3.4.1)
|
70
|
-
rspec (3.13.
|
70
|
+
rspec (3.13.1)
|
71
71
|
rspec-core (~> 3.13.0)
|
72
72
|
rspec-expectations (~> 3.13.0)
|
73
73
|
rspec-mocks (~> 3.13.0)
|
74
|
-
rspec-core (3.13.
|
74
|
+
rspec-core (3.13.4)
|
75
75
|
rspec-support (~> 3.13.0)
|
76
|
-
rspec-expectations (3.13.
|
76
|
+
rspec-expectations (3.13.5)
|
77
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
78
78
|
rspec-support (~> 3.13.0)
|
79
|
-
rspec-mocks (3.13.
|
79
|
+
rspec-mocks (3.13.5)
|
80
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
81
|
rspec-support (~> 3.13.0)
|
82
|
-
rspec-support (3.13.
|
83
|
-
rubocop (1.75.
|
82
|
+
rspec-support (3.13.4)
|
83
|
+
rubocop (1.75.8)
|
84
84
|
json (~> 2.3)
|
85
85
|
language_server-protocol (~> 3.17.0.2)
|
86
86
|
lint_roller (~> 1.1.0)
|
@@ -53,7 +53,7 @@ class GlobusClient
|
|
53
53
|
|
54
54
|
# Delete the access rule https://docs.globus.org/api/transfer/acl/#delete_access_rule
|
55
55
|
def delete_access_rule
|
56
|
-
raise
|
56
|
+
raise GlobusClient::AccessRuleNotFound, "Access rule not found for #{path}" unless access_rule_id
|
57
57
|
|
58
58
|
GlobusClient.instance.delete(
|
59
59
|
base_url: GlobusClient.config.transfer_url,
|
@@ -79,7 +79,7 @@ class GlobusClient
|
|
79
79
|
params: { path: }
|
80
80
|
)
|
81
81
|
true
|
82
|
-
rescue GlobusClient::
|
82
|
+
rescue GlobusClient::ResourceNotFound
|
83
83
|
false
|
84
84
|
end
|
85
85
|
|
@@ -168,7 +168,7 @@ class GlobusClient
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def update_access_request(permissions:)
|
171
|
-
raise
|
171
|
+
raise GlobusClient::AccessRuleNotFound, "Access rule not found for #{path}" unless access_rule_id
|
172
172
|
|
173
173
|
GlobusClient.instance.put(
|
174
174
|
base_url: GlobusClient.config.transfer_url,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class GlobusClient
|
4
|
+
# Holds all of the client's custom exception classes
|
5
|
+
module Errors
|
6
|
+
# Error raised when the Globus Auth or Transfer API returns a 400 error
|
7
|
+
class BadRequestError < StandardError; end
|
8
|
+
|
9
|
+
# Error raised by the Globus Auth API returns a 401 Unauthorized
|
10
|
+
class UnauthorizedError < StandardError; end
|
11
|
+
|
12
|
+
# Error raised when the Globus Auth or Transfer API returns a 403 Forbidden
|
13
|
+
class ForbiddenError < StandardError; end
|
14
|
+
|
15
|
+
# Error raised when the Globus Auth or Transfer API returns a 404 NotFound
|
16
|
+
class ResourceNotFound < StandardError; end
|
17
|
+
|
18
|
+
# Error raised when a consumer acts upon an access rule that was not found
|
19
|
+
class AccessRuleNotFound < StandardError; end
|
20
|
+
|
21
|
+
# Error raised when response has an unexpected error (e.g., an HTTP 500)
|
22
|
+
class InternalServerError < StandardError; end
|
23
|
+
|
24
|
+
# Error raised when the Globus Transfer API returns a 502 Bad Gateway
|
25
|
+
class EndpointError < StandardError; end
|
26
|
+
|
27
|
+
# Error raised when the remote server returns a 503 Bad Gateway
|
28
|
+
class ServiceUnavailable < StandardError; end
|
29
|
+
end
|
30
|
+
end
|
@@ -3,24 +3,6 @@
|
|
3
3
|
class GlobusClient
|
4
4
|
# Handles unexpected responses when communicating with Globus
|
5
5
|
class UnexpectedResponse
|
6
|
-
# Error raised when the Globus Auth or Transfer API returns a 400 error
|
7
|
-
class BadRequestError < StandardError; end
|
8
|
-
|
9
|
-
# Error raised by the Globus Auth API returns a 401 Unauthorized
|
10
|
-
class UnauthorizedError < StandardError; end
|
11
|
-
|
12
|
-
# Error raised when the Globus Auth or Transfer API returns a 403 Forbidden
|
13
|
-
class ForbiddenError < StandardError; end
|
14
|
-
|
15
|
-
# Error raised when the Globus Auth or Transfer API returns a 404 NotFound
|
16
|
-
class ResourceNotFound < StandardError; end
|
17
|
-
|
18
|
-
# Error raised when the Globus Transfer API returns a 502 Bad Gateway
|
19
|
-
class EndpointError < StandardError; end
|
20
|
-
|
21
|
-
# Error raised when the remote server returns a 503 Bad Gateway
|
22
|
-
class ServiceUnavailable < StandardError; end
|
23
|
-
|
24
6
|
# @param [Faraday::Response] response
|
25
7
|
# https://docs.globus.org/api/transfer/file_operations/#common_errors
|
26
8
|
# https://docs.globus.org/api/transfer/file_operations/#errors
|
@@ -29,19 +11,19 @@ class GlobusClient
|
|
29
11
|
def self.call(response)
|
30
12
|
case response.status
|
31
13
|
when 400
|
32
|
-
raise BadRequestError, "Invalid path or another error with the request: #{response.body}"
|
14
|
+
raise GlobusClient::BadRequestError, "Invalid path or another error with the request: #{response.body}"
|
33
15
|
when 401
|
34
|
-
raise UnauthorizedError, "There was a problem with the access token: #{response.body} "
|
16
|
+
raise GlobusClient::UnauthorizedError, "There was a problem with the access token: #{response.body} "
|
35
17
|
when 403
|
36
|
-
raise ForbiddenError, "The operation requires privileges which the client does not have: #{response.body}"
|
18
|
+
raise GlobusClient::ForbiddenError, "The operation requires privileges which the client does not have: #{response.body}"
|
37
19
|
when 404
|
38
|
-
raise ResourceNotFound, "Endpoint ID not found or resource does not exist: #{response.body}"
|
20
|
+
raise GlobusClient::ResourceNotFound, "Endpoint ID not found or resource does not exist: #{response.body}"
|
39
21
|
when 502
|
40
|
-
raise EndpointError, "Other error with endpoint: #{response.status} #{response.body}."
|
22
|
+
raise GlobusClient::EndpointError, "Other error with endpoint: #{response.status} #{response.body}."
|
41
23
|
when 503
|
42
|
-
raise ServiceUnavailable, 'The service is down for maintenance.'
|
24
|
+
raise GlobusClient::ServiceUnavailable, 'The service is down for maintenance.'
|
43
25
|
else
|
44
|
-
raise
|
26
|
+
raise GlobusClient::InternalServerError, "Unexpected response: #{response.status} #{response.body}."
|
45
27
|
end
|
46
28
|
end
|
47
29
|
end
|
data/lib/globus_client.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globus_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Collier
|
8
8
|
- Laura Wrubel
|
9
9
|
- Mike Giarlo
|
10
|
-
autorequire:
|
11
10
|
bindir: exe
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: activesupport
|
@@ -91,6 +90,7 @@ files:
|
|
91
90
|
- lib/globus_client/authenticator.rb
|
92
91
|
- lib/globus_client/endpoint.rb
|
93
92
|
- lib/globus_client/endpoint_manager.rb
|
93
|
+
- lib/globus_client/errors.rb
|
94
94
|
- lib/globus_client/identity.rb
|
95
95
|
- lib/globus_client/unexpected_response.rb
|
96
96
|
- lib/globus_client/version.rb
|
@@ -101,7 +101,6 @@ metadata:
|
|
101
101
|
source_code_uri: https://github.com/sul-dlss/globus_client
|
102
102
|
changelog_uri: https://github.com/sul-dlss/globus_client/releases
|
103
103
|
rubygems_mfa_required: 'true'
|
104
|
-
post_install_message:
|
105
104
|
rdoc_options: []
|
106
105
|
require_paths:
|
107
106
|
- lib
|
@@ -116,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: '0'
|
118
117
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
120
|
-
signing_key:
|
118
|
+
rubygems_version: 3.6.9
|
121
119
|
specification_version: 4
|
122
120
|
summary: Interface for interacting with the Globus API.
|
123
121
|
test_files: []
|