Class: Githubris::OAuth
- Inherits:
-
Object
- Object
- Githubris::OAuth
- Defined in:
- lib/githubris/oauth.rb
Constant Summary collapse
- REQUEST_ACCESS_URL =
Addressable::URI.parse("https://github.com/login/oauth/authorize")
Instance Method Summary collapse
- #access_token(code) ⇒ Object
-
#initialize(client_id, client_secret, api = Githubris::API.new) ⇒ OAuth
constructor
A new instance of OAuth.
- #request_access_url(query = {}) ⇒ Object
Constructor Details
#initialize(client_id, client_secret, api = Githubris::API.new) ⇒ OAuth
Returns a new instance of OAuth.
4 5 6 7 8 |
# File 'lib/githubris/oauth.rb', line 4 def initialize(client_id, client_secret, api=Githubris::API.new) @client_id = client_id @client_secret = client_secret @api = api end |
Instance Method Details
#access_token(code) ⇒ Object
14 15 16 |
# File 'lib/githubris/oauth.rb', line 14 def access_token(code) @api.post_oauth_access_token(access_token_params(code)) end |
#request_access_url(query = {}) ⇒ Object
10 11 12 |
# File 'lib/githubris/oauth.rb', line 10 def request_access_url(query={}) add_query_params_to(REQUEST_ACCESS_URL, query).to_s end |