stripe 4.9.1 → 4.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b0bfe8d9b4817553b20b94c660d08bdbcf0bec1b8c655636393e9288ac5ee2
4
- data.tar.gz: 6a41f5b4709736df4e25c402d2171404b34ea8f6f92e7b1f4c22a8232bfe7b89
3
+ metadata.gz: '09105a67e4d42983626822bcf90bf3351cc649b675685eaf9cb32c3933906495'
4
+ data.tar.gz: 210510e3a1ea6c59af40032f686c5e134b782ade08a6105d642f839ee29abe7c
5
5
  SHA512:
6
- metadata.gz: 04a895d4d2f11ad5d9c74e3d99a2a7b9dddd46629e2df8413fd9370e5cfc8b11592232e0cb5982b01d9fca7ac6b5fb5cfc827646e725c8b9ce3e55a83bc0f9c6
7
- data.tar.gz: cabfe746220087d68288f31636fa5eace4d00a36a5add7791fa7676751df4d81175d7a325818a9afe87a99849c7decfbd6e1d39829b967c482379ed2bde3b285
6
+ metadata.gz: 3c3c5cfe19a51851fb7b10db82f628a3584222ad8a7bf3151bc007d867659d0090c4eee8683edc4e2fd45f6ba875c117197522001dca145820e96ead9a627030
7
+ data.tar.gz: 74e73fb61e12848686c1b842c149a3709576cbe82debf77f9aa1b213bf4a4c5e938c018d347c0edd7315a75f388b78140e1f546c9d80a45a13c343885056f4ec
@@ -17,7 +17,7 @@ sudo: false
17
17
  env:
18
18
  global:
19
19
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.47.0
20
+ - STRIPE_MOCK_VERSION=0.49.0
21
21
 
22
22
  cache:
23
23
  directories:
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.10.0 - 2019-03-18
4
+ * [#745](https://github.com/stripe/stripe-ruby/pull/745) Add support for the `PaymentMethod` resource and APIs
5
+ * [#747](https://github.com/stripe/stripe-ruby/pull/747) Add support for retrieving a Checkout `Session`
6
+ * [#748](https://github.com/stripe/stripe-ruby/pull/748) Add support for deleting a Terminal `Location` and `Reader`
7
+
3
8
  ## 4.9.1 - 2019-03-18
4
9
  * [#750](https://github.com/stripe/stripe-ruby/pull/750) Catch error and warn if unable to remove a method
5
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.9.1
1
+ 4.10.0
@@ -73,6 +73,7 @@ require "stripe/login_link"
73
73
  require "stripe/order"
74
74
  require "stripe/order_return"
75
75
  require "stripe/payment_intent"
76
+ require "stripe/payment_method"
76
77
  require "stripe/payout"
77
78
  require "stripe/person"
78
79
  require "stripe/plan"
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class PaymentMethod < APIResource
5
+ extend Stripe::APIOperations::Create
6
+ include Stripe::APIOperations::Save
7
+ extend Stripe::APIOperations::List
8
+
9
+ OBJECT_NAME = "payment_method".freeze
10
+
11
+ def attach(params = {}, opts = {})
12
+ url = resource_url + "/attach"
13
+ resp, opts = request(:post, url, params, opts)
14
+ initialize_from(resp.data, opts)
15
+ end
16
+
17
+ def detach(params = {}, opts = {})
18
+ url = resource_url + "/detach"
19
+ resp, opts = request(:post, url, params, opts)
20
+ initialize_from(resp.data, opts)
21
+ end
22
+ end
23
+ end
@@ -4,6 +4,7 @@ module Stripe
4
4
  module Terminal
5
5
  class Location < Stripe::APIResource
6
6
  extend Stripe::APIOperations::Create
7
+ include Stripe::APIOperations::Delete
7
8
  extend Stripe::APIOperations::List
8
9
  include Stripe::APIOperations::Save
9
10
 
@@ -4,6 +4,7 @@ module Stripe
4
4
  module Terminal
5
5
  class Reader < Stripe::APIResource
6
6
  extend Stripe::APIOperations::Create
7
+ include Stripe::APIOperations::Delete
7
8
  extend Stripe::APIOperations::List
8
9
  include Stripe::APIOperations::Save
9
10
 
@@ -83,6 +83,7 @@ module Stripe
83
83
  Order::OBJECT_NAME => Order,
84
84
  OrderReturn::OBJECT_NAME => OrderReturn,
85
85
  PaymentIntent::OBJECT_NAME => PaymentIntent,
86
+ PaymentMethod::OBJECT_NAME => PaymentMethod,
86
87
  Payout::OBJECT_NAME => Payout,
87
88
  Person::OBJECT_NAME => Person,
88
89
  Plan::OBJECT_NAME => Plan,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "4.9.1".freeze
4
+ VERSION = "4.10.0".freeze
5
5
  end
@@ -30,6 +30,12 @@ module Stripe
30
30
  assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions"
31
31
  assert session.is_a?(Stripe::Checkout::Session)
32
32
  end
33
+
34
+ should "be retrievable" do
35
+ charge = Stripe::Checkout::Session.retrieve("cs_123")
36
+ assert_requested :get, "#{Stripe.api_base}/v1/checkout/sessions/cs_123"
37
+ assert charge.is_a?(Stripe::Checkout::Session)
38
+ end
33
39
  end
34
40
  end
35
41
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("../../test_helper", __FILE__)
4
+
5
+ module Stripe
6
+ class PaymentMethodTest < Test::Unit::TestCase
7
+ should "be listable" do
8
+ payment_methods = Stripe::PaymentMethod.list(
9
+ customer: "cus_123",
10
+ type: "card"
11
+ )
12
+ assert_requested :get, "#{Stripe.api_base}/v1/payment_methods?customer=cus_123&type=card"
13
+ assert payment_methods.data.is_a?(Array)
14
+ assert payment_methods.first.is_a?(Stripe::PaymentMethod)
15
+ end
16
+
17
+ should "be retrievable" do
18
+ payment_method = Stripe::PaymentMethod.retrieve("pm_123")
19
+ assert_requested :get, "#{Stripe.api_base}/v1/payment_methods/pm_123"
20
+ assert payment_method.is_a?(Stripe::PaymentMethod)
21
+ end
22
+
23
+ should "be creatable" do
24
+ payment_method = Stripe::PaymentMethod.create(
25
+ type: "card"
26
+ )
27
+ assert_requested :post, "#{Stripe.api_base}/v1/payment_methods"
28
+ assert payment_method.is_a?(Stripe::PaymentMethod)
29
+ end
30
+
31
+ should "be saveable" do
32
+ payment_method = Stripe::PaymentMethod.retrieve("pm_123")
33
+ payment_method.metadata["key"] = "value"
34
+ payment_method.save
35
+ assert_requested :post, "#{Stripe.api_base}/v1/payment_methods/#{payment_method.id}"
36
+ end
37
+
38
+ should "be updateable" do
39
+ payment_method = Stripe::PaymentMethod.update("pm_123", metadata: { key: "value" })
40
+ assert_requested :post, "#{Stripe.api_base}/v1/payment_methods/pm_123"
41
+ assert payment_method.is_a?(Stripe::PaymentMethod)
42
+ end
43
+
44
+ context "#attach" do
45
+ should "attach payment_method" do
46
+ payment_method = Stripe::PaymentMethod.construct_from(id: "pm_123", object: "payment_method")
47
+ payment_method = payment_method.attach(
48
+ customer: "cus_123"
49
+ )
50
+
51
+ assert_requested :post, "#{Stripe.api_base}/v1/payment_methods/pm_123/attach"
52
+ assert payment_method.is_a?(Stripe::PaymentMethod)
53
+ end
54
+ end
55
+
56
+ context "#detach" do
57
+ should "detach payment_method" do
58
+ payment_method = Stripe::PaymentMethod.construct_from(id: "pm_123", object: "payment_method")
59
+ payment_method = payment_method.detach
60
+
61
+ assert_requested :post, "#{Stripe.api_base}/v1/payment_methods/pm_123/detach"
62
+ assert payment_method.is_a?(Stripe::PaymentMethod)
63
+ end
64
+ end
65
+ end
66
+ end
@@ -46,6 +46,13 @@ module Stripe
46
46
  assert_requested :post, "#{Stripe.api_base}/v1/terminal/locations/loc_123"
47
47
  assert location.is_a?(Stripe::Terminal::Location)
48
48
  end
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)
55
+ end
49
56
  end
50
57
  end
51
58
  end
@@ -40,6 +40,13 @@ module Stripe
40
40
  assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/rdr_123"
41
41
  assert reader.is_a?(Stripe::Terminal::Reader)
42
42
  end
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)
49
+ end
43
50
  end
44
51
  end
45
52
  end
@@ -17,7 +17,7 @@ require ::File.expand_path("../test_data", __FILE__)
17
17
  require ::File.expand_path("../stripe_mock", __FILE__)
18
18
 
19
19
  # If changing this number, please also change it in `.travis.yml`.
20
- MOCK_MINIMUM_VERSION = "0.47.0".freeze
20
+ MOCK_MINIMUM_VERSION = "0.49.0".freeze
21
21
  MOCK_PORT = Stripe::StripeMock.start
22
22
 
23
23
  # Disable all real network connections except those that are outgoing to
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.1
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
@@ -110,6 +110,7 @@ files:
110
110
  - lib/stripe/order.rb
111
111
  - lib/stripe/order_return.rb
112
112
  - lib/stripe/payment_intent.rb
113
+ - lib/stripe/payment_method.rb
113
114
  - lib/stripe/payout.rb
114
115
  - lib/stripe/person.rb
115
116
  - lib/stripe/plan.rb
@@ -194,6 +195,7 @@ files:
194
195
  - test/stripe/order_return_test.rb
195
196
  - test/stripe/order_test.rb
196
197
  - test/stripe/payment_intent_test.rb
198
+ - test/stripe/payment_method_test.rb
197
199
  - test/stripe/payout_test.rb
198
200
  - test/stripe/person_test.rb
199
201
  - test/stripe/plan_test.rb
@@ -303,6 +305,7 @@ test_files:
303
305
  - test/stripe/order_return_test.rb
304
306
  - test/stripe/order_test.rb
305
307
  - test/stripe/payment_intent_test.rb
308
+ - test/stripe/payment_method_test.rb
306
309
  - test/stripe/payout_test.rb
307
310
  - test/stripe/person_test.rb
308
311
  - test/stripe/plan_test.rb