Module: Octokit::Client::Authorizations
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/authorizations.rb
Instance Method Summary (collapse)
-
- (Authorization) authorization(number, options = {})
Get a single authorization for the authenticated user.
-
- (Array) authorizations(options = {})
List a users authorizations.
-
- (Authorization) create_authorization(options = {})
Create an authorization for the authenticated user.
-
- (Boolean) delete_authorization(number, option = {})
Delete an authorization for the authenticated user.
-
- (Array<String>) scopes(token = nil)
Check scopes for a token.
-
- (Authorization) update_authorization(number, options = {})
Update an authorization for the authenticated user.
Instance Method Details
- (Authorization) authorization(number, options = {})
Get a single authorization for the authenticated user.
You can only access your own tokens, and only through Basic Authentication.
31 32 33 |
# File 'lib/octokit/client/authorizations.rb', line 31 def (number, ={}) get "authorizations/#{number}", end |
- (Array) authorizations(options = {})
List a users authorizations
API for users to manage their own tokens. You can only access your own tokens, and only through Basic Authentication.
16 17 18 |
# File 'lib/octokit/client/authorizations.rb', line 16 def (={}) get 'authorizations', end |
- (Authorization) create_authorization(options = {})
Create an authorization for the authenticated user.
You can create your own tokens, and only through Basic Authentication.
51 52 53 54 55 56 |
# File 'lib/octokit/client/authorizations.rb', line 51 def (={}) # Techincally we can omit scopes as GitHub has a default, however the # API will reject us if we send a POST request with an empty body. = {:scopes => ""}.merge() post('authorizations', ) end |
- (Boolean) delete_authorization(number, option = {})
Delete an authorization for the authenticated user.
You can delete your own tokens, and only through Basic Authentication.
95 96 97 |
# File 'lib/octokit/client/authorizations.rb', line 95 def (number, option={}) boolean_from_response(:delete, "authorizations/#{number}") end |
- (Array<String>) scopes(token = nil)
Check scopes for a token
104 105 106 107 108 109 110 |
# File 'lib/octokit/client/authorizations.rb', line 104 def scopes(token=nil) request(:get, "user", :access_token => token). headers[:x_oauth_scopes]. split(','). map(&:strip). sort end |
- (Authorization) update_authorization(number, options = {})
Update an authorization for the authenticated user.
You can update your own tokens, but only through Basic Authentication.
76 77 78 79 80 81 |
# File 'lib/octokit/client/authorizations.rb', line 76 def (number, ={}) # Techincally we can omit scopes as GitHub has a default, however the # API will reject us if we send a POST request with an empty body. = {:scopes => ""}.merge() patch("authorizations/#{number}", ) end |