Class: Lyft::Client::Api::Oauth
- Defined in:
- lib/lyft/client/api/oauth.rb
Overview
Client for making authentication related requests to the lyft api
Constant Summary collapse
- ENDPOINTS =
Authentication Endpoints
{ access_token: '/oauth/token' }
Constants inherited from Base
Base::API_VERSION, Base::DEFAULT_VALIDATES
Instance Method Summary collapse
-
#initialize(config) ⇒ Oauth
constructor
A new instance of Oauth.
-
#retrieve_access_token(authorization_code: nil) ⇒ HTTParty::Response
Retrieves access token from the server.
Methods inherited from Base
path_for, #path_for, #set_debug_output
Constructor Details
#initialize(config) ⇒ Oauth
Returns a new instance of Oauth.
19 20 21 22 |
# File 'lib/lyft/client/api/oauth.rb', line 19 def initialize(config) super set_default_headers end |
Instance Method Details
#retrieve_access_token(authorization_code: nil) ⇒ HTTParty::Response
Retrieves access token from the server.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lyft/client/api/oauth.rb', line 38 def retrieve_access_token(authorization_code: nil) path = path_for(:access_token) grant_type = get_grant_type(.present?) body = request_body( grant_type: grant_type, authorization_code: ) self.class.post(path, body: body.to_json) end |