lib/braintree/configuration.rb in braintree-2.25.0 vs lib/braintree/configuration.rb in braintree-2.26.0

- old
+ new

@@ -1,10 +1,10 @@ module Braintree # See http://www.braintreepayments.com/docs/ruby class Configuration API_VERSION = "3" # :nodoc: - DEFAULT_ENDPOINT = "www" # :nodoc: + DEFAULT_ENDPOINT = "api" # :nodoc: class << self attr_writer :custom_user_agent, :endpoint, :logger, :merchant_id, :public_key, :private_key end attr_reader :merchant_id, :public_key, :private_key @@ -47,13 +47,15 @@ def self.logger @logger ||= _default_logger end def initialize(options = {}) - [:endpoint, :environment, :merchant_id, :public_key, :private_key, :custom_user_agent, :logger].each do |attr| + [:endpoint, :environment, :public_key, :private_key, :custom_user_agent, :logger].each do |attr| instance_variable_set "@#{attr}", options[attr] end + + @merchant_id = options[:merchant_id] || options[:partner_id] end def api_version # :nodoc: API_VERSION end @@ -65,16 +67,11 @@ def base_merchant_url # :nodoc: "#{protocol}://#{server}:#{port}#{base_merchant_path}" end def ca_file # :nodoc: - case @environment - when :qa, :sandbox - File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "sandbox_braintreegateway_com.ca.crt")) - when :production - File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "www_braintreegateway_com.ca.crt")) - end + File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "api_braintreegateway_com.ca.crt")) end def endpoint @endpoint || DEFAULT_ENDPOINT end @@ -107,10 +104,10 @@ when :production "#{endpoint}.braintreegateway.com" when :qa "qa.braintreegateway.com" when :sandbox - "sandbox.braintreegateway.com" + "api.sandbox.braintreegateway.com" end end def ssl? # :nodoc: case @environment