stripe 4.11.0 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +4 -0
  4. data/VERSION +1 -1
  5. data/lib/stripe.rb +1 -0
  6. data/lib/stripe/account.rb +2 -0
  7. data/lib/stripe/api_operations/delete.rb +24 -0
  8. data/lib/stripe/api_resource.rb +24 -0
  9. data/lib/stripe/charge.rb +2 -0
  10. data/lib/stripe/customer.rb +2 -0
  11. data/lib/stripe/discount.rb +7 -0
  12. data/lib/stripe/dispute.rb +2 -0
  13. data/lib/stripe/invoice.rb +6 -0
  14. data/lib/stripe/issuing/authorization.rb +3 -0
  15. data/lib/stripe/issuing/card.rb +2 -0
  16. data/lib/stripe/order.rb +3 -0
  17. data/lib/stripe/payment_intent.rb +4 -0
  18. data/lib/stripe/payment_method.rb +3 -0
  19. data/lib/stripe/payout.rb +2 -0
  20. data/lib/stripe/review.rb +2 -0
  21. data/lib/stripe/source.rb +2 -0
  22. data/lib/stripe/subscription.rb +2 -0
  23. data/lib/stripe/subscription_schedule.rb +3 -0
  24. data/lib/stripe/topup.rb +2 -0
  25. data/lib/stripe/transfer.rb +2 -0
  26. data/lib/stripe/util.rb +1 -0
  27. data/lib/stripe/version.rb +1 -1
  28. data/test/stripe/account_test.rb +26 -13
  29. data/test/stripe/apple_pay_domain_test.rb +17 -4
  30. data/test/stripe/charge_test.rb +21 -0
  31. data/test/stripe/coupon_test.rb +15 -5
  32. data/test/stripe/customer_test.rb +27 -9
  33. data/test/stripe/dispute_test.rb +9 -0
  34. data/test/stripe/ephemeral_key_test.rb +7 -0
  35. data/test/stripe/invoice_item_test.rb +17 -6
  36. data/test/stripe/invoice_test.rb +60 -6
  37. data/test/stripe/issuing/authorization_test.rb +32 -10
  38. data/test/stripe/issuing/card_test.rb +14 -5
  39. data/test/stripe/order_test.rb +20 -2
  40. data/test/stripe/payment_intent_test.rb +27 -0
  41. data/test/stripe/payment_method_test.rb +18 -0
  42. data/test/stripe/payout_test.rb +7 -0
  43. data/test/stripe/plan_test.rb +21 -15
  44. data/test/stripe/product_test.rb +15 -5
  45. data/test/stripe/radar/value_list_item_test.rb +15 -5
  46. data/test/stripe/radar/value_list_test.rb +15 -5
  47. data/test/stripe/recipient_test.rb +17 -4
  48. data/test/stripe/sku_test.rb +15 -5
  49. data/test/stripe/source_test.rb +13 -0
  50. data/test/stripe/subscription_item_test.rb +15 -5
  51. data/test/stripe/subscription_schedule_test.rb +29 -0
  52. data/test/stripe/subscription_test.rb +26 -6
  53. data/test/stripe/terminal/location_test.rb +15 -5
  54. data/test/stripe/terminal/reader_test.rb +15 -5
  55. data/test/stripe/topup_test.rb +8 -0
  56. data/test/stripe/webhook_endpoint_test.rb +17 -0
  57. metadata +3 -2
@@ -39,11 +39,21 @@ module Stripe
39
39
  assert product.is_a?(Stripe::Product)
40
40
  end
41
41
 
42
- should "be deletable" do
43
- product = Stripe::Product.retrieve("prod_123")
44
- product = product.delete
45
- assert_requested :delete, "#{Stripe.api_base}/v1/products/#{product.id}"
46
- assert product.is_a?(Stripe::Product)
42
+ context "#delete" do
43
+ should "be deletable" do
44
+ product = Stripe::Product.retrieve("prod_123")
45
+ product = product.delete
46
+ assert_requested :delete, "#{Stripe.api_base}/v1/products/#{product.id}"
47
+ assert product.is_a?(Stripe::Product)
48
+ end
49
+ end
50
+
51
+ context ".delete" do
52
+ should "be deletable" do
53
+ product = Stripe::Product.delete("prod_123")
54
+ assert_requested :delete, "#{Stripe.api_base}/v1/products/prod_123"
55
+ assert product.is_a?(Stripe::Product)
56
+ end
47
57
  end
48
58
  end
49
59
  end
@@ -27,11 +27,21 @@ module Stripe
27
27
  assert item.is_a?(Stripe::Radar::ValueListItem)
28
28
  end
29
29
 
30
- should "be deletable" do
31
- list = Stripe::Radar::ValueListItem.retrieve("rsli_123")
32
- list = list.delete
33
- assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_list_items/rsli_123"
34
- assert list.is_a?(Stripe::Radar::ValueListItem)
30
+ context "#delete" do
31
+ should "be deletable" do
32
+ list = Stripe::Radar::ValueListItem.retrieve("rsli_123")
33
+ list = list.delete
34
+ assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_list_items/rsli_123"
35
+ assert list.is_a?(Stripe::Radar::ValueListItem)
36
+ end
37
+ end
38
+
39
+ context ".delete" do
40
+ should "be deletable" do
41
+ list = Stripe::Radar::ValueListItem.delete("rsli_123")
42
+ assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_list_items/rsli_123"
43
+ assert list.is_a?(Stripe::Radar::ValueListItem)
44
+ end
35
45
  end
36
46
  end
37
47
  end
@@ -40,11 +40,21 @@ module Stripe
40
40
  assert list.is_a?(Stripe::Radar::ValueList)
41
41
  end
42
42
 
43
- should "be deletable" do
44
- list = Stripe::Radar::ValueList.retrieve("rsl_123")
45
- list = list.delete
46
- assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
47
- assert list.is_a?(Stripe::Radar::ValueList)
43
+ context "#delete" do
44
+ should "be deletable" do
45
+ list = Stripe::Radar::ValueList.retrieve("rsl_123")
46
+ list = list.delete
47
+ assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
48
+ assert list.is_a?(Stripe::Radar::ValueList)
49
+ end
50
+ end
51
+
52
+ context ".delete" do
53
+ should "be deletable" do
54
+ list = Stripe::Radar::ValueList.delete("rsl_123")
55
+ assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
56
+ assert list.is_a?(Stripe::Radar::ValueList)
57
+ end
48
58
  end
49
59
  end
50
60
  end
@@ -40,10 +40,23 @@ module Stripe
40
40
  end
41
41
 
42
42
  should "be deletable" do
43
- recipient = Stripe::Recipient.retrieve("rp_123")
44
- recipient = recipient.delete
45
- assert_requested :delete, "#{Stripe.api_base}/v1/recipients/#{recipient.id}"
46
- assert recipient.is_a?(Stripe::Recipient)
43
+ end
44
+
45
+ context "#delete" do
46
+ should "be deletable" do
47
+ recipient = Stripe::Recipient.retrieve("rp_123")
48
+ recipient = recipient.delete
49
+ assert_requested :delete, "#{Stripe.api_base}/v1/recipients/#{recipient.id}"
50
+ assert recipient.is_a?(Stripe::Recipient)
51
+ end
52
+ end
53
+
54
+ context ".delete" do
55
+ should "be deletable" do
56
+ recipient = Stripe::Recipient.delete("rp_123")
57
+ assert_requested :delete, "#{Stripe.api_base}/v1/recipients/rp_123"
58
+ assert recipient.is_a?(Stripe::Recipient)
59
+ end
47
60
  end
48
61
  end
49
62
  end
@@ -40,11 +40,21 @@ module Stripe
40
40
  assert sku.is_a?(Stripe::SKU)
41
41
  end
42
42
 
43
- should "be deletable" do
44
- sku = Stripe::SKU.retrieve("sku_123")
45
- sku = sku.delete
46
- assert_requested :delete, "#{Stripe.api_base}/v1/skus/#{sku.id}"
47
- assert sku.is_a?(Stripe::SKU)
43
+ context "#delete" do
44
+ should "be deletable" do
45
+ sku = Stripe::SKU.retrieve("sku_123")
46
+ sku = sku.delete
47
+ assert_requested :delete, "#{Stripe.api_base}/v1/skus/#{sku.id}"
48
+ assert sku.is_a?(Stripe::SKU)
49
+ end
50
+ end
51
+
52
+ context ".delete" do
53
+ should "be deletable" do
54
+ sku = Stripe::SKU.delete("sku_123")
55
+ assert_requested :delete, "#{Stripe.api_base}/v1/skus/sku_123"
56
+ assert sku.is_a?(Stripe::SKU)
57
+ end
48
58
  end
49
59
  end
50
60
  end
@@ -79,6 +79,19 @@ module Stripe
79
79
  should "verify the source" do
80
80
  source = Stripe::Source.retrieve("src_123")
81
81
  source = source.verify(values: [1, 2])
82
+ assert_requested :post,
83
+ "#{Stripe.api_base}/v1/sources/#{source.id}/verify",
84
+ body: { values: [1, 2] }
85
+ assert source.is_a?(Stripe::Source)
86
+ end
87
+ end
88
+
89
+ context ".verify" do
90
+ should "verify the source" do
91
+ source = Stripe::Source.verify("src_123", values: [1, 2])
92
+ assert_requested :post,
93
+ "#{Stripe.api_base}/v1/sources/src_123/verify",
94
+ body: { values: [1, 2] }
82
95
  assert source.is_a?(Stripe::Source)
83
96
  end
84
97
  end
@@ -43,11 +43,21 @@ module Stripe
43
43
  assert item.is_a?(Stripe::SubscriptionItem)
44
44
  end
45
45
 
46
- should "be deletable" do
47
- item = Stripe::SubscriptionItem.retrieve("si_123")
48
- item = item.delete
49
- assert_requested :delete, "#{Stripe.api_base}/v1/subscription_items/#{item.id}"
50
- assert item.is_a?(Stripe::SubscriptionItem)
46
+ context "#delete" do
47
+ should "be deletable" do
48
+ item = Stripe::SubscriptionItem.retrieve("si_123")
49
+ item = item.delete
50
+ assert_requested :delete, "#{Stripe.api_base}/v1/subscription_items/#{item.id}"
51
+ assert item.is_a?(Stripe::SubscriptionItem)
52
+ end
53
+ end
54
+
55
+ context ".delete" do
56
+ should "be deletable" do
57
+ item = Stripe::SubscriptionItem.delete("si_123")
58
+ assert_requested :delete, "#{Stripe.api_base}/v1/subscription_items/si_123"
59
+ assert item.is_a?(Stripe::SubscriptionItem)
60
+ end
51
61
  end
52
62
  end
53
63
  end
@@ -51,6 +51,15 @@ module Stripe
51
51
  end
52
52
  end
53
53
 
54
+ context ".cancel" do
55
+ should "cancel a subscription schedule" do
56
+ schedule = Stripe::SubscriptionSchedule.cancel("sub_sched_123")
57
+ assert_requested :post,
58
+ "#{Stripe.api_base}/v1/subscription_schedules/sub_sched_123/cancel"
59
+ assert schedule.is_a?(Stripe::SubscriptionSchedule)
60
+ end
61
+ end
62
+
54
63
  context "#release" do
55
64
  should "release a subscription schedule" do
56
65
  schedule = Stripe::SubscriptionSchedule.retrieve("sub_sched_123")
@@ -60,5 +69,25 @@ module Stripe
60
69
  assert schedule.is_a?(Stripe::SubscriptionSchedule)
61
70
  end
62
71
  end
72
+
73
+ context ".release" do
74
+ should "release a subscription schedule" do
75
+ schedule = Stripe::SubscriptionSchedule.release("sub_sched_123")
76
+ assert_requested :post,
77
+ "#{Stripe.api_base}/v1/subscription_schedules/sub_sched_123/release"
78
+ assert schedule.is_a?(Stripe::SubscriptionSchedule)
79
+ end
80
+ end
81
+
82
+ context "#revisions" do
83
+ should "retrieve the subscription schedule's revisions" do
84
+ schedule = Stripe::SubscriptionSchedule.retrieve("sub_sched_123")
85
+ revisions = schedule.revisions
86
+ assert_requested :get,
87
+ "#{Stripe.api_base}/v1/subscription_schedules/sub_sched_123/revisions"
88
+ assert revisions.data.is_a?(Array)
89
+ assert revisions.data[0].is_a?(Stripe::SubscriptionScheduleRevision)
90
+ end
91
+ end
63
92
  end
64
93
  end
@@ -41,20 +41,40 @@ module Stripe
41
41
  assert subscription.is_a?(Stripe::Subscription)
42
42
  end
43
43
 
44
- should "be deletable" do
45
- subscription = Stripe::Subscription.retrieve("sub_123")
46
- subscription = subscription.delete
47
- assert_requested :delete,
48
- "#{Stripe.api_base}/v1/subscriptions/#{subscription.id}"
49
- assert subscription.is_a?(Stripe::Subscription)
44
+ context "#delete" do
45
+ should "be deletable" do
46
+ subscription = Stripe::Subscription.retrieve("sub_123")
47
+ subscription = subscription.delete
48
+ assert_requested :delete,
49
+ "#{Stripe.api_base}/v1/subscriptions/#{subscription.id}"
50
+ assert subscription.is_a?(Stripe::Subscription)
51
+ end
52
+ end
53
+
54
+ context ".delete" do
55
+ should "be deletable" do
56
+ subscription = Stripe::Subscription.delete("sub_123")
57
+ assert_requested :delete,
58
+ "#{Stripe.api_base}/v1/subscriptions/sub_123"
59
+ assert subscription.is_a?(Stripe::Subscription)
60
+ end
50
61
  end
51
62
 
52
63
  context "#delete_discount" do
53
64
  should "be able to delete a subscriptions's discount" do
54
65
  subscription = Stripe::Subscription.retrieve("sub_123")
55
66
  subscription = subscription.delete_discount
67
+ assert_requested :delete, "#{Stripe.api_base}/v1/subscriptions/sub_123/discount"
56
68
  assert subscription.is_a?(Stripe::Subscription)
57
69
  end
58
70
  end
71
+
72
+ context ".delete_discount" do
73
+ should "be able to delete a subscriptions's discount" do
74
+ discount = Stripe::Subscription.delete_discount("sub_123")
75
+ assert_requested :delete, "#{Stripe.api_base}/v1/subscriptions/sub_123/discount"
76
+ assert discount.is_a?(Stripe::Discount)
77
+ end
78
+ end
59
79
  end
60
80
  end
@@ -47,11 +47,21 @@ module Stripe
47
47
  assert location.is_a?(Stripe::Terminal::Location)
48
48
  end
49
49
 
50
- should "be deletable" do
51
- location = Stripe::Terminal::Location.retrieve("loc_123")
52
- location = location.delete
53
- assert_requested :delete, "#{Stripe.api_base}/v1/terminal/locations/#{location.id}"
54
- assert location.is_a?(Stripe::Terminal::Location)
50
+ context "#delete" do
51
+ should "be deletable" do
52
+ location = Stripe::Terminal::Location.retrieve("loc_123")
53
+ location = location.delete
54
+ assert_requested :delete, "#{Stripe.api_base}/v1/terminal/locations/#{location.id}"
55
+ assert location.is_a?(Stripe::Terminal::Location)
56
+ end
57
+ end
58
+
59
+ context ".delete" do
60
+ should "be deletable" do
61
+ location = Stripe::Terminal::Location.delete("loc_123")
62
+ assert_requested :delete, "#{Stripe.api_base}/v1/terminal/locations/loc_123"
63
+ assert location.is_a?(Stripe::Terminal::Location)
64
+ end
55
65
  end
56
66
  end
57
67
  end
@@ -41,11 +41,21 @@ module Stripe
41
41
  assert reader.is_a?(Stripe::Terminal::Reader)
42
42
  end
43
43
 
44
- should "be deletable" do
45
- reader = Stripe::Terminal::Reader.retrieve("rdr_123")
46
- reader = reader.delete
47
- assert_requested :delete, "#{Stripe.api_base}/v1/terminal/readers/#{reader.id}"
48
- assert reader.is_a?(Stripe::Terminal::Reader)
44
+ context "#delete" do
45
+ should "be deletable" do
46
+ reader = Stripe::Terminal::Reader.retrieve("rdr_123")
47
+ reader = reader.delete
48
+ assert_requested :delete, "#{Stripe.api_base}/v1/terminal/readers/#{reader.id}"
49
+ assert reader.is_a?(Stripe::Terminal::Reader)
50
+ end
51
+ end
52
+
53
+ context ".delete" do
54
+ should "be deletable" do
55
+ reader = Stripe::Terminal::Reader.delete("rdr_123")
56
+ assert_requested :delete, "#{Stripe.api_base}/v1/terminal/readers/rdr_123"
57
+ assert reader.is_a?(Stripe::Terminal::Reader)
58
+ end
49
59
  end
50
60
  end
51
61
  end
@@ -50,5 +50,13 @@ module Stripe
50
50
  assert topup.is_a?(Stripe::Topup)
51
51
  end
52
52
  end
53
+
54
+ context ".cancel" do
55
+ should "cancel the topup" do
56
+ topup = Stripe::Topup.cancel("tu_123")
57
+ assert_requested :post, "#{Stripe.api_base}/v1/topups/tu_123/cancel"
58
+ assert topup.is_a?(Stripe::Topup)
59
+ end
60
+ end
53
61
  end
54
62
  end
@@ -38,5 +38,22 @@ module Stripe
38
38
  assert_requested :post, "#{Stripe.api_base}/v1/webhook_endpoints/we_123"
39
39
  assert webhook_endpoint.is_a?(Stripe::WebhookEndpoint)
40
40
  end
41
+
42
+ context "#delete" do
43
+ should "be deletable" do
44
+ webhook_endpoint = Stripe::WebhookEndpoint.retrieve("we_123")
45
+ webhook_endpoint = webhook_endpoint.delete
46
+ assert_requested :delete, "#{Stripe.api_base}/v1/webhook_endpoints/#{webhook_endpoint.id}"
47
+ assert webhook_endpoint.is_a?(Stripe::WebhookEndpoint)
48
+ end
49
+ end
50
+
51
+ context ".delete" do
52
+ should "be deletable" do
53
+ webhook_endpoint = Stripe::WebhookEndpoint.delete("we_123")
54
+ assert_requested :delete, "#{Stripe.api_base}/v1/webhook_endpoints/we_123"
55
+ assert webhook_endpoint.is_a?(Stripe::WebhookEndpoint)
56
+ end
57
+ end
41
58
  end
42
59
  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: 4.11.0
4
+ version: 4.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: 2019-03-26 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -87,6 +87,7 @@ files:
87
87
  - lib/stripe/country_spec.rb
88
88
  - lib/stripe/coupon.rb
89
89
  - lib/stripe/customer.rb
90
+ - lib/stripe/discount.rb
90
91
  - lib/stripe/dispute.rb
91
92
  - lib/stripe/ephemeral_key.rb
92
93
  - lib/stripe/errors.rb