Module: Octokit::Client::Tokens
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/tokens.rb
Overview
Method to check scopes
Instance Method Summary collapse
-
#scopes(token = @access_token, options = {}) ⇒ Array<String>
Check scopes for a token.
Instance Method Details
#scopes(token = @access_token, options = {}) ⇒ Array<String>
Check scopes for a token
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/octokit/client/tokens.rb', line 15 def scopes(token = @access_token, = {}) = .dup raise ArgumentError, 'Access token required' if token.nil? auth = { 'Authorization' => "token #{token}" } headers = (.delete(:headers) || {}).merge(auth) agent.call(:get, 'user', headers: headers) .headers['X-OAuth-Scopes'] .to_s .split(',') .map(&:strip) .sort end |