Module: Octokit::Client::Authorizations
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/authorizations.rb
Instance Method Summary collapse
-
#authorization(number, options = {}) ⇒ Authorization
Get a single authorization for the authenticated user.
-
#authorizations(options = {}) ⇒ Array
List a users authorizations.
-
#create_authorization(options = {}) ⇒ Authorization
Create an authorization for the authenticated user.
-
#delete_authorization(number, option = {}) ⇒ Boolean
Delete an authorization for the authenticated user.
-
#scopes(token = nil) ⇒ Array<String>
Check scopes for a token.
-
#update_authorization(number, options = {}) ⇒ Authorization
Update an authorization for the authenticated user.
Instance Method Details
#authorization(number, options = {}) ⇒ Authorization
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 |
#authorizations(options = {}) ⇒ Array
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 |
#create_authorization(options = {}) ⇒ Authorization
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 |
#delete_authorization(number, option = {}) ⇒ Boolean
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 |
#scopes(token = nil) ⇒ Array<String>
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 |
#update_authorization(number, options = {}) ⇒ Authorization
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 |