Sha256: 089cfd2a65826db3a61b5a3d2e44df51a2d8f21840f6c07ad62213ad9c739703
Contents?: true
Size: 1.12 KB
Versions: 7
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 module Github class Client::Scopes < API # Check what OAuth scopes you have. # # @see https://developer.github.com/v3/oauth/#scopes # # @example # github = Github.new oauth_token: 'e72e16c7e42f292c6912e7710c838347ae17' # github.scopes.all # # @example # github = Github.new # github.scopes.list 'e72e16c7e42f292c6912e7710c838347ae17' # # @example # github = Github.new # github.scopes.list token: 'e72e16c7e42f292c6912e7710c838347ae17' # # @api public def list(*args) arguments(args) params = arguments.params token = args.shift if token.is_a?(Hash) && !params['token'].nil? token = params.delete('token') elsif token.nil? token = oauth_token end if token.nil? raise ArgumentError, 'Access token required' end headers = { 'Authorization' => "token #{token}" } params['headers'] = headers response = get_request("/user", params) response.headers.oauth_scopes.split(',').map(&:strip) end alias all list end # Client::Scopes end # Github
Version data entries
7 entries across 7 versions & 1 rubygems