Class: Github::Authorizations::App
- Inherits:
-
Github::Authorizations
- Object
- Github::API
- Github::Authorizations
- Github::Authorizations::App
- Defined in:
- lib/github_api/authorizations/app.rb
Constant Summary
Constants inherited from Github::Authorizations
Constants included from Request
Request::METHODS, Request::METHODS_WITH_BODIES
Constants included from Connection
Constants included from Constants
Constants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT
Constants included from MimeType
Instance Attribute Summary
Attributes inherited from Github::API
Attributes included from Github::Authorization
Instance Method Summary collapse
-
#create(*args) ⇒ Object
Get-or-create an authorization for a specific app.
-
#delete(*args) ⇒ Object
(also: #remove, #revoke)
Revoke all authorizations for an application.
Methods inherited from Github::Authorizations
Methods inherited from Github::API
#api_methods_in, #append_arguments, #arguments, inherited, #initialize, #method_missing, #process_basic_auth, #set, #setup, #with, #yield_or_eval
Methods included from RateLimit
#ratelimit, #ratelimit_remaining
Methods included from Request
#delete_request, #get_request, #patch_request, #post_request, #put_request, #request
Methods included from Connection
#caching?, #clear_cache, #connection, #default_middleware, #default_options, #stack
Methods included from MimeType
Methods included from Github::Authorization
#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token
Constructor Details
This class inherits a constructor from Github::API
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Github::API
Instance Method Details
#create(*args) ⇒ Object
Get-or-create an authorization for a specific app
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/github_api/authorizations/app.rb', line 25 def create(*args) raise_authentication_error unless authenticated? arguments(args, required: [:client_id]) do sift Authorizations::VALID_AUTH_PARAM_NAMES end if client_id put_request("/authorizations/clients/#{client_id}", arguments.params) else raise raise_app_authentication_error end end |
#delete(*args) ⇒ Object Also known as: remove, revoke
Revoke all authorizations for an application
Revoke an authorization for an application
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/github_api/authorizations/app.rb', line 52 def delete(*args) raise_authentication_error unless authenticated? params = arguments(args, required: [:client_id]).params if client_id if access_token = (params.delete('access_token') || args[1]) delete_request("/applications/#{client_id}/tokens/#{access_token}", params) else # Revokes all tokens delete_request("/applications/#{client_id}/tokens", params) end else raise raise_app_authentication_error end end |