globus_client 0.10.1 → 0.11.0

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: 17883fcf5075a2d48a8c1d6d8dec772c4f6b7bf9df670744ac99280fafb4d70d
4
+ data.tar.gz: 4652598239017ee6d049359b60d4931ab4efe6d2c90f222434554b93556c2edd
5
5
  SHA512:
6
- metadata.gz: 5c1c4b4741b1080b01ad8067fbad40f4443ffbc6e0431446bc13278df91e4e027b7d7308ddf1297267bf4ad358979c991a67c9abaa7a216276553cd7c8a9f2fb
7
- data.tar.gz: b2cd05d79e4186849e4bab41bf92bc921031dd10d315ffe3ce81d638b38d6a263f9727fff99abdaf513b30e8b87c7e726b6fe3f2f1587d118b60b38ae8bb35bb
6
+ metadata.gz: 5a3f421d6284bd63a9e19ec0526d06d1c3757752d1367b9bef7fe5a5b651dbf369b9d6e02589b8c8e4d60e3a0d71f3c6974961ff68ffdb3d5b8642e7c21aceb0
7
+ data.tar.gz: 67dd2fa038211a82ec0651c24812666b138ce6172beff07adbfa90864ea5874c5297f0ff155c16158634d2f02220d43f85449032710ffa21095f73c9dcabe23b
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.0)
5
5
  activesupport (>= 4.2, < 8)
6
6
  faraday
7
7
  faraday-retry
@@ -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,6 +176,22 @@ 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"
@@ -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.0"
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.0
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-07-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport