module Croudia::Rest::OAuth
Public Instance Methods
refresh(params = {})
click to toggle source
Refresh an OAuth
2 Bearer Token.
@see developer.croudia.com/docs/oauth @return [Croudia::Object::Tokens] Token pair. @param params [Hash] A customized options. @option params [String] :refresh_token OAuth
2 refresh token.
# File lib/croudia/rest/oauth.rb, line 40 def refresh(params = {}) default_params = {grant_type: 'refresh_token', client_id: @client_id, client_secret: @client_secret } params.merge!(default_params) response = post('oauth/token', params) Croudia::Object::Tokens.new(response) end
token(params = {})
click to toggle source
Allows a registered application to obtain an OAuth
2 Bearer Token.
@see developer.croudia.com/docs/oauth @return [Croudia::Object::Tokens] Token pair. @param params [Hash] A customized options. @option params [String] :code Authorization code of application.
# File lib/croudia/rest/oauth.rb, line 26 def token(params = {}) default_params = {grant_type: 'authorization_code', client_id: @client_id, client_secret: @client_secret} params.merge!(default_params) response = post('oauth/token', params) puts response Croudia::Object::Tokens.new(response) end