class OAuth2Client::Grant::Base
Attributes
client_id[RW]
client_secret[RW]
connection[RW]
device_path[RW]
host[RW]
token_path[RW]
Public Class Methods
new(client)
click to toggle source
# File lib/oauth2-client/grant/base.rb, line 11 def initialize(client) @host = client.host @connection = client.connection @client_id = client.client_id @client_secret = client.client_secret @token_path = client.token_path @authorize_path = client.authorize_path @device_path = client.device_path end
Public Instance Methods
make_request(method, path, opts={})
click to toggle source
# File lib/oauth2-client/grant/base.rb, line 21 def make_request(method, path, opts={}) if auth_type = opts.delete(:authenticate) case auth_type.to_sym when :body opts[:params] ||= {} opts[:params].merge!({ :client_id => @client_id, :client_secret => @client_secret }) when :headers opts[:headers] ||= {} opts[:headers]['Authorization'] = http_basic_encode(@client_id, @client_secret) else #do nothing end end @connection.send_request(method, path, opts) end