globus_client 0.11.1 → 0.12.1

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: 0412735516a2cde5c06f65eff24feeedbcdfa68fd845c4ddb02291c1c08e91bb
4
- data.tar.gz: f58c3b2f559a1a99f64e8b426fc926085f96b82e0afd85876143fee6f1ac7a4d
3
+ metadata.gz: 65d27626412e2eff8ff6514be3ece81fd5f27e471137fcfd8409e51cd6e0f105
4
+ data.tar.gz: 321b1d89734daacb8ad54487836a68f1fdf1af931fad426d72ec35bc2f355ec8
5
5
  SHA512:
6
- metadata.gz: 65c26e4b278f537813ffcd4438ead6c44e08f735bd34e17e77f463aec1bbed3de85960788eab65c8635b41cc3466b95c033ef33e18970b888fa2dbdb85bd153f
7
- data.tar.gz: 1077d87cb4b0a5314a91268213f9a9fa6c0a7015e8bacc580e9cfb3ef0940409abf8f086cbdf73db973f888d1950ff3db8199c87eeb974aeab6682a3c3840e31
6
+ metadata.gz: a4ce82aac85e8c00df5310cdb3b4f821cd1415ee0d525938562b20d97c86f330707691a8ee69dcbfeee53d0e20064f78fd902678d5aa4a0113cc7ce38f209c9a
7
+ data.tar.gz: 75888830f1b0660f78d551eb3fd2a323f40fb21e5ac9a361c0f8ea22be0b32a11a014dd42719e4b25c33f5f497e2d1b6b296c8db15f5dc89abaed5d4f03ff5e1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- globus_client (0.11.1)
4
+ globus_client (0.12.1)
5
5
  activesupport (>= 4.2, < 8)
6
6
  faraday
7
7
  faraday-retry
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.7)
13
+ activesupport (7.0.8)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -25,7 +25,8 @@ GEM
25
25
  rexml
26
26
  diff-lcs (1.5.0)
27
27
  docile (1.4.0)
28
- faraday (2.7.10)
28
+ faraday (2.7.11)
29
+ base64
29
30
  faraday-net_http (>= 2.0, < 3.1)
30
31
  ruby2_keywords (>= 0.0.4)
31
32
  faraday-net_http (3.0.2)
@@ -37,7 +38,7 @@ GEM
37
38
  json (2.6.3)
38
39
  language_server-protocol (3.17.0.3)
39
40
  lint_roller (1.1.0)
40
- minitest (5.19.0)
41
+ minitest (5.20.0)
41
42
  parallel (1.23.0)
42
43
  parser (3.2.2.3)
43
44
  ast (~> 2.4.1)
@@ -61,7 +62,7 @@ GEM
61
62
  diff-lcs (>= 1.2.0, < 2.0)
62
63
  rspec-support (~> 3.12.0)
63
64
  rspec-support (3.12.1)
64
- rubocop (1.56.1)
65
+ rubocop (1.56.3)
65
66
  base64 (~> 0.1.1)
66
67
  json (~> 2.3)
67
68
  language_server-protocol (>= 3.17.0)
@@ -77,12 +78,12 @@ GEM
77
78
  parser (>= 3.2.1.0)
78
79
  rubocop-capybara (2.18.0)
79
80
  rubocop (~> 1.41)
80
- rubocop-factory_bot (2.23.1)
81
+ rubocop-factory_bot (2.24.0)
81
82
  rubocop (~> 1.33)
82
- rubocop-performance (1.19.0)
83
+ rubocop-performance (1.19.1)
83
84
  rubocop (>= 1.7.0, < 2.0)
84
85
  rubocop-ast (>= 0.4.0)
85
- rubocop-rspec (2.23.2)
86
+ rubocop-rspec (2.24.0)
86
87
  rubocop (~> 1.33)
87
88
  rubocop-capybara (~> 2.17)
88
89
  rubocop-factory_bot (~> 2.22)
@@ -94,10 +95,10 @@ GEM
94
95
  simplecov_json_formatter (~> 0.1)
95
96
  simplecov-html (0.12.3)
96
97
  simplecov_json_formatter (0.1.4)
97
- standard (1.31.0)
98
+ standard (1.31.1)
98
99
  language_server-protocol (~> 3.17.0.2)
99
100
  lint_roller (~> 1.0)
100
- rubocop (~> 1.56.0)
101
+ rubocop (~> 1.56.2)
101
102
  standard-custom (~> 1.0.0)
102
103
  standard-performance (~> 1.2)
103
104
  standard-custom (1.0.2)
@@ -109,7 +110,7 @@ GEM
109
110
  tzinfo (2.0.6)
110
111
  concurrent-ruby (~> 1.0)
111
112
  unicode-display_width (2.4.2)
112
- webmock (3.18.1)
113
+ webmock (3.19.1)
113
114
  addressable (>= 2.8.0)
114
115
  crack (>= 0.3.2)
115
116
  hashdiff (>= 0.4.0, < 2.0.0)
data/api_test.rb CHANGED
@@ -21,8 +21,8 @@ Benchmark.bm(20) do |benchmark|
21
21
  GlobusClient.mkdir(user_id:, path:)
22
22
  end
23
23
 
24
- benchmark.report("user_exists?:") do
25
- @user_exists = GlobusClient.user_exists?(user_id)
24
+ benchmark.report("user_valid?:") do
25
+ @user_exists = GlobusClient.user_valid?(user_id)
26
26
  end
27
27
 
28
28
  benchmark.report("before_perms:") do
@@ -199,7 +199,8 @@ class GlobusClient
199
199
 
200
200
  # debugging of Globus responses
201
201
  response_body = JSON.parse(response.body)
202
- raise(StandardError, "Response is missing DATA in: #{response_body}") unless response_body.key?("DATA")
202
+
203
+ UnexpectedResponse.call(response, message: "Response is missing DATA in: #{response_body}") unless response.success? && response_body.key?("DATA")
203
204
 
204
205
  JSON
205
206
  .parse(response.body)["DATA"]
@@ -26,7 +26,7 @@ class GlobusClient
26
26
  # https://docs.globus.org/api/transfer/file_operations/#errors
27
27
  # https://docs.globus.org/api/transfer/acl/#common_errors
28
28
  # https://docs.globus.org/api/auth/reference/
29
- def self.call(response)
29
+ def self.call(response, message: "")
30
30
  case response.status
31
31
  when 400
32
32
  raise BadRequestError, "Invalid path or another error with the request: #{response.body}"
@@ -37,11 +37,11 @@ class GlobusClient
37
37
  when 404
38
38
  raise ResourceNotFound, "Endpoint ID not found or resource does not exist: #{response.body}"
39
39
  when 502
40
- raise EndpointError, "Other error with endpoint: #{response.body}"
40
+ raise EndpointError, "Other error with endpoint: #{response.status} #{response.body}. #{message}"
41
41
  when 503
42
42
  raise ServiceUnavailable, "The service is down for maintenance."
43
43
  else
44
- raise StandardError, "Unexpected response: #{response.status} #{response.body}"
44
+ raise StandardError, "Unexpected response: #{response.status} #{response.body}. #{message}"
45
45
  end
46
46
  end
47
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GlobusClient
4
- VERSION = "0.11.1"
4
+ VERSION = "0.12.1"
5
5
  end
data/lib/globus_client.rb CHANGED
@@ -23,7 +23,17 @@ class GlobusClient
23
23
  # @param auth_url [String] the authentication API URL
24
24
  def configure(client_id:, client_secret:, uploads_directory:, transfer_endpoint_id:, transfer_url: default_transfer_url, auth_url: default_auth_url)
25
25
  instance.config = OpenStruct.new(
26
- token: Authenticator.token(client_id, client_secret, auth_url),
26
+ # For the initial token, use a dummy value to avoid hitting any APIs
27
+ # during configuration, allowing the `TokenWrapper` to handle auto-magic
28
+ # token refreshing. Why not immediately get a valid token? Our apps
29
+ # commonly invoke client `.configure` methods in the initializer in all
30
+ # application environments, even those that are never expected to
31
+ # connect to production APIs, such as local development machines.
32
+ #
33
+ # NOTE: `nil` and blank string cannot be used as dummy values here as
34
+ # they lead to a malformed request to be sent, which triggers an
35
+ # exception not rescued by `TokenWrapper`
36
+ token: "a temporary dummy token to avoid hitting the API before it is needed",
27
37
  client_id:,
28
38
  client_secret:,
29
39
  uploads_directory:,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globus_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Collier
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-08-24 00:00:00.000000000 Z
13
+ date: 2023-09-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
- rubygems_version: 3.4.10
211
+ rubygems_version: 3.4.13
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Interface for interacting with the Globus API.