lib/github_api/authorization.rb in github_api-0.3.0 vs lib/github_api/authorization.rb in github_api-0.3.1
- old
+ new
@@ -42,10 +42,26 @@
@client.auth_code.get_token(authorization_code, params)
end
# Check whether authentication credentials are present
def authenticated?
- basic_auth? || oauth_token? || (login? && password?)
+ basic_authed? || oauth_token?
+ end
+
+ # Check whether basic authentication credentials are present
+ def basic_authed?
+ basic_auth? || (login? && password?)
+ end
+
+ # Select authentication parameters
+ def authentication
+ if login? && password?
+ { :login => login, :password => password }
+ elsif basic_auth?
+ { :basic_auth => basic_auth }
+ else
+ { }
+ end
end
private
def _verify_client # :nodoc: