gocardless 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -9,3 +9,5 @@ gocardless*.gem
9
9
  gocardless-*.gem
10
10
  gocardless-ruby.zip
11
11
  .rvmrc
12
+ .rbx
13
+ .bundle
@@ -1,3 +1,7 @@
1
+ ## 1.6.0 - November 06, 2012
2
+
3
+ - Allow setting custom base_urls per-client
4
+
1
5
  ## 1.5.0 - October 29, 2012
2
6
 
3
7
  - Use date_accessor to define next_interval_start methods
@@ -268,6 +268,21 @@ module GoCardless
268
268
  signature_valid?(params)
269
269
  end
270
270
 
271
+ # Set the base URL for this client instance. Overrides all other settings
272
+ # (setting the environment globally, setting the Client class's base URL).
273
+ #
274
+ # @param [String] url the base URL to use
275
+ def base_url=(url)
276
+ @base_url = url
277
+ end
278
+
279
+ # Get the base URL for the client. If set manually for the instance, that
280
+ # URL will be returned. Otherwise, it will be deferred to
281
+ # +Client.base_url+.
282
+ def base_url
283
+ @base_url || self.class.base_url
284
+ end
285
+
271
286
  private
272
287
 
273
288
  # Return the merchant id, throwing a proper error if it's missing.
@@ -1,3 +1,3 @@
1
1
  module GoCardless
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '1.6.0'.freeze
3
3
  end
@@ -469,4 +469,17 @@ describe GoCardless::Client do
469
469
  should be_true
470
470
  end
471
471
  end
472
+
473
+ describe "base_url" do
474
+ it "returns a custom base URL when one has been set" do
475
+ @client.base_url = 'http://test.com/'
476
+ @client.base_url.should == 'http://test.com/'
477
+ end
478
+
479
+ it "returns the default value when base_url is not set for the instance" do
480
+ GoCardless::Client.stubs(:base_url => 'http://gc.com/')
481
+ @client.base_url.should == 'http://gc.com/'
482
+ end
483
+ end
472
484
  end
485
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gocardless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-29 00:00:00.000000000 Z
13
+ date: 2012-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: oauth2