class AppClient
A wrapper around an Octokit::Client
that authenticates as an OAuth application. Contains a few methods for manipulating OAuth tokens as well.
Public Class Methods
Source
# File lib/app_client.rb, line 19 def initialize(client_id, client_secret) super(Octokit::Client.new(client_id:, client_secret:)) end
Takes two arguments, an OAuth client ID and an OAuth client secret. These are used to initialize an Octokit::Client
acting as the OAuth application. This class delegates missing instance methods to that client.
Calls superclass method
Public Instance Methods
Source
# File lib/app_client.rb, line 25 def revoke_token(token) return unless token_valid? token delete_app_authorization token end
Revoke the given access token for the OAuth application.
Source
# File lib/app_client.rb, line 33 def token_valid?(token) check_token token true rescue Octokit::NotFound false end
Check to see whether the given token is valid for the OAuth application.