lib/braintree/http.rb in braintree-2.45.0 vs lib/braintree/http.rb in braintree-2.46.0
- old
+ new
@@ -67,15 +67,21 @@
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
connection.ca_file = @config.ca_file
connection.verify_callback = proc { |preverify_ok, ssl_context| _verify_ssl_certificate(preverify_ok, ssl_context) }
end
connection.start do |http|
- request = http_verb.new("#{@config.base_merchant_path}#{path}")
+ request = http_verb.new(path)
request["Accept"] = "application/xml"
request["User-Agent"] = @config.user_agent
request["Accept-Encoding"] = "gzip"
request["X-ApiVersion"] = @config.api_version
- request.basic_auth @config.public_key, @config.private_key
+ if @config.client_credentials?
+ request.basic_auth @config.client_id, @config.client_secret
+ elsif @config.access_token
+ request["Authorization"] = "Bearer #{@config.access_token}"
+ else
+ request.basic_auth @config.public_key, @config.private_key
+ end
@config.logger.debug "[Braintree] [#{_current_time}] #{request.method} #{path}"
if body
request["Content-Type"] = "application/xml"
request.body = body
@config.logger.debug _format_and_sanitize_body_for_log(body)