Sha256: b175fad499e8cab6fd35538f80691b55f9d8d7547928367aeb9bc05dd69541a4
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module OAuth2Client module Grant class Base include OAuth2Client::UrlHelper class InvalidAuthorizationTypeError < StandardError; end attr_accessor :client_id, :client_secret, :connection, :host, :authorize_path, :token_path, :device_path 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 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oauth2-client-2.0.0 | lib/oauth2-client/grant/base.rb |