-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
682 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module DropboxApi::Endpoints::Sharing | ||
class RevokeSharedLink < DropboxApi::Endpoints::Rpc | ||
Method = :post | ||
Path = "/2/sharing/revoke_shared_link".freeze | ||
ResultType = DropboxApi::Results::VoidResult | ||
ErrorType = DropboxApi::Errors::RevokeSharedLinkError | ||
|
||
# Revoke a shared link. | ||
# | ||
# Note that even after revoking a shared link to a file, the file may be accessible | ||
# if there are shared links leading to any of the file parent folders. | ||
# | ||
# A successful response indicates that the shared link was revoked. | ||
# | ||
# @param url [String] shared url which needs to be revoked. | ||
|
||
add_endpoint :revoke_shared_link do |url| | ||
perform_request({ | ||
:url => url | ||
}) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module DropboxApi::Errors | ||
class RevokeSharedLinkError < BasicError | ||
ErrorSubtypes = { | ||
:shared_link_not_found => SharedLinkNotFoundError, | ||
:shared_link_access_denied => SharedLinkAccessDeniedError, | ||
:unsupported_link_type => UnsupportedLinkTypeError, | ||
:shared_link_malformed => SharedLinkMalformedError | ||
}.freeze | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
describe DropboxApi::Client, "#revoke_shared_link" do | ||
before :each do | ||
@client = DropboxApi::Client.new | ||
end | ||
|
||
context "revoke shared link access" do | ||
it "revoke a shared link", :cassette => "revoke_shared_link/success" do | ||
link = @client.revoke_shared_link "https://www.dropbox.com/sh/t0ebpiojwy4l1bn/AAAcU6qf20b8R-SG5_PJCBOQa?dl=0" | ||
|
||
# The endpoint doesn't have any return values, can't test the output! | ||
end | ||
|
||
it "raises an error if link is not found", :cassette => "revoke_shared_link/not_found" do | ||
expect { | ||
@client.revoke_shared_link "https://www.dropbox.com/sh/t0ebpiojwy4l1bn/AAAcU6qf20b8R-SG5_PJCBOQa?dl=0" | ||
}.to raise_error(DropboxApi::Errors::SharedLinkNotFoundError) | ||
end | ||
|
||
it "raises access denied error if not permitted", :cassette => "revoke_shared_link/access_denied" do | ||
expect { | ||
@client.revoke_shared_link "https://www.dropbox.com/s/al0w4e11j0e1kp3/file_for_sharing.docx?dl=0" | ||
}.to raise_error(DropboxApi::Errors::SharedLinkAccessDeniedError) | ||
end | ||
|
||
it "raises shared link malformed error if link is malformed", :cassette => "revoke_shared_link/malformed_shared_link" do | ||
expect { | ||
@client.revoke_shared_link "https://www.dropbox.com/al0w4e11j0e1kp3/file_for_sharing.docx?dl=0" | ||
}.to raise_error(DropboxApi::Errors::SharedLinkMalformedError) | ||
end | ||
end | ||
end |
26 changes: 17 additions & 9 deletions
26
spec/fixtures/vcr_cassettes/create_shared_link_with_settings/already_shared.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
.../fixtures/vcr_cassettes/create_shared_link_with_settings/error_no_permission_for_file.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
...ixtures/vcr_cassettes/create_shared_link_with_settings/error_no_permission_for_folder.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.