module Github::Authorization
Public Instance Methods
auth_code()
click to toggle source
Strategy token
# File lib/github_api/authorization.rb, line 21 def auth_code _verify_client client.auth_code end
authenticated?()
click to toggle source
Check whether authentication credentials are present
# File lib/github_api/authorization.rb, line 49 def authenticated? basic_authed? || oauth_token? end
authentication()
click to toggle source
Select authentication parameters
@api public
# File lib/github_api/authorization.rb, line 61 def authentication if basic_authed? { login: login, password: password } else {} end end
basic_authed?()
click to toggle source
Check whether basic authentication credentials are present
# File lib/github_api/authorization.rb, line 54 def basic_authed? basic_auth? || (login? && password?) end
client()
click to toggle source
Setup OAuth2 instance
# File lib/github_api/authorization.rb, line 9 def client @client ||= ::OAuth2::Client.new(client_id, client_secret, { :site => current_options.fetch(:site) { Github.site }, :authorize_url => 'login/oauth/authorize', :token_url => 'login/oauth/access_token', :ssl => { :verify => false } } ) end
get_token(authorization_code, params = {})
click to toggle source
Makes request to token endpoint and retrieves access token value
# File lib/github_api/authorization.rb, line 43 def get_token(authorization_code, params = {}) _verify_client client.auth_code.get_token(authorization_code, params) end