stripe 2.11.0 → 2.12.0

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.
@@ -36,7 +36,7 @@ module Stripe
36
36
  end
37
37
 
38
38
  should "be creatable" do
39
- account = Stripe::Account.create(:metadata => {})
39
+ account = Stripe::Account.create(:metadata => {}, :type => 'standard')
40
40
  assert_requested :post, "#{Stripe.api_base}/v1/accounts"
41
41
  assert account.kind_of?(Stripe::Account)
42
42
  end
@@ -109,7 +109,7 @@ module Stripe
109
109
  with(headers: {"Authorization" => "Bearer sk_test_local"}).
110
110
  to_return(body: JSON.generate(API_FIXTURES.fetch(:charge)))
111
111
 
112
- Stripe::Charge.create({:card => {:number => '4242424242424242'}},
112
+ Stripe::Charge.create({:source => 'tok_visa'},
113
113
  'sk_test_local')
114
114
  end
115
115
  end
@@ -128,7 +128,7 @@ module Stripe
128
128
  with(headers: {"Authorization" => "Bearer local"}).
129
129
  to_return(body: JSON.generate(API_FIXTURES.fetch(:charge)))
130
130
 
131
- Stripe::Charge.create({:card => {:number => '4242424242424242'}},
131
+ Stripe::Charge.create({:source => 'tok_visa'},
132
132
  'local')
133
133
  end
134
134
 
@@ -0,0 +1,88 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Stripe
4
+ class EphemeralKeyTest < Test::Unit::TestCase
5
+ context "#create" do
6
+ FIXTURE = API_FIXTURES.fetch(:ephemeral_key_with_secret)
7
+
8
+ should "succeed" do
9
+ key = Stripe::EphemeralKey.create(
10
+ {customer:"cus_123"},
11
+ {stripe_version:"2017-05-25"}
12
+ )
13
+
14
+ assert_requested(
15
+ :post,
16
+ "#{Stripe.api_base}/v1/ephemeral_keys",
17
+ headers: {'Stripe-Version' => '2017-05-25'}
18
+ )
19
+
20
+ assert key.kind_of?(Stripe::EphemeralKey)
21
+ end
22
+
23
+ context "#no global version" do
24
+ should "use the correct api version" do
25
+ key = Stripe::EphemeralKey.create(
26
+ {customer: "cus_123"},
27
+ {stripe_version: "2017-06-05"}
28
+ )
29
+
30
+ assert_requested(
31
+ :post,
32
+ "#{Stripe.api_base}/v1/ephemeral_keys",
33
+ headers: {'Stripe-Version' => '2017-06-05'}
34
+ )
35
+
36
+ assert key.kind_of?(Stripe::EphemeralKey)
37
+ end
38
+
39
+ should "error without an explicit api version" do
40
+ e = assert_raises(ArgumentError) do
41
+ Stripe::EphemeralKey.create(customer: "cus_123")
42
+ end
43
+ assert_match("stripe_version must be specified", e.message)
44
+ end
45
+ end
46
+
47
+ context "#with global version" do
48
+ setup do
49
+ Stripe.api_version = "2017-05-25"
50
+ end
51
+
52
+ teardown do
53
+ Stripe.api_version = nil
54
+ end
55
+
56
+ should "use the correct api version" do
57
+ key = Stripe::EphemeralKey.create(
58
+ {customer: "cus_123"},
59
+ {stripe_version: "2017-05-25"}
60
+ )
61
+
62
+ assert key.kind_of?(Stripe::EphemeralKey)
63
+ end
64
+
65
+ should "error without an explicit api version" do
66
+ e = assert_raises(ArgumentError) do
67
+ Stripe::EphemeralKey.create(customer: "cus_123")
68
+ end
69
+ assert_match("stripe_version must be specified", e.message)
70
+ end
71
+ end
72
+ end
73
+
74
+ context "#delete" do
75
+ FIXTURE = API_FIXTURES.fetch(:ephemeral_key)
76
+
77
+ should "succeed" do
78
+ key = Stripe::EphemeralKey.create(
79
+ {customer: 'cus_123'},
80
+ {stripe_version: '2017-05-25'}
81
+ )
82
+
83
+ key.delete
84
+ assert_requested :delete, "#{Stripe.api_base}/v1/ephemeral_keys/#{key.id}"
85
+ end
86
+ end
87
+ end
88
+ end
@@ -39,13 +39,5 @@ module Stripe
39
39
  assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{FIXTURE[:id]}"
40
40
  assert transfer.kind_of?(Stripe::Transfer)
41
41
  end
42
-
43
- context "#cancel" do
44
- should "cancel a transfer" do
45
- transfer = Stripe::Transfer.retrieve(FIXTURE[:id])
46
- transfer = transfer.cancel
47
- assert transfer.kind_of?(Stripe::Transfer)
48
- end
49
- end
50
42
  end
51
43
  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: 2.11.0
4
+ version: 2.12.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-05-26 00:00:00.000000000 Z
11
+ date: 2017-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -68,6 +68,7 @@ files:
68
68
  - lib/stripe/coupon.rb
69
69
  - lib/stripe/customer.rb
70
70
  - lib/stripe/dispute.rb
71
+ - lib/stripe/ephemeral_key.rb
71
72
  - lib/stripe/errors.rb
72
73
  - lib/stripe/event.rb
73
74
  - lib/stripe/file_upload.rb
@@ -124,6 +125,7 @@ files:
124
125
  - test/stripe/customer_card_test.rb
125
126
  - test/stripe/customer_test.rb
126
127
  - test/stripe/dispute_test.rb
128
+ - test/stripe/ephemeral_key_test.rb
127
129
  - test/stripe/errors_test.rb
128
130
  - test/stripe/file_upload_test.rb
129
131
  - test/stripe/invoice_item_test.rb
@@ -199,6 +201,7 @@ test_files:
199
201
  - test/stripe/customer_card_test.rb
200
202
  - test/stripe/customer_test.rb
201
203
  - test/stripe/dispute_test.rb
204
+ - test/stripe/ephemeral_key_test.rb
202
205
  - test/stripe/errors_test.rb
203
206
  - test/stripe/file_upload_test.rb
204
207
  - test/stripe/invoice_item_test.rb
@@ -230,4 +233,3 @@ test_files:
230
233
  - test/stripe_test.rb
231
234
  - test/test_data.rb
232
235
  - test/test_helper.rb
233
- has_rdoc: