globus_client 0.10.1 → 0.11.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: 87ecd66b77eb1e4806ab42b2d7f8731ae3500127c143363da97df8ed514cc809
4
- data.tar.gz: 2023133582b10a3796ffae425954c8f5ca7d53583ab5246bce82a67bd5e8c22d
3
+ metadata.gz: 0412735516a2cde5c06f65eff24feeedbcdfa68fd845c4ddb02291c1c08e91bb
4
+ data.tar.gz: f58c3b2f559a1a99f64e8b426fc926085f96b82e0afd85876143fee6f1ac7a4d
5
5
  SHA512:
6
- metadata.gz: 5c1c4b4741b1080b01ad8067fbad40f4443ffbc6e0431446bc13278df91e4e027b7d7308ddf1297267bf4ad358979c991a67c9abaa7a216276553cd7c8a9f2fb
7
- data.tar.gz: b2cd05d79e4186849e4bab41bf92bc921031dd10d315ffe3ce81d638b38d6a263f9727fff99abdaf513b30e8b87c7e726b6fe3f2f1587d118b60b38ae8bb35bb
6
+ metadata.gz: 65c26e4b278f537813ffcd4438ead6c44e08f735bd34e17e77f463aec1bbed3de85960788eab65c8635b41cc3466b95c033ef33e18970b888fa2dbdb85bd153f
7
+ data.tar.gz: 1077d87cb4b0a5314a91268213f9a9fa6c0a7015e8bacc580e9cfb3ef0940409abf8f086cbdf73db973f888d1950ff3db8199c87eeb974aeab6682a3c3840e31
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- globus_client (0.10.0)
4
+ globus_client (0.11.1)
5
5
  activesupport (>= 4.2, < 8)
6
6
  faraday
7
7
  faraday-retry
@@ -10,14 +10,15 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.6)
13
+ activesupport (7.0.7)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
- addressable (2.8.4)
18
+ addressable (2.8.5)
19
19
  public_suffix (>= 2.0.2, < 6.0)
20
20
  ast (2.4.2)
21
+ base64 (0.1.1)
21
22
  byebug (11.1.3)
22
23
  concurrent-ruby (1.2.2)
23
24
  crack (0.4.5)
@@ -36,7 +37,7 @@ GEM
36
37
  json (2.6.3)
37
38
  language_server-protocol (3.17.0.3)
38
39
  lint_roller (1.1.0)
39
- minitest (5.18.1)
40
+ minitest (5.19.0)
40
41
  parallel (1.23.0)
41
42
  parser (3.2.2.3)
42
43
  ast (~> 2.4.1)
@@ -46,7 +47,7 @@ GEM
46
47
  rainbow (3.1.1)
47
48
  rake (13.0.6)
48
49
  regexp_parser (2.8.1)
49
- rexml (3.2.5)
50
+ rexml (3.2.6)
50
51
  rspec (3.12.0)
51
52
  rspec-core (~> 3.12.0)
52
53
  rspec-expectations (~> 3.12.0)
@@ -60,14 +61,16 @@ GEM
60
61
  diff-lcs (>= 1.2.0, < 2.0)
61
62
  rspec-support (~> 3.12.0)
62
63
  rspec-support (3.12.1)
63
- rubocop (1.52.1)
64
+ rubocop (1.56.1)
65
+ base64 (~> 0.1.1)
64
66
  json (~> 2.3)
67
+ language_server-protocol (>= 3.17.0)
65
68
  parallel (~> 1.10)
66
69
  parser (>= 3.2.2.3)
67
70
  rainbow (>= 2.2.2, < 4.0)
68
71
  regexp_parser (>= 1.8, < 3.0)
69
72
  rexml (>= 3.2.5, < 4.0)
70
- rubocop-ast (>= 1.28.0, < 2.0)
73
+ rubocop-ast (>= 1.28.1, < 2.0)
71
74
  ruby-progressbar (~> 1.7)
72
75
  unicode-display_width (>= 2.4.0, < 3.0)
73
76
  rubocop-ast (1.29.0)
@@ -76,10 +79,10 @@ GEM
76
79
  rubocop (~> 1.41)
77
80
  rubocop-factory_bot (2.23.1)
78
81
  rubocop (~> 1.33)
79
- rubocop-performance (1.18.0)
82
+ rubocop-performance (1.19.0)
80
83
  rubocop (>= 1.7.0, < 2.0)
81
84
  rubocop-ast (>= 0.4.0)
82
- rubocop-rspec (2.22.0)
85
+ rubocop-rspec (2.23.2)
83
86
  rubocop (~> 1.33)
84
87
  rubocop-capybara (~> 2.17)
85
88
  rubocop-factory_bot (~> 2.22)
@@ -91,18 +94,18 @@ GEM
91
94
  simplecov_json_formatter (~> 0.1)
92
95
  simplecov-html (0.12.3)
93
96
  simplecov_json_formatter (0.1.4)
94
- standard (1.30.1)
97
+ standard (1.31.0)
95
98
  language_server-protocol (~> 3.17.0.2)
96
99
  lint_roller (~> 1.0)
97
- rubocop (~> 1.52.0)
100
+ rubocop (~> 1.56.0)
98
101
  standard-custom (~> 1.0.0)
99
- standard-performance (~> 1.1.0)
102
+ standard-performance (~> 1.2)
100
103
  standard-custom (1.0.2)
101
104
  lint_roller (~> 1.0)
102
105
  rubocop (~> 1.50)
103
- standard-performance (1.1.2)
106
+ standard-performance (1.2.0)
104
107
  lint_roller (~> 1.1)
105
- rubocop-performance (~> 1.18.0)
108
+ rubocop-performance (~> 1.19.0)
106
109
  tzinfo (2.0.6)
107
110
  concurrent-ruby (~> 1.0)
108
111
  unicode-display_width (2.4.2)
@@ -110,7 +113,7 @@ GEM
110
113
  addressable (>= 2.8.0)
111
114
  crack (>= 0.3.2)
112
115
  hashdiff (>= 0.4.0, < 2.0.0)
113
- zeitwerk (2.6.8)
116
+ zeitwerk (2.6.11)
114
117
 
115
118
  PLATFORMS
116
119
  x86_64-darwin-19
@@ -57,7 +57,17 @@ class GlobusClient
57
57
 
58
58
  # Assign a user read-only permissions for a directory https://docs.globus.org/api/transfer/acl/#rest_access_create
59
59
  def disallow_writes
60
- access_request(permissions: "r")
60
+ update_access_request(permissions: "r")
61
+ end
62
+
63
+ # Delete the access rule https://docs.globus.org/api/transfer/acl/#delete_access_rule
64
+ def delete_access_rule
65
+ raise(StandardError, "Access rule not found for #{path}") if !access_rule_id
66
+
67
+ response = connection.delete("#{access_path}/#{access_rule_id}")
68
+ return true if response.success?
69
+
70
+ UnexpectedResponse.call(response)
61
71
  end
62
72
 
63
73
  private
@@ -166,11 +176,31 @@ class GlobusClient
166
176
  UnexpectedResponse.call(response)
167
177
  end
168
178
 
179
+ def update_access_request(permissions:)
180
+ raise(StandardError, "Access rule not found for #{path}") if !access_rule_id
181
+
182
+ response = connection.put("#{access_path}/#{access_rule_id}") do |req|
183
+ req.body = {
184
+ DATA_TYPE: "access",
185
+ permissions:
186
+ }.to_json
187
+ req.headers["Content-Type"] = "application/json"
188
+ end
189
+
190
+ return true if response.success?
191
+
192
+ UnexpectedResponse.call(response)
193
+ end
194
+
169
195
  def access_rule
170
196
  response = connection.get(access_list_path) do |req|
171
197
  req.headers["Content-Type"] = "application/json"
172
198
  end
173
199
 
200
+ # debugging of Globus responses
201
+ response_body = JSON.parse(response.body)
202
+ raise(StandardError, "Response is missing DATA in: #{response_body}") unless response_body.key?("DATA")
203
+
174
204
  JSON
175
205
  .parse(response.body)["DATA"]
176
206
  .find { |acl| acl["path"] == full_path }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GlobusClient
4
- VERSION = "0.10.1"
4
+ VERSION = "0.11.1"
5
5
  end
data/lib/globus_client.rb CHANGED
@@ -35,7 +35,7 @@ class GlobusClient
35
35
  self
36
36
  end
37
37
 
38
- delegate :config, :disallow_writes, :file_count, :list_files, :mkdir, :total_size,
38
+ delegate :config, :disallow_writes, :delete_access_rule, :file_count, :list_files, :mkdir, :total_size,
39
39
  :user_valid?, :get_filenames, :has_files?, to: :instance
40
40
 
41
41
  def default_transfer_url
@@ -64,6 +64,13 @@ class GlobusClient
64
64
  end
65
65
  end
66
66
 
67
+ def delete_access_rule(...)
68
+ TokenWrapper.refresh(config) do
69
+ endpoint = Endpoint.new(config, ...)
70
+ endpoint.delete_access_rule
71
+ end
72
+ end
73
+
67
74
  # NOTE: Can't use the `...` (argument forwarding) operator here because we
68
75
  # want to route the keyword args to `Endpoint#new` and the block arg to
69
76
  # `Endpoint#list_files`
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.10.1
4
+ version: 0.11.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-07-18 00:00:00.000000000 Z
13
+ date: 2023-08-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport