stripe 3.4.1 → 3.5.0

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: ce403b39d687753c9cf663b0288dfa87c0d42587
4
- data.tar.gz: c070e94e6a67f23ba5c0cdcc4f20cf8b48003a56
3
+ metadata.gz: 318be0fcbe32bab36c77a9390c936aba1735106a
4
+ data.tar.gz: b060b65d599adf9a51cb6c0d9f1ba81b3a6acc5c
5
5
  SHA512:
6
- metadata.gz: ae59948a1870bddb75f90057936a65903157625ee4dc42d00b72aad628d0dbe0ee92e81a9dbe9efd55c12b57a7b5dd7f7988fdb282862a8fcd204c927574148a
7
- data.tar.gz: 45fd78747f6151a4fa74b64c0bdf6f89e6d68fc9735e1a694fa75c0df46812032b41ac82589bff93ae6fb68022d57089c420ff929ab202a9699d287679b650ab
6
+ metadata.gz: 83a649dc5dcdb5c62511afcad9367fb4368078950de40ad1e0472250eb4d1521034f27dd98740a759e4694937bf648aac692d2d6546687537e8bf9934fe0e17a
7
+ data.tar.gz: 8695ec3cf4e68d269c5e9826af93a50f2e61db554d4f2898035aacdf178240f7ed3ccd4f8fc4cd408a398f72d3ea428ed6bbd115d8e323357c41cb05d384b192
@@ -1,3 +1,7 @@
1
+ === 3.5.0 2017-10-11
2
+
3
+ * [#589] Add support for detaching sources fromm customers
4
+
1
5
  === 3.4.1 2017-10-05
2
6
 
3
7
  * [#586] Log query strings as well as form bodies with STRIPE_LOG
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.1
1
+ 3.5.0
@@ -5,12 +5,11 @@ module Stripe
5
5
 
6
6
  OBJECT_NAME = "source".freeze
7
7
 
8
- def delete(params = {}, opts = {})
8
+ def detach(params = {}, opts = {})
9
9
  if !respond_to?(:customer) || customer.nil? || customer.empty?
10
10
  raise NotImplementedError,
11
- "Source objects cannot be deleted, they can only be detached " \
12
- "from customer objects. This source object does not appear to " \
13
- "be currently attached to a customer object."
11
+ "This source object does not appear to be currently attached " \
12
+ "to a customer object."
14
13
  end
15
14
 
16
15
  url = "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
@@ -18,6 +17,12 @@ module Stripe
18
17
  initialize_from(resp.data, opts)
19
18
  end
20
19
 
20
+ def delete(params = {}, opts = {})
21
+ detach(params, opts)
22
+ end
23
+ extend Gem::Deprecate
24
+ deprecate :delete, "#detach", 2017, 10
25
+
21
26
  def verify(params = {}, opts = {})
22
27
  resp, opts = request(:post, resource_url + "/verify", params, Util.normalize_opts(opts))
23
28
  initialize_from(resp.data, opts)
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = "3.4.1".freeze
2
+ VERSION = "3.5.0".freeze
3
3
  end
@@ -30,12 +30,12 @@ module Stripe
30
30
  assert source.is_a?(Stripe::Source)
31
31
  end
32
32
 
33
- context "#delete" do
33
+ context "#detach" do
34
34
  should "not be deletable when unattached" do
35
35
  source = Stripe::Source.retrieve("src_123")
36
36
 
37
37
  assert_raises NotImplementedError do
38
- source.delete
38
+ source.detach
39
39
  end
40
40
  end
41
41
 
@@ -43,12 +43,30 @@ module Stripe
43
43
  source = Stripe::Source.construct_from(customer: "cus_123",
44
44
  id: "src_123",
45
45
  object: "source")
46
- source = source.delete
46
+ source = source.detach
47
47
  assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_123/sources/src_123"
48
48
  assert source.is_a?(Stripe::Source)
49
49
  end
50
50
  end
51
51
 
52
+ context "#delete" do
53
+ should "warn that #delete is deprecated" do
54
+ old_stderr = $stderr
55
+ $stderr = StringIO.new
56
+ begin
57
+ source = Stripe::Source.construct_from(customer: "cus_123",
58
+ id: "src_123",
59
+ object: "source")
60
+ source.delete
61
+ message = "NOTE: Stripe::Source#delete is " \
62
+ "deprecated; use #detach instead"
63
+ assert_match Regexp.new(message), $stderr.string
64
+ ensure
65
+ $stderr = old_stderr
66
+ end
67
+ end
68
+ end
69
+
52
70
  should "not be listable" do
53
71
  assert_raises NoMethodError do
54
72
  Stripe::Source.list
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: 3.4.1
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-05 00:00:00.000000000 Z
11
+ date: 2017-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday