microslop_one_drive 4.0.0 → 4.1.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea6fe465bafb81fd55f7e6115d3c25684f8de6d4dd7f7a10a2c21cca5d194e7e
|
|
4
|
+
data.tar.gz: 0a8109c8bb15d7660f9b6cdaa84f920dce01280d346971297da3456059d2d67b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e85320b160e96a4b218856b9b5701d863e5d5960b6e4f67b8b72485a4205a672a19413f7a6b2e86ed11649a6925841dae3b52b869f2cabf8c14bc1ef0ae7dc84
|
|
7
|
+
data.tar.gz: a6a89eb7938ec464bd5a63293f3627706d472295eff66428d1ccd14d3341dd5b6202706d9651d7a8a494d64a373811c7d6127e5b6aaa043c0ef06a4364b58700
|
|
@@ -15,6 +15,7 @@ module MicroslopOneDrive
|
|
|
15
15
|
include Endpoints::Batch
|
|
16
16
|
include Endpoints::BatchPermissions
|
|
17
17
|
include Endpoints::SupportsSites
|
|
18
|
+
include Endpoints::DeletePermission
|
|
18
19
|
|
|
19
20
|
# @param access_token [String] OAuth access token for Microsoft Graph.
|
|
20
21
|
# @param logger [Object, nil] Optional logger (e.g. Rails.logger) that responds to +#info+, +#debug+, +#warn+, +#error+.
|
|
@@ -52,6 +53,16 @@ module MicroslopOneDrive
|
|
|
52
53
|
response
|
|
53
54
|
end
|
|
54
55
|
|
|
56
|
+
def delete(path:)
|
|
57
|
+
url = "#{BASE_URL}/#{path}"
|
|
58
|
+
log_request("DELETE", url, body: nil)
|
|
59
|
+
|
|
60
|
+
response = HTTParty.delete(url, headers: @headers)
|
|
61
|
+
log_response(response, "DELETE", url)
|
|
62
|
+
|
|
63
|
+
response
|
|
64
|
+
end
|
|
65
|
+
|
|
55
66
|
def log_request(method, url, query: nil, body: nil)
|
|
56
67
|
return unless @logger
|
|
57
68
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module MicroslopOneDrive
|
|
2
|
+
module Endpoints
|
|
3
|
+
module DeletePermission
|
|
4
|
+
# Deletes a permission for a Drive Item.
|
|
5
|
+
#
|
|
6
|
+
# @param drive_id [String, nil] The ID of the Drive to delete the permission from. If not provided, the current
|
|
7
|
+
# User's default Drive will be used.
|
|
8
|
+
# @param item_id [String] The ID of the Drive Item to delete the permission from.
|
|
9
|
+
# @param permission_id [String] The ID of the permission to delete.
|
|
10
|
+
#
|
|
11
|
+
# @return [Boolean] True if the permission was deleted, false if it was not found.
|
|
12
|
+
def delete_permission(item_id:, permission_id:, drive_id: nil)
|
|
13
|
+
url = if drive_id.nil?
|
|
14
|
+
"me/drive/items/#{item_id}/permissions/#{permission_id}"
|
|
15
|
+
else
|
|
16
|
+
"me/drives/#{drive_id}/items/#{item_id}/permissions/#{permission_id}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
response = delete(path: url)
|
|
20
|
+
|
|
21
|
+
handle_error(response) if response.not_found? # Either the Drive or the Drive Item does not exist.
|
|
22
|
+
|
|
23
|
+
return true if response.no_content? # Either the permission was deleted now, or never existed in the first place
|
|
24
|
+
|
|
25
|
+
handle_error(response)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/microslop_one_drive.rb
CHANGED
|
@@ -50,6 +50,7 @@ require_relative "microslop_one_drive/endpoints/delta"
|
|
|
50
50
|
require_relative "microslop_one_drive/endpoints/permissions"
|
|
51
51
|
require_relative "microslop_one_drive/endpoints/batch"
|
|
52
52
|
require_relative "microslop_one_drive/endpoints/batch_permissions"
|
|
53
|
+
require_relative "microslop_one_drive/endpoints/delete_permission"
|
|
53
54
|
require_relative "microslop_one_drive/endpoints/supports_sites"
|
|
54
55
|
|
|
55
56
|
# Client
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: microslop_one_drive
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bradley Marques
|
|
@@ -48,6 +48,7 @@ files:
|
|
|
48
48
|
- lib/microslop_one_drive/endpoints/all_drives.rb
|
|
49
49
|
- lib/microslop_one_drive/endpoints/batch.rb
|
|
50
50
|
- lib/microslop_one_drive/endpoints/batch_permissions.rb
|
|
51
|
+
- lib/microslop_one_drive/endpoints/delete_permission.rb
|
|
51
52
|
- lib/microslop_one_drive/endpoints/delta.rb
|
|
52
53
|
- lib/microslop_one_drive/endpoints/drive.rb
|
|
53
54
|
- lib/microslop_one_drive/endpoints/drive_exists.rb
|