-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Octokit::Client::Authorizations (#1494)
* Remove all but scopes and create_authorization methods * Rename to Tokens module * Remove create_authorization in favor of hardcoded test tokens * Remove unnecessary cassettes * Fix comment
- Loading branch information
1 parent
8413882
commit 017b0e3
Showing
18 changed files
with
77 additions
and
449 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 was deleted.
Oops, something went wrong.
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 @@ | ||
# frozen_string_literal: true | ||
|
||
module Octokit | ||
class Client | ||
# Method to check scopes | ||
# | ||
# @see https://developer.github.com/v3/oauth_authorizations/#oauth-authorizations-api | ||
module Tokens | ||
# Check scopes for a token | ||
# | ||
# @param token [String] GitHub OAuth token | ||
# @param options [Hash] Header params for request | ||
# @return [Array<String>] OAuth scopes | ||
# @see https://developer.github.com/v3/oauth/#scopes | ||
def scopes(token = @access_token, options = {}) | ||
options = options.dup | ||
raise ArgumentError, 'Access token required' if token.nil? | ||
|
||
auth = { 'Authorization' => "token #{token}" } | ||
headers = (options.delete(:headers) || {}).merge(auth) | ||
|
||
agent.call(:get, 'user', headers: headers) | ||
.headers['X-OAuth-Scopes'] | ||
.to_s | ||
.split(',') | ||
.map(&:strip) | ||
.sort | ||
end | ||
end | ||
end | ||
end |
1 change: 0 additions & 1 deletion
1
...assettes/Octokit_Client_Authorizations/_authorization/returns_a_single_authorization.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...assettes/Octokit_Client_Authorizations/_authorizations/lists_existing_authorizations.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...eate_authorization/with_idempotent_true/creates_a_new_authorization_with_fingerprint.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.