stripe 3.5.3 → 3.6.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +2 -1
- data/lib/stripe/account.rb +3 -0
- data/lib/stripe/api_operations/nested_resource.rb +61 -0
- data/lib/stripe/application_fee.rb +3 -0
- data/lib/stripe/customer.rb +8 -0
- data/lib/stripe/transfer.rb +3 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/account_external_accounts_operations_test.rb +66 -0
- data/test/stripe/account_login_links_operations_test.rb +19 -0
- data/test/stripe/api_operations_test.rb +44 -0
- data/test/stripe/application_fee_refunds_operations_test.rb +54 -0
- data/test/stripe/customer_sources_operations_test.rb +66 -0
- data/test/stripe/transfer_reversals_operations_test.rb +55 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fce7c416687a674cc3e18f9bce163fc7d0b33ade
|
4
|
+
data.tar.gz: c0029ea90f92b4efb77a3364d2aa515c3340ed36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54bc6830f3379c2ed2391ec15fe640af867f2aaf2dfd317b926a059d19aa8539c71387c852a30fdd0724e36d885b01bb43740fed307b7b5cd4a56cf105ceaad0
|
7
|
+
data.tar.gz: ea69c31f24db48ed9a7d37ce133805be8004fa82a92c9deddf6aaad6127fa4d4326d12892f40fe73d60f16ca404e31646a2d896f36f6dae0edd94a8064f325b9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.6.0 - 2017-10-17
|
4
|
+
* [#597](https://github.com/stripe/stripe-ruby#597) Add static methods to manipulate resources from parent
|
5
|
+
* `Account` gains methods for external accounts and login links (e.g. `.create_account`, `create_login_link`)
|
6
|
+
* `ApplicationFee` gains methods for refunds
|
7
|
+
* `Customer` gains methods for sources
|
8
|
+
* `Transfer` gains methods for reversals
|
9
|
+
|
3
10
|
## 3.5.3 - 2017-10-16
|
4
11
|
* [#594](https://github.com/stripe/stripe-ruby#594) Make sure that `StripeObject`'s `#deep_copy` maintains original class
|
5
12
|
* [#595](https://github.com/stripe/stripe-ruby#595) Allow `Object#method` to be called on `StripeObject` even if it conflicts with an accessor
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.6.0
|
data/lib/stripe.rb
CHANGED
@@ -16,10 +16,11 @@ require "stripe/version"
|
|
16
16
|
|
17
17
|
# API operations
|
18
18
|
require "stripe/api_operations/create"
|
19
|
-
require "stripe/api_operations/save"
|
20
19
|
require "stripe/api_operations/delete"
|
21
20
|
require "stripe/api_operations/list"
|
21
|
+
require "stripe/api_operations/nested_resource"
|
22
22
|
require "stripe/api_operations/request"
|
23
|
+
require "stripe/api_operations/save"
|
23
24
|
|
24
25
|
# API resource support classes
|
25
26
|
require "stripe/errors"
|
data/lib/stripe/account.rb
CHANGED
@@ -5,10 +5,13 @@ module Stripe
|
|
5
5
|
extend Stripe::APIOperations::List
|
6
6
|
include Stripe::APIOperations::Delete
|
7
7
|
include Stripe::APIOperations::Save
|
8
|
+
extend Stripe::APIOperations::NestedResource
|
8
9
|
|
9
10
|
OBJECT_NAME = "account".freeze
|
10
11
|
|
11
12
|
save_nested_resource :external_account
|
13
|
+
nested_resource_class_methods :external_account
|
14
|
+
nested_resource_class_methods :login_link, operations: %i[create]
|
12
15
|
|
13
16
|
# This method is deprecated. Please use `#external_account=` instead.
|
14
17
|
save_nested_resource :bank_account
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Stripe
|
2
|
+
module APIOperations
|
3
|
+
# Adds methods to help manipulate a subresource from its parent resource so
|
4
|
+
# that it's possible to do so from a static context (i.e. without a
|
5
|
+
# pre-existing collection of subresources on the parent).
|
6
|
+
#
|
7
|
+
# For examle, a transfer gains the static methods for reversals so that the
|
8
|
+
# methods `.create_reversal`, `.retrieve_reversal`, `.update_reversal`,
|
9
|
+
# etc. all become available.
|
10
|
+
module NestedResource
|
11
|
+
def nested_resource_class_methods(resource, path: nil, operations: nil)
|
12
|
+
path ||= "#{resource}s"
|
13
|
+
operations ||= %i[create retrieve update delete list]
|
14
|
+
|
15
|
+
resource_url_method = :"#{resource}s_url"
|
16
|
+
define_singleton_method(resource_url_method) do |id, nested_id = nil|
|
17
|
+
url = "#{resource_url}/#{CGI.escape(id)}/#{CGI.escape(path)}"
|
18
|
+
url += "/#{CGI.escape(nested_id)}" unless nested_id.nil?
|
19
|
+
url
|
20
|
+
end
|
21
|
+
|
22
|
+
operations.each do |operation|
|
23
|
+
case operation
|
24
|
+
when :create
|
25
|
+
define_singleton_method(:"create_#{resource}") do |id, params = {}, opts = {}|
|
26
|
+
url = send(resource_url_method, id)
|
27
|
+
resp, opts = request(:post, url, params, opts)
|
28
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
29
|
+
end
|
30
|
+
when :retrieve
|
31
|
+
define_singleton_method(:"retrieve_#{resource}") do |id, nested_id, opts = {}|
|
32
|
+
url = send(resource_url_method, id, nested_id)
|
33
|
+
resp, opts = request(:get, url, {}, opts)
|
34
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
35
|
+
end
|
36
|
+
when :update
|
37
|
+
define_singleton_method(:"update_#{resource}") do |id, nested_id, params = {}, opts = {}|
|
38
|
+
url = send(resource_url_method, id, nested_id)
|
39
|
+
resp, opts = request(:post, url, params, opts)
|
40
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
41
|
+
end
|
42
|
+
when :delete
|
43
|
+
define_singleton_method(:"delete_#{resource}") do |id, nested_id, params = {}, opts = {}|
|
44
|
+
url = send(resource_url_method, id, nested_id)
|
45
|
+
resp, opts = request(:delete, url, params, opts)
|
46
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
47
|
+
end
|
48
|
+
when :list
|
49
|
+
define_singleton_method(:"list_#{resource}s") do |id, params = {}, opts = {}|
|
50
|
+
url = send(resource_url_method, id)
|
51
|
+
resp, opts = request(:get, url, params, opts)
|
52
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
53
|
+
end
|
54
|
+
else
|
55
|
+
raise ArgumentError, "Unknown operation: #{operation.inspect}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module Stripe
|
2
2
|
class ApplicationFee < APIResource
|
3
3
|
extend Stripe::APIOperations::List
|
4
|
+
extend Stripe::APIOperations::NestedResource
|
4
5
|
|
5
6
|
OBJECT_NAME = "application_fee".freeze
|
6
7
|
|
8
|
+
nested_resource_class_methods :refund, operations: %i[create retrieve update list]
|
9
|
+
|
7
10
|
def self.resource_url
|
8
11
|
"/v1/application_fees"
|
9
12
|
end
|
data/lib/stripe/customer.rb
CHANGED
@@ -4,10 +4,18 @@ module Stripe
|
|
4
4
|
include Stripe::APIOperations::Delete
|
5
5
|
include Stripe::APIOperations::Save
|
6
6
|
extend Stripe::APIOperations::List
|
7
|
+
extend Stripe::APIOperations::NestedResource
|
7
8
|
|
8
9
|
OBJECT_NAME = "customer".freeze
|
9
10
|
|
10
11
|
save_nested_resource :source
|
12
|
+
nested_resource_class_methods :source
|
13
|
+
|
14
|
+
# The API request for deleting a card or bank account and for detaching a
|
15
|
+
# source object are the same.
|
16
|
+
class << self
|
17
|
+
alias detach_source delete_source
|
18
|
+
end
|
11
19
|
|
12
20
|
def add_invoice_item(params, opts = {})
|
13
21
|
opts = @opts.merge(Util.normalize_opts(opts))
|
data/lib/stripe/transfer.rb
CHANGED
@@ -3,9 +3,12 @@ module Stripe
|
|
3
3
|
extend Stripe::APIOperations::List
|
4
4
|
extend Stripe::APIOperations::Create
|
5
5
|
include Stripe::APIOperations::Save
|
6
|
+
extend Stripe::APIOperations::NestedResource
|
6
7
|
|
7
8
|
OBJECT_NAME = "transfer".freeze
|
8
9
|
|
10
|
+
nested_resource_class_methods :reversal, operations: %i[create retrieve update list]
|
11
|
+
|
9
12
|
def cancel
|
10
13
|
resp, api_key = request(:post, cancel_url)
|
11
14
|
initialize_from(resp.data, api_key)
|
data/lib/stripe/version.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class AccountExternalAccountsOperationsTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@account_id = "acct_123"
|
7
|
+
@external_account_id = "ba_123"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "#create_external_account" do
|
11
|
+
should "create an external account" do
|
12
|
+
external_account = Stripe::Account.create_external_account(
|
13
|
+
@account_id,
|
14
|
+
external_account: "btok_123"
|
15
|
+
)
|
16
|
+
assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts"
|
17
|
+
assert external_account.is_a?(Stripe::BankAccount)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "#retrieve_external_account" do
|
22
|
+
should "retrieve an external account" do
|
23
|
+
external_account = Stripe::Account.retrieve_external_account(
|
24
|
+
@account_id,
|
25
|
+
@external_account_id
|
26
|
+
)
|
27
|
+
assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts/#{@external_account_id}"
|
28
|
+
assert external_account.is_a?(Stripe::BankAccount)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "#update_external_account" do
|
33
|
+
should "update an external account" do
|
34
|
+
external_account = Stripe::Account.update_external_account(
|
35
|
+
@account_id,
|
36
|
+
@external_account_id,
|
37
|
+
metadata: { foo: "bar" }
|
38
|
+
)
|
39
|
+
assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts/#{@external_account_id}"
|
40
|
+
assert external_account.is_a?(Stripe::BankAccount)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "#delete_external_account" do
|
45
|
+
should "delete an external_account" do
|
46
|
+
external_account = Stripe::Account.delete_external_account(
|
47
|
+
@account_id,
|
48
|
+
@external_account_id
|
49
|
+
)
|
50
|
+
assert_requested :delete, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts/#{@external_account_id}"
|
51
|
+
assert external_account.is_a?(Stripe::BankAccount)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "#list_external_accounts" do
|
56
|
+
should "list the account's external accounts" do
|
57
|
+
external_accounts = Stripe::Account.list_external_accounts(
|
58
|
+
@account_id
|
59
|
+
)
|
60
|
+
assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/external_accounts"
|
61
|
+
assert external_accounts.is_a?(Stripe::ListObject)
|
62
|
+
assert external_accounts.data.is_a?(Array)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class AccountLoginLinksOperationsTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@account_id = "acct_123"
|
7
|
+
end
|
8
|
+
|
9
|
+
context "#create_login_link" do
|
10
|
+
should "create a login link" do
|
11
|
+
login_link = Stripe::Account.create_login_link(
|
12
|
+
@account_id
|
13
|
+
)
|
14
|
+
assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/login_links"
|
15
|
+
assert login_link.is_a?(Stripe::LoginLink)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -27,5 +27,49 @@ module Stripe
|
|
27
27
|
assert_equal "Cannot update protected field: protected", e.message
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
context ".nested_resource_class_methods" do
|
32
|
+
class MainResource < APIResource
|
33
|
+
extend Stripe::APIOperations::NestedResource
|
34
|
+
nested_resource_class_methods :nested
|
35
|
+
end
|
36
|
+
|
37
|
+
should "define a create method" do
|
38
|
+
stub_request(:post, "#{Stripe.api_base}/v1/mainresources/id/nesteds")
|
39
|
+
.with(body: { foo: "bar" })
|
40
|
+
.to_return(body: JSON.generate(id: "nested_id", object: "nested", foo: "bar"))
|
41
|
+
nested_resource = MainResource.create_nested("id", foo: "bar")
|
42
|
+
assert_equal "bar", nested_resource.foo
|
43
|
+
end
|
44
|
+
|
45
|
+
should "define a retrieve method" do
|
46
|
+
stub_request(:get, "#{Stripe.api_base}/v1/mainresources/id/nesteds/nested_id")
|
47
|
+
.to_return(body: JSON.generate(id: "nested_id", object: "nested", foo: "bar"))
|
48
|
+
nested_resource = MainResource.retrieve_nested("id", "nested_id")
|
49
|
+
assert_equal "bar", nested_resource.foo
|
50
|
+
end
|
51
|
+
|
52
|
+
should "define an update method" do
|
53
|
+
stub_request(:post, "#{Stripe.api_base}/v1/mainresources/id/nesteds/nested_id")
|
54
|
+
.with(body: { foo: "baz" })
|
55
|
+
.to_return(body: JSON.generate(id: "nested_id", object: "nested", foo: "baz"))
|
56
|
+
nested_resource = MainResource.update_nested("id", "nested_id", foo: "baz")
|
57
|
+
assert_equal "baz", nested_resource.foo
|
58
|
+
end
|
59
|
+
|
60
|
+
should "define a delete method" do
|
61
|
+
stub_request(:delete, "#{Stripe.api_base}/v1/mainresources/id/nesteds/nested_id")
|
62
|
+
.to_return(body: JSON.generate(id: "nested_id", object: "nested", deleted: true))
|
63
|
+
nested_resource = MainResource.delete_nested("id", "nested_id")
|
64
|
+
assert_equal true, nested_resource.deleted
|
65
|
+
end
|
66
|
+
|
67
|
+
should "define a list method" do
|
68
|
+
stub_request(:get, "#{Stripe.api_base}/v1/mainresources/id/nesteds")
|
69
|
+
.to_return(body: JSON.generate(object: "list", data: []))
|
70
|
+
nested_resources = MainResource.list_nesteds("id")
|
71
|
+
assert nested_resources.data.is_a?(Array)
|
72
|
+
end
|
73
|
+
end
|
30
74
|
end
|
31
75
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class ApplicationFeeRefundsOperationsTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@application_fee_id = "fee_123"
|
7
|
+
@refund_id = "fr_123"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "#create_refund" do
|
11
|
+
should "create a refund" do
|
12
|
+
refund = Stripe::ApplicationFee.create_refund(
|
13
|
+
@application_fee_id
|
14
|
+
)
|
15
|
+
assert_requested :post, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds"
|
16
|
+
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "#retrieve_refund" do
|
21
|
+
should "retrieve a refund" do
|
22
|
+
refund = Stripe::ApplicationFee.retrieve_refund(
|
23
|
+
@application_fee_id,
|
24
|
+
@refund_id
|
25
|
+
)
|
26
|
+
assert_requested :get, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds/#{@refund_id}"
|
27
|
+
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "#update_refund" do
|
32
|
+
should "update a refund" do
|
33
|
+
refund = Stripe::ApplicationFee.update_refund(
|
34
|
+
@application_fee_id,
|
35
|
+
@refund_id,
|
36
|
+
metadata: { foo: "bar" }
|
37
|
+
)
|
38
|
+
assert_requested :post, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds/#{@refund_id}"
|
39
|
+
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "#list_refunds" do
|
44
|
+
should "list the application fee's refuns" do
|
45
|
+
refunds = Stripe::ApplicationFee.list_refunds(
|
46
|
+
@application_fee_id
|
47
|
+
)
|
48
|
+
assert_requested :get, "#{Stripe.api_base}/v1/application_fees/#{@application_fee_id}/refunds"
|
49
|
+
assert refunds.is_a?(Stripe::ListObject)
|
50
|
+
assert refunds.data.is_a?(Array)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class CustomerSourcesOperationsTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@customer_id = "cus_123"
|
7
|
+
@source_id = "ba_123"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "#create_source" do
|
11
|
+
should "create a source" do
|
12
|
+
source = Stripe::Customer.create_source(
|
13
|
+
@customer_id,
|
14
|
+
source: "tok_123"
|
15
|
+
)
|
16
|
+
assert_requested :post, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources"
|
17
|
+
assert source.is_a?(Stripe::BankAccount)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "#retrieve_source" do
|
22
|
+
should "retrieve a source" do
|
23
|
+
source = Stripe::Customer.retrieve_source(
|
24
|
+
@customer_id,
|
25
|
+
@source_id
|
26
|
+
)
|
27
|
+
assert_requested :get, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources/#{@source_id}"
|
28
|
+
assert source.is_a?(Stripe::BankAccount)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "#update_source" do
|
33
|
+
should "update a source" do
|
34
|
+
source = Stripe::Customer.update_source(
|
35
|
+
@customer_id,
|
36
|
+
@source_id,
|
37
|
+
metadata: { foo: "bar" }
|
38
|
+
)
|
39
|
+
assert_requested :post, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources/#{@source_id}"
|
40
|
+
assert source.is_a?(Stripe::Card)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "#delete_source" do
|
45
|
+
should "delete a source" do
|
46
|
+
source = Stripe::Customer.delete_source(
|
47
|
+
@customer_id,
|
48
|
+
@source_id
|
49
|
+
)
|
50
|
+
assert_requested :delete, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources/#{@source_id}"
|
51
|
+
assert source.is_a?(Stripe::BankAccount)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "#list_sources" do
|
56
|
+
should "list the customer's sources" do
|
57
|
+
sources = Stripe::Customer.list_sources(
|
58
|
+
@customer_id
|
59
|
+
)
|
60
|
+
assert_requested :get, "#{Stripe.api_base}/v1/customers/#{@customer_id}/sources"
|
61
|
+
assert sources.is_a?(Stripe::ListObject)
|
62
|
+
assert sources.data.is_a?(Array)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class TransferReversalsOperationsTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@transfer_id = "tr_123"
|
7
|
+
@reversal_id = "trr_123"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "#create_reversal" do
|
11
|
+
should "create a reversal" do
|
12
|
+
reversal = Stripe::Transfer.create_reversal(
|
13
|
+
@transfer_id,
|
14
|
+
amount: 100
|
15
|
+
)
|
16
|
+
assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals"
|
17
|
+
assert reversal.is_a?(Stripe::Reversal)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "#retrieve_reversal" do
|
22
|
+
should "retrieve a reversal" do
|
23
|
+
reversal = Stripe::Transfer.retrieve_reversal(
|
24
|
+
@transfer_id,
|
25
|
+
@reversal_id
|
26
|
+
)
|
27
|
+
assert_requested :get, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals/#{@reversal_id}"
|
28
|
+
assert reversal.is_a?(Stripe::Reversal)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "#update_reversal" do
|
33
|
+
should "update a reversal" do
|
34
|
+
reversal = Stripe::Transfer.update_reversal(
|
35
|
+
@transfer_id,
|
36
|
+
@reversal_id,
|
37
|
+
metadata: { foo: "bar" }
|
38
|
+
)
|
39
|
+
assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals/#{@reversal_id}"
|
40
|
+
assert reversal.is_a?(Stripe::Reversal)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "#list_reversals" do
|
45
|
+
should "list the transfer's reversals" do
|
46
|
+
reversals = Stripe::Transfer.list_reversals(
|
47
|
+
@transfer_id
|
48
|
+
)
|
49
|
+
assert_requested :get, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals"
|
50
|
+
assert reversals.is_a?(Stripe::ListObject)
|
51
|
+
assert reversals.data.is_a?(Array)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
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: 3.
|
4
|
+
version: 3.6.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-
|
11
|
+
date: 2017-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/stripe/api_operations/create.rb
|
55
55
|
- lib/stripe/api_operations/delete.rb
|
56
56
|
- lib/stripe/api_operations/list.rb
|
57
|
+
- lib/stripe/api_operations/nested_resource.rb
|
57
58
|
- lib/stripe/api_operations/request.rb
|
58
59
|
- lib/stripe/api_operations/save.rb
|
59
60
|
- lib/stripe/api_resource.rb
|
@@ -106,12 +107,15 @@ files:
|
|
106
107
|
- lib/stripe/webhook.rb
|
107
108
|
- stripe.gemspec
|
108
109
|
- test/api_stub_helpers.rb
|
110
|
+
- test/stripe/account_external_accounts_operations_test.rb
|
111
|
+
- test/stripe/account_login_links_operations_test.rb
|
109
112
|
- test/stripe/account_test.rb
|
110
113
|
- test/stripe/alipay_account_test.rb
|
111
114
|
- test/stripe/api_operations_test.rb
|
112
115
|
- test/stripe/api_resource_test.rb
|
113
116
|
- test/stripe/apple_pay_domain_test.rb
|
114
117
|
- test/stripe/application_fee_refund_test.rb
|
118
|
+
- test/stripe/application_fee_refunds_operations_test.rb
|
115
119
|
- test/stripe/application_fee_test.rb
|
116
120
|
- test/stripe/balance_test.rb
|
117
121
|
- test/stripe/bank_account_test.rb
|
@@ -119,6 +123,7 @@ files:
|
|
119
123
|
- test/stripe/country_spec_test.rb
|
120
124
|
- test/stripe/coupon_test.rb
|
121
125
|
- test/stripe/customer_card_test.rb
|
126
|
+
- test/stripe/customer_sources_operations_test.rb
|
122
127
|
- test/stripe/customer_test.rb
|
123
128
|
- test/stripe/dispute_test.rb
|
124
129
|
- test/stripe/ephemeral_key_test.rb
|
@@ -146,6 +151,7 @@ files:
|
|
146
151
|
- test/stripe/subscription_item_test.rb
|
147
152
|
- test/stripe/subscription_test.rb
|
148
153
|
- test/stripe/three_d_secure_test.rb
|
154
|
+
- test/stripe/transfer_reversals_operations_test.rb
|
149
155
|
- test/stripe/transfer_test.rb
|
150
156
|
- test/stripe/util_test.rb
|
151
157
|
- test/stripe/webhook_test.rb
|
@@ -178,12 +184,15 @@ specification_version: 4
|
|
178
184
|
summary: Ruby bindings for the Stripe API
|
179
185
|
test_files:
|
180
186
|
- test/api_stub_helpers.rb
|
187
|
+
- test/stripe/account_external_accounts_operations_test.rb
|
188
|
+
- test/stripe/account_login_links_operations_test.rb
|
181
189
|
- test/stripe/account_test.rb
|
182
190
|
- test/stripe/alipay_account_test.rb
|
183
191
|
- test/stripe/api_operations_test.rb
|
184
192
|
- test/stripe/api_resource_test.rb
|
185
193
|
- test/stripe/apple_pay_domain_test.rb
|
186
194
|
- test/stripe/application_fee_refund_test.rb
|
195
|
+
- test/stripe/application_fee_refunds_operations_test.rb
|
187
196
|
- test/stripe/application_fee_test.rb
|
188
197
|
- test/stripe/balance_test.rb
|
189
198
|
- test/stripe/bank_account_test.rb
|
@@ -191,6 +200,7 @@ test_files:
|
|
191
200
|
- test/stripe/country_spec_test.rb
|
192
201
|
- test/stripe/coupon_test.rb
|
193
202
|
- test/stripe/customer_card_test.rb
|
203
|
+
- test/stripe/customer_sources_operations_test.rb
|
194
204
|
- test/stripe/customer_test.rb
|
195
205
|
- test/stripe/dispute_test.rb
|
196
206
|
- test/stripe/ephemeral_key_test.rb
|
@@ -218,6 +228,7 @@ test_files:
|
|
218
228
|
- test/stripe/subscription_item_test.rb
|
219
229
|
- test/stripe/subscription_test.rb
|
220
230
|
- test/stripe/three_d_secure_test.rb
|
231
|
+
- test/stripe/transfer_reversals_operations_test.rb
|
221
232
|
- test/stripe/transfer_test.rb
|
222
233
|
- test/stripe/util_test.rb
|
223
234
|
- test/stripe/webhook_test.rb
|