stripe 1.51.0 → 1.51.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53821741b8b4c5d1ab26760b8dc79065a2b2ebf9
4
- data.tar.gz: d61f8ae7d2501b2d4d3198fd31aebea2a07cf105
3
+ metadata.gz: 5d4b487a7f1742c56ebfafadb07b0a4ee7a352a4
4
+ data.tar.gz: ca0ab770ffc1e382f75b33c30a667d9fccd2af26
5
5
  SHA512:
6
- metadata.gz: 6c4d5995dd5bbdd5ea063a79023a9467932470fb1299c69e73d1e9758600a4e890d66caa410680a7e2c13579a7b76bec62565d0cb665fbee5feb3c6124a049ce
7
- data.tar.gz: 8db2e0a89f0327bb3b9c3fcbd61630dbab4d19d2b2150381ca551db9c4fda1b4778b8f972bf62f358db45173395e25969031466a9fb3352cc6de092d45cb9766
6
+ metadata.gz: 0fb66566f5cddad11f7fcdae7bd5ab6f50daf4366475da0da6bf8e2394063720b08c761bbc7f7afac446af907e2ecb5a8ea93b88d8e6aa9f5110c3afd44f00eb
7
+ data.tar.gz: 73c72693910b62975a67035cceca3ba5a3029c988eda0abeb268fd6d96dd2754bf93cb5198799c5f6903f06c2fe8dd031a85382047c24c6b90215fe1038707c6
@@ -1,3 +1,7 @@
1
+ === 1.51.1 2016-08-30
2
+
3
+ * Make sure `Account`'s `external_account` is saved with its parent
4
+
1
5
  === 1.51.0 2016-08-26
2
6
 
3
7
  * Error when an array of maps is detected that cannot be accurately encoded
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.51.0
1
+ 1.51.1
@@ -28,6 +28,23 @@ module Stripe
28
28
  super(id, opts)
29
29
  end
30
30
 
31
+ # Set or replace an account's external account.
32
+ def external_account=(value)
33
+ super
34
+
35
+ # The parent setter will perform certain useful operations like
36
+ # converting to an APIResource if appropriate.
37
+ value = self.external_account
38
+
39
+ # Note that external_account may be a card, but could also be a tokenized
40
+ # card's ID (which is a string), and so we check its type here.
41
+ if value.is_a?(APIResource)
42
+ value.save_with_parent = true
43
+ end
44
+
45
+ value
46
+ end
47
+
31
48
  def reject(params={}, opts={})
32
49
  opts = Util.normalize_opts(opts)
33
50
  response, opts = request(:post, resource_url + '/reject', params, opts)
@@ -93,6 +110,22 @@ module Stripe
93
110
 
94
111
  ARGUMENT_NOT_PROVIDED = Object.new
95
112
 
113
+ # Set or replace an account's bank account.
114
+ #
115
+ # This method is deprecated. Please use #external_account instead.
116
+ def bank_account=(value)
117
+ super
118
+ value = self.bank_account
119
+
120
+ if value.is_a?(APIResource)
121
+ value.save_with_parent = true
122
+ end
123
+
124
+ value
125
+ end
126
+ extend Gem::Deprecate
127
+ deprecate :bank_account=, "#external_account=", 2017, 8
128
+
96
129
  private
97
130
 
98
131
  def serialize_additional_owners(legal_entity, additional_owners)
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.51.0'
2
+ VERSION = '1.51.1'
3
3
  end
@@ -289,5 +289,63 @@ module Stripe
289
289
  }
290
290
  assert_equal(expected, obj.serialize_params)
291
291
  end
292
+
293
+ context "#external_account=" do
294
+ should "can have a token source set" do
295
+ a = Stripe::Account.new("test_account")
296
+ a.external_account = "tok_123"
297
+ assert_equal "tok_123", a.external_account
298
+ end
299
+
300
+ should "set a flag if given an object source" do
301
+ a = Stripe::Account.new("test_account")
302
+ a.external_account = {
303
+ :object => 'card'
304
+ }
305
+ assert_equal true, a.external_account.save_with_parent
306
+ end
307
+ end
308
+
309
+ context "#bank_account=" do
310
+ should "can have a token source set" do
311
+ old_stderr = $stderr
312
+ $stderr = StringIO.new
313
+ begin
314
+ a = Stripe::Account.new("test_account")
315
+ a.bank_account = "tok_123"
316
+ assert_equal "tok_123", a.bank_account
317
+ ensure
318
+ $stderr = old_stderr
319
+ end
320
+ end
321
+
322
+ should "set a flag if given an object source" do
323
+ old_stderr = $stderr
324
+ $stderr = StringIO.new
325
+ begin
326
+ a = Stripe::Account.new("test_account")
327
+ a.bank_account = {
328
+ :object => 'bank_account'
329
+ }
330
+ assert_equal true, a.bank_account.save_with_parent
331
+ ensure
332
+ $stderr = old_stderr
333
+ end
334
+ end
335
+
336
+ should "warn that #bank_account= is deprecated" do
337
+ old_stderr = $stderr
338
+ $stderr = StringIO.new
339
+ begin
340
+ a = Stripe::Account.new("test_account")
341
+ a.bank_account = "tok_123"
342
+ message = "NOTE: Stripe::Account#bank_account= is " +
343
+ "deprecated; use #external_account= instead"
344
+ assert_match Regexp.new(message), $stderr.string
345
+ ensure
346
+ $stderr = old_stderr
347
+ end
348
+ end
349
+ end
292
350
  end
293
351
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.51.0
4
+ version: 1.51.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client