globus_client 0.10.0 → 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: 5427a4692e19e5eedb9cd6e3e90d6951e5a4adc1135ca713ca72c81ca09f9deb
4
- data.tar.gz: 25f9816388cf1ca0c9ff908df97f5257a246b94c20ce3ecc7fce98a4d7ca3bbe
3
+ metadata.gz: 17883fcf5075a2d48a8c1d6d8dec772c4f6b7bf9df670744ac99280fafb4d70d
4
+ data.tar.gz: 4652598239017ee6d049359b60d4931ab4efe6d2c90f222434554b93556c2edd
5
5
  SHA512:
6
- metadata.gz: 476a72181dc845cb4e3b5fa6a16cfc4962d23abdd2b058a544668969db70b9fc46d3f88afcc28e876ada57e92bf00d40bce3b5f6ec2d0567d8dbbf326c48b0c5
7
- data.tar.gz: d89e245e9f05d6826206ac000f283f50454798771137a3727004027bee771befa498bbe01513dc4c6ba804120c544b1d5268a0886acba1b5369f34e6df9bd00f
6
+ metadata.gz: 5a3f421d6284bd63a9e19ec0526d06d1c3757752d1367b9bef7fe5a5b651dbf369b9d6e02589b8c8e4d60e3a0d71f3c6974961ff68ffdb3d5b8642e7c21aceb0
7
+ data.tar.gz: 67dd2fa038211a82ec0651c24812666b138ce6172beff07adbfa90864ea5874c5297f0ff155c16158634d2f02220d43f85449032710ffa21095f73c9dcabe23b
data/.rubocop/custom.yml CHANGED
@@ -30,17 +30,17 @@ RSpec/SubjectDeclaration: # new in 2.5
30
30
  Enabled: true
31
31
  RSpec/VerifiedDoubleReference: # new in 2.10.0
32
32
  Enabled: true
33
- RSpec/Capybara/NegationMatcher: # new in 2.14
33
+ Capybara/NegationMatcher: # new in 2.14
34
34
  Enabled: true
35
- RSpec/Capybara/SpecificActions: # new in 2.14
35
+ Capybara/SpecificActions: # new in 2.14
36
36
  Enabled: true
37
- RSpec/Capybara/SpecificFinders: # new in 2.13
37
+ Capybara/SpecificFinders: # new in 2.13
38
38
  Enabled: true
39
- RSpec/Capybara/SpecificMatcher: # new in 2.12
39
+ Capybara/SpecificMatcher: # new in 2.12
40
40
  Enabled: true
41
- RSpec/FactoryBot/ConsistentParenthesesStyle: # new in 2.14
41
+ FactoryBot/ConsistentParenthesesStyle: # new in 2.14
42
42
  Enabled: true
43
- RSpec/FactoryBot/SyntaxMethods: # new in 2.7
43
+ FactoryBot/SyntaxMethods: # new in 2.7
44
44
  Enabled: true
45
45
  RSpec/Rails/AvoidSetupHook: # new in 2.4
46
46
  Enabled: true
@@ -48,3 +48,33 @@ RSpec/Rails/HaveHttpStatus: # new in 2.12
48
48
  Enabled: true
49
49
  RSpec/Rails/InferredSpecType: # new in 2.14
50
50
  Enabled: true
51
+ Capybara/MatchStyle: # new in 2.17
52
+ Enabled: true
53
+ FactoryBot/AssociationStyle: # new in 2.23
54
+ Enabled: true
55
+ FactoryBot/FactoryAssociationWithStrategy: # new in 2.23
56
+ Enabled: true
57
+ FactoryBot/FactoryNameStyle: # new in 2.16
58
+ Enabled: true
59
+ FactoryBot/RedundantFactoryOption: # new in 2.23
60
+ Enabled: true
61
+ RSpec/BeEmpty: # new in 2.20
62
+ Enabled: true
63
+ RSpec/ContainExactly: # new in 2.19
64
+ Enabled: true
65
+ RSpec/DuplicatedMetadata: # new in 2.16
66
+ Enabled: true
67
+ RSpec/IndexedLet: # new in 2.20
68
+ Enabled: false # Sometimes indices *are* meaningful
69
+ RSpec/MatchArray: # new in 2.19
70
+ Enabled: true
71
+ RSpec/PendingWithoutReason: # new in 2.16
72
+ Enabled: true
73
+ RSpec/RedundantAround: # new in 2.19
74
+ Enabled: true
75
+ RSpec/SkipBlockInsideExample: # new in 2.19
76
+ Enabled: true
77
+ RSpec/Rails/MinitestAssertions: # new in 2.17
78
+ Enabled: true
79
+ RSpec/Rails/TravelAround: # new in 2.19
80
+ Enabled: true
data/.rubocop.yml CHANGED
@@ -3,13 +3,16 @@ inherit_mode:
3
3
  - Exclude
4
4
 
5
5
  require:
6
+ - standard
7
+ - standard-custom
8
+ - standard-performance
6
9
  - rubocop-performance
7
10
  - rubocop-rspec
8
- - standard
9
11
 
10
12
  inherit_gem:
11
13
  standard: config/base.yml
14
+ standard-performance: config/base.yml
15
+ standard-custom: config/base.yml
12
16
 
13
17
  inherit_from:
14
18
  - .rubocop/custom.yml
15
- - .rubocop_todo.yml
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
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.5)
13
+ activesupport (7.0.6)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -24,7 +24,7 @@ GEM
24
24
  rexml
25
25
  diff-lcs (1.5.0)
26
26
  docile (1.4.0)
27
- faraday (2.7.7)
27
+ faraday (2.7.10)
28
28
  faraday-net_http (>= 2.0, < 3.1)
29
29
  ruby2_keywords (>= 0.0.4)
30
30
  faraday-net_http (3.0.2)
@@ -35,13 +35,13 @@ GEM
35
35
  concurrent-ruby (~> 1.0)
36
36
  json (2.6.3)
37
37
  language_server-protocol (3.17.0.3)
38
- lint_roller (1.0.0)
38
+ lint_roller (1.1.0)
39
39
  minitest (5.18.1)
40
40
  parallel (1.23.0)
41
41
  parser (3.2.2.3)
42
42
  ast (~> 2.4.1)
43
43
  racc
44
- public_suffix (5.0.1)
44
+ public_suffix (5.0.3)
45
45
  racc (1.7.1)
46
46
  rainbow (3.1.1)
47
47
  rake (13.0.6)
@@ -56,10 +56,10 @@ GEM
56
56
  rspec-expectations (3.12.3)
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
58
  rspec-support (~> 3.12.0)
59
- rspec-mocks (3.12.5)
59
+ rspec-mocks (3.12.6)
60
60
  diff-lcs (>= 1.2.0, < 2.0)
61
61
  rspec-support (~> 3.12.0)
62
- rspec-support (3.12.0)
62
+ rspec-support (3.12.1)
63
63
  rubocop (1.52.1)
64
64
  json (~> 2.3)
65
65
  parallel (~> 1.10)
@@ -91,16 +91,17 @@ GEM
91
91
  simplecov_json_formatter (~> 0.1)
92
92
  simplecov-html (0.12.3)
93
93
  simplecov_json_formatter (0.1.4)
94
- standard (1.29.0)
94
+ standard (1.30.1)
95
95
  language_server-protocol (~> 3.17.0.2)
96
96
  lint_roller (~> 1.0)
97
97
  rubocop (~> 1.52.0)
98
98
  standard-custom (~> 1.0.0)
99
99
  standard-performance (~> 1.1.0)
100
- standard-custom (1.0.1)
101
- lint_roller (~> 1.0)
102
- standard-performance (1.1.0)
100
+ standard-custom (1.0.2)
103
101
  lint_roller (~> 1.0)
102
+ rubocop (~> 1.50)
103
+ standard-performance (1.1.2)
104
+ lint_roller (~> 1.1)
104
105
  rubocop-performance (~> 1.18.0)
105
106
  tzinfo (2.0.6)
106
107
  concurrent-ruby (~> 1.0)
@@ -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
@@ -113,7 +123,7 @@ class GlobusClient
113
123
  # @param files [Array<FileInfo>] an array of FileInfo structs, each of which has a name and a size
114
124
  # @param return_presence [Boolean] if true, return a boolean to indicate if any files at all are present, short-circuiting the recursive operation
115
125
  def ls_path(filepath, files, return_presence: false)
116
- response = connection.get("#{transfer_path}/ls?path=#{filepath}")
126
+ response = connection.get("#{transfer_path}/ls?path=#{CGI.escape(filepath)}")
117
127
  return UnexpectedResponse.call(response) unless response.success?
118
128
 
119
129
  data = JSON.parse(response.body)["DATA"]
@@ -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.0"
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.0
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-06-29 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
@@ -171,7 +171,6 @@ files:
171
171
  - ".rspec"
172
172
  - ".rubocop.yml"
173
173
  - ".rubocop/custom.yml"
174
- - ".rubocop_todo.yml"
175
174
  - ".standard.yml"
176
175
  - Gemfile
177
176
  - Gemfile.lock
data/.rubocop_todo.yml DELETED
@@ -1,7 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2022-10-27 22:53:23 UTC using RuboCop version 1.37.0.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.