braintree 2.10.2 → 2.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,10 @@ module Braintree
2
2
  # See http://www.braintreepayments.com/docs/ruby
3
3
  class Configuration
4
4
  API_VERSION = "2" # :nodoc:
5
+ DEFAULT_ENDPOINT = "www" # :nodoc:
5
6
 
6
7
  class << self
7
- attr_writer :custom_user_agent, :logger, :merchant_id, :public_key, :private_key
8
+ attr_writer :custom_user_agent, :endpoint, :logger, :merchant_id, :public_key, :private_key
8
9
  end
9
10
  attr_reader :merchant_id, :public_key, :private_key
10
11
 
@@ -34,6 +35,7 @@ module Braintree
34
35
  def self.instantiate # :nodoc:
35
36
  config = new(
36
37
  :custom_user_agent => @custom_user_agent,
38
+ :endpoint => @endpoint,
37
39
  :environment => environment,
38
40
  :logger => logger,
39
41
  :merchant_id => merchant_id,
@@ -47,7 +49,7 @@ module Braintree
47
49
  end
48
50
 
49
51
  def initialize(options = {})
50
- [:environment, :merchant_id, :public_key, :private_key, :custom_user_agent, :logger].each do |attr|
52
+ [:endpoint, :environment, :merchant_id, :public_key, :private_key, :custom_user_agent, :logger].each do |attr|
51
53
  instance_variable_set "@#{attr}", options[attr]
52
54
  end
53
55
  end
@@ -73,6 +75,10 @@ module Braintree
73
75
  end
74
76
  end
75
77
 
78
+ def endpoint
79
+ @endpoint || DEFAULT_ENDPOINT
80
+ end
81
+
76
82
  def http # :nodoc:
77
83
  Http.new(self)
78
84
  end
@@ -99,7 +105,7 @@ module Braintree
99
105
  when :development
100
106
  "localhost"
101
107
  when :production
102
- "www.braintreegateway.com"
108
+ "#{endpoint}.braintreegateway.com"
103
109
  when :qa
104
110
  "qa-master.braintreegateway.com"
105
111
  when :sandbox
@@ -2,7 +2,7 @@ module Braintree
2
2
  module Version
3
3
  Major = 2
4
4
  Minor = 10
5
- Tiny = 2
5
+ Tiny = 3
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
8
8
  end
@@ -11,9 +11,10 @@ describe Braintree::Configuration do
11
11
 
12
12
  after do
13
13
  Braintree::Configuration.merchant_id = @original_merchant_id
14
- Braintree::Configuration.public_key = @original_public_key
14
+ Braintree::Configuration.public_key = @original_public_key
15
15
  Braintree::Configuration.private_key = @original_private_key
16
16
  Braintree::Configuration.environment = @original_environment
17
+ Braintree::Configuration.endpoint = Braintree::Configuration::DEFAULT_ENDPOINT
17
18
  end
18
19
 
19
20
  describe "base_merchant_path" do
@@ -180,7 +181,7 @@ describe Braintree::Configuration do
180
181
 
181
182
  end
182
183
 
183
- describe "self.server" do
184
+ describe "server" do
184
185
  it "is localhost for development" do
185
186
  Braintree::Configuration.environment = :development
186
187
  Braintree::Configuration.instantiate.server.should == "localhost"
@@ -195,6 +196,12 @@ describe Braintree::Configuration do
195
196
  Braintree::Configuration.environment = :sandbox
196
197
  Braintree::Configuration.instantiate.server.should == "sandbox.braintreegateway.com"
197
198
  end
199
+
200
+ it "can by changed by configuring the production endpoint" do
201
+ Braintree::Configuration.environment = :production
202
+ Braintree::Configuration.endpoint = "custom-endpoint"
203
+ Braintree::Configuration.instantiate.server.should == "custom-endpoint.braintreegateway.com"
204
+ end
198
205
  end
199
206
 
200
207
  describe "ssl?" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 10
9
- - 2
10
- version: 2.10.2
9
+ - 3
10
+ version: 2.10.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Braintree
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-02 00:00:00 -05:00
18
+ date: 2011-11-16 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements: []
176
176
 
177
177
  rubyforge_project: braintree
178
- rubygems_version: 1.6.2
178
+ rubygems_version: 1.4.2
179
179
  signing_key:
180
180
  specification_version: 3
181
181
  summary: Braintree Gateway Ruby Client Library