module Croudia::API::OAuth
Public Instance Methods
get_access_token(code, params={})
click to toggle source
Retrieve access_token
@see developer.croudia.com/docs/oauth @overload get_access_token
(code, params={})
@param [String] code Authorize code passed from user @param [Hash] params Additional query parameters @option params [String] :client_id (@client_id) OAuth client ID @option params [String] :client_secret (@client_secret) OAuth client secret @option params [String] :grant_type ("authorization_code") OAuth grant type
@overload get_access_token
(params={})
@param [Hash] params Query parameters @option params [String] :client_id (@client_id) OAuth client ID @option params [String] :client_secret (@client_secret) OAuth client secret @option params [String] :code Code param passed from user @option params [String] :grant_type ("authorization_code") OAuth grant type
@return [Croudia::AccessToken] Access token
# File lib/croudia/api/oauth.rb, line 36 def get_access_token(code, params={}) case code when String, Integer params[:code] ||= code when Hash params = code.merge(params) end params[:client_id] ||= @client_id params[:client_secret] ||= @client_secret params[:grant_type] ||= 'authorization_code' resp = post('/oauth/token', params) Croudia::AccessToken.new(resp) end