stripe 4.16.0 → 4.17.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/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/README.md +11 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +1 -0
- data/lib/stripe/account.rb +7 -2
- data/lib/stripe/api_operations/delete.rb +0 -2
- data/lib/stripe/api_operations/nested_resource.rb +4 -3
- data/lib/stripe/bank_account.rb +1 -1
- data/lib/stripe/capability.rb +26 -0
- data/lib/stripe/card.rb +1 -1
- data/lib/stripe/charge.rb +1 -1
- data/lib/stripe/checkout/session.rb +1 -1
- data/lib/stripe/coupon.rb +1 -1
- data/lib/stripe/credit_note.rb +2 -3
- data/lib/stripe/dispute.rb +3 -1
- data/lib/stripe/file_link.rb +1 -1
- data/lib/stripe/invoice.rb +12 -18
- data/lib/stripe/invoice_item.rb +1 -1
- data/lib/stripe/issuing/authorization.rb +1 -1
- data/lib/stripe/issuing/card.rb +1 -1
- data/lib/stripe/issuing/cardholder.rb +1 -1
- data/lib/stripe/issuing/dispute.rb +1 -1
- data/lib/stripe/issuing/transaction.rb +1 -1
- data/lib/stripe/order.rb +1 -1
- data/lib/stripe/payment_method.rb +3 -5
- data/lib/stripe/payout.rb +6 -4
- data/lib/stripe/product.rb +2 -2
- data/lib/stripe/radar/value_list.rb +1 -1
- data/lib/stripe/radar/value_list_item.rb +1 -1
- data/lib/stripe/recipient.rb +1 -1
- data/lib/stripe/reporting/report_run.rb +1 -1
- data/lib/stripe/reporting/report_type.rb +1 -1
- data/lib/stripe/sigma/scheduled_query_run.rb +1 -1
- data/lib/stripe/sku.rb +2 -2
- data/lib/stripe/source.rb +3 -3
- data/lib/stripe/subscription_item.rb +1 -1
- data/lib/stripe/subscription_schedule.rb +2 -2
- data/lib/stripe/tax_id.rb +1 -1
- data/lib/stripe/tax_rate.rb +1 -1
- data/lib/stripe/terminal/connection_token.rb +1 -1
- data/lib/stripe/terminal/location.rb +1 -1
- data/lib/stripe/terminal/reader.rb +1 -1
- data/lib/stripe/topup.rb +4 -4
- data/lib/stripe/transfer.rb +1 -1
- data/lib/stripe/usage_record.rb +2 -2
- data/lib/stripe/util.rb +3 -0
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook_endpoint.rb +1 -1
- data/test/stripe/account_test.rb +34 -0
- data/test/stripe/api_resource_test.rb +1 -1
- data/test/stripe/capability_test.rb +45 -0
- data/test/test_helper.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d3a140d2d3cb343cb427df5438201a04e82a8eb71cb352241955e4ae70ca6c3
|
|
4
|
+
data.tar.gz: d6bac1ffd1f4b9b5210bdd684b443fd6c12f1cc8084a854e728c8893f1dc768f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d88469f61576501ebe5e9795381aba16fa4452eae217c4721abe8159468a8489ad54a18e09384c337f3fdebae4a3e5e5d0ae100f3587c491c880472d4cdd7f3
|
|
7
|
+
data.tar.gz: 575ab9b320e2dd5642964ad6a0b125d6c28cac9cfaa98260bb86b4489369e5413531bf26a285b85dd68f2d5afbace0beabd754f967b4aaa9c295d6644bcab058
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.17.0 - 2019-05-14
|
|
4
|
+
* [#779](https://github.com/stripe/stripe-ruby/pull/779) Add support for the Capability resource and APIs
|
|
5
|
+
|
|
3
6
|
## 4.16.0 - 2019-04-24
|
|
4
7
|
* [#760](https://github.com/stripe/stripe-ruby/pull/760) Add support for the `TaxRate` resource and APIs
|
|
5
8
|
|
data/README.md
CHANGED
|
@@ -95,6 +95,17 @@ Stripe::Charge.retrieve(
|
|
|
95
95
|
:stripe_version => "2018-02-28"
|
|
96
96
|
}
|
|
97
97
|
)
|
|
98
|
+
|
|
99
|
+
Stripe::Charge.retrieve(
|
|
100
|
+
{
|
|
101
|
+
id: 'ch_18atAXCdGbJFKhCuBAa4532Z',
|
|
102
|
+
expand: %w(balance_transaction)
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
stripe_version: '2018-02-28',
|
|
106
|
+
api_key: 'sk_test_...'
|
|
107
|
+
}
|
|
108
|
+
)
|
|
98
109
|
```
|
|
99
110
|
|
|
100
111
|
### Configuring a Client
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.17.0
|
data/lib/stripe.rb
CHANGED
|
@@ -47,6 +47,7 @@ require "stripe/balance_transaction"
|
|
|
47
47
|
require "stripe/bank_account"
|
|
48
48
|
require "stripe/bitcoin_receiver"
|
|
49
49
|
require "stripe/bitcoin_transaction"
|
|
50
|
+
require "stripe/capability"
|
|
50
51
|
require "stripe/card"
|
|
51
52
|
require "stripe/charge"
|
|
52
53
|
require "stripe/checkout/session"
|
data/lib/stripe/account.rb
CHANGED
|
@@ -14,6 +14,9 @@ module Stripe
|
|
|
14
14
|
custom_method :reject, http_verb: :post
|
|
15
15
|
|
|
16
16
|
save_nested_resource :external_account
|
|
17
|
+
nested_resource_class_methods :capability,
|
|
18
|
+
operations: %i[retrieve update list],
|
|
19
|
+
resource_plural: "capabilities"
|
|
17
20
|
nested_resource_class_methods :external_account,
|
|
18
21
|
operations: %i[create retrieve update delete list]
|
|
19
22
|
nested_resource_class_methods :login_link, operations: %i[create]
|
|
@@ -48,12 +51,14 @@ module Stripe
|
|
|
48
51
|
end
|
|
49
52
|
|
|
50
53
|
def persons(params = {}, opts = {})
|
|
51
|
-
resp, opts = request(:get, resource_url + "/persons", params,
|
|
54
|
+
resp, opts = request(:get, resource_url + "/persons", params, opts)
|
|
52
55
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
53
56
|
end
|
|
54
57
|
|
|
58
|
+
# We are not adding a helper for capabilities here as the Account object already has a
|
|
59
|
+
# capabilities property which is a hash and not the sub-list of capabilities.
|
|
60
|
+
|
|
55
61
|
def reject(params = {}, opts = {})
|
|
56
|
-
opts = Util.normalize_opts(opts)
|
|
57
62
|
resp, opts = request(:post, resource_url + "/reject", params, opts)
|
|
58
63
|
initialize_from(resp.data, opts)
|
|
59
64
|
end
|
|
@@ -17,14 +17,12 @@ module Stripe
|
|
|
17
17
|
# idempotency_key to be passed in the request headers, or for the
|
|
18
18
|
# api_key to be overwritten. See {APIOperations::Request.request}.
|
|
19
19
|
def delete(id, params = {}, opts = {})
|
|
20
|
-
opts = Util.normalize_opts(opts)
|
|
21
20
|
resp, opts = request(:delete, "#{resource_url}/#{id}", params, opts)
|
|
22
21
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
23
22
|
end
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
def delete(params = {}, opts = {})
|
|
27
|
-
opts = Util.normalize_opts(opts)
|
|
28
26
|
resp, opts = request(:delete, resource_url, params, opts)
|
|
29
27
|
initialize_from(resp.data, opts)
|
|
30
28
|
end
|
|
@@ -10,8 +10,9 @@ module Stripe
|
|
|
10
10
|
# methods `.create_reversal`, `.retrieve_reversal`, `.update_reversal`,
|
|
11
11
|
# etc. all become available.
|
|
12
12
|
module NestedResource
|
|
13
|
-
def nested_resource_class_methods(resource, path: nil, operations: nil)
|
|
14
|
-
|
|
13
|
+
def nested_resource_class_methods(resource, path: nil, operations: nil, resource_plural: nil)
|
|
14
|
+
resource_plural ||= "#{resource}s"
|
|
15
|
+
path ||= resource_plural
|
|
15
16
|
raise ArgumentError, "operations array required" if operations.nil?
|
|
16
17
|
|
|
17
18
|
resource_url_method = :"#{resource}s_url"
|
|
@@ -48,7 +49,7 @@ module Stripe
|
|
|
48
49
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
49
50
|
end
|
|
50
51
|
when :list
|
|
51
|
-
define_singleton_method(:"list_#{
|
|
52
|
+
define_singleton_method(:"list_#{resource_plural}") do |id, params = {}, opts = {}|
|
|
52
53
|
url = send(resource_url_method, id)
|
|
53
54
|
resp, opts = request(:get, url, params, opts)
|
|
54
55
|
Util.convert_to_stripe_object(resp.data, opts)
|
data/lib/stripe/bank_account.rb
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stripe
|
|
4
|
+
class Capability < APIResource
|
|
5
|
+
extend Stripe::APIOperations::List
|
|
6
|
+
include Stripe::APIOperations::Save
|
|
7
|
+
|
|
8
|
+
OBJECT_NAME = "capability".freeze
|
|
9
|
+
|
|
10
|
+
def resource_url
|
|
11
|
+
if !respond_to?(:account) || account.nil?
|
|
12
|
+
raise NotImplementedError,
|
|
13
|
+
"Capabilities cannot be accessed without an account ID."
|
|
14
|
+
end
|
|
15
|
+
"#{Account.resource_url}/#{CGI.escape(account)}/capabilities/#{CGI.escape(id)}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.retrieve(_id, _opts = {})
|
|
19
|
+
raise NotImplementedError, "Capabilities cannot be retrieved without an account ID. Retrieve a capability using account.retrieve_capability('acct_123', 'acap_123')"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.update(_id, _params = nil, _opts = nil)
|
|
23
|
+
raise NotImplementedError, "Capabilities cannot be updated without an account ID. Update a capability using `p = account.update_capability('acct_123', 'acap_123', params)"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/stripe/card.rb
CHANGED
data/lib/stripe/charge.rb
CHANGED
data/lib/stripe/coupon.rb
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class Coupon < APIResource
|
|
5
5
|
extend Stripe::APIOperations::Create
|
|
6
|
-
include Stripe::APIOperations::Save
|
|
7
6
|
include Stripe::APIOperations::Delete
|
|
8
7
|
extend Stripe::APIOperations::List
|
|
8
|
+
include Stripe::APIOperations::Save
|
|
9
9
|
|
|
10
10
|
OBJECT_NAME = "coupon".freeze
|
|
11
11
|
end
|
data/lib/stripe/credit_note.rb
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class CreditNote < APIResource
|
|
5
|
+
extend Stripe::APIOperations::Create
|
|
5
6
|
extend Stripe::APIOperations::List
|
|
6
7
|
include Stripe::APIOperations::Save
|
|
7
|
-
extend Stripe::APIOperations::Create
|
|
8
8
|
|
|
9
9
|
OBJECT_NAME = "credit_note".freeze
|
|
10
10
|
|
|
11
11
|
custom_method :void_credit_note, http_verb: :post, http_path: "void"
|
|
12
12
|
|
|
13
13
|
def void_credit_note(params = {}, opts = {})
|
|
14
|
-
|
|
15
|
-
resp, opts = request(:post, url, params, opts)
|
|
14
|
+
resp, opts = request(:post, resource_url + "/void", params, opts)
|
|
16
15
|
initialize_from(resp.data, opts)
|
|
17
16
|
end
|
|
18
17
|
end
|
data/lib/stripe/dispute.rb
CHANGED
|
@@ -10,12 +10,14 @@ module Stripe
|
|
|
10
10
|
custom_method :close, http_verb: :post
|
|
11
11
|
|
|
12
12
|
def close(params = {}, opts = {})
|
|
13
|
-
resp, opts = request(:post,
|
|
13
|
+
resp, opts = request(:post, resource_url + "/close", params, opts)
|
|
14
14
|
initialize_from(resp.data, opts)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def close_url
|
|
18
18
|
resource_url + "/close"
|
|
19
19
|
end
|
|
20
|
+
extend Gem::Deprecate
|
|
21
|
+
deprecate :close_url, :none, 2019, 11
|
|
20
22
|
end
|
|
21
23
|
end
|
data/lib/stripe/file_link.rb
CHANGED
data/lib/stripe/invoice.rb
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class Invoice < APIResource
|
|
5
|
+
extend Stripe::APIOperations::Create
|
|
6
|
+
include Stripe::APIOperations::Delete
|
|
5
7
|
extend Stripe::APIOperations::List
|
|
6
8
|
include Stripe::APIOperations::Save
|
|
7
|
-
include Stripe::APIOperations::Delete
|
|
8
|
-
extend Stripe::APIOperations::Create
|
|
9
9
|
|
|
10
10
|
OBJECT_NAME = "invoice".freeze
|
|
11
11
|
|
|
@@ -16,39 +16,33 @@ module Stripe
|
|
|
16
16
|
custom_method :void_invoice, http_verb: :post, http_path: "void"
|
|
17
17
|
|
|
18
18
|
def finalize_invoice(params = {}, opts = {})
|
|
19
|
-
|
|
20
|
-
resp, opts = request(:post, url, params, opts)
|
|
19
|
+
resp, opts = request(:post, resource_url + "/finalize", params, opts)
|
|
21
20
|
initialize_from(resp.data, opts)
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
def mark_uncollectible(params = {}, opts = {})
|
|
25
|
-
|
|
26
|
-
resp, opts = request(:post, url, params, opts)
|
|
24
|
+
resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts)
|
|
27
25
|
initialize_from(resp.data, opts)
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
def pay(params = {}, opts = {})
|
|
31
|
-
|
|
32
|
-
resp, opts = request(:post, url, params, opts)
|
|
29
|
+
resp, opts = request(:post, resource_url + "/pay", params, opts)
|
|
33
30
|
initialize_from(resp.data, opts)
|
|
34
31
|
end
|
|
35
32
|
|
|
36
33
|
def send_invoice(params = {}, opts = {})
|
|
37
|
-
|
|
38
|
-
resp, opts = request(:post, url, params, opts)
|
|
34
|
+
resp, opts = request(:post, resource_url + "/send", params, opts)
|
|
39
35
|
initialize_from(resp.data, opts)
|
|
40
36
|
end
|
|
41
37
|
|
|
42
|
-
def self.upcoming(params, opts = {})
|
|
43
|
-
url = resource_url + "/upcoming"
|
|
44
|
-
resp, opts = request(:get, url, params, opts)
|
|
45
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
38
|
def void_invoice(params = {}, opts = {})
|
|
49
|
-
|
|
50
|
-
resp, opts = request(:post, url, params, opts)
|
|
39
|
+
resp, opts = request(:post, resource_url + "/void", params, opts)
|
|
51
40
|
initialize_from(resp.data, opts)
|
|
52
41
|
end
|
|
42
|
+
|
|
43
|
+
def self.upcoming(params, opts = {})
|
|
44
|
+
resp, opts = request(:get, resource_url + "/upcoming", params, opts)
|
|
45
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
|
46
|
+
end
|
|
53
47
|
end
|
|
54
48
|
end
|
data/lib/stripe/invoice_item.rb
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class InvoiceItem < APIResource
|
|
5
|
-
extend Stripe::APIOperations::List
|
|
6
5
|
extend Stripe::APIOperations::Create
|
|
7
6
|
include Stripe::APIOperations::Delete
|
|
7
|
+
extend Stripe::APIOperations::List
|
|
8
8
|
include Stripe::APIOperations::Save
|
|
9
9
|
|
|
10
10
|
OBJECT_NAME = "invoiceitem".freeze
|
data/lib/stripe/issuing/card.rb
CHANGED
data/lib/stripe/order.rb
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class PaymentMethod < APIResource
|
|
5
5
|
extend Stripe::APIOperations::Create
|
|
6
|
-
include Stripe::APIOperations::Save
|
|
7
6
|
extend Stripe::APIOperations::List
|
|
7
|
+
include Stripe::APIOperations::Save
|
|
8
8
|
|
|
9
9
|
OBJECT_NAME = "payment_method".freeze
|
|
10
10
|
|
|
@@ -12,14 +12,12 @@ module Stripe
|
|
|
12
12
|
custom_method :detach, http_verb: :post
|
|
13
13
|
|
|
14
14
|
def attach(params = {}, opts = {})
|
|
15
|
-
|
|
16
|
-
resp, opts = request(:post, url, params, opts)
|
|
15
|
+
resp, opts = request(:post, resource_url + "/attach", params, opts)
|
|
17
16
|
initialize_from(resp.data, opts)
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
def detach(params = {}, opts = {})
|
|
21
|
-
|
|
22
|
-
resp, opts = request(:post, url, params, opts)
|
|
20
|
+
resp, opts = request(:post, resource_url + "/detach", params, opts)
|
|
23
21
|
initialize_from(resp.data, opts)
|
|
24
22
|
end
|
|
25
23
|
end
|
data/lib/stripe/payout.rb
CHANGED
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class Payout < APIResource
|
|
5
|
-
extend Stripe::APIOperations::List
|
|
6
5
|
extend Stripe::APIOperations::Create
|
|
6
|
+
extend Stripe::APIOperations::List
|
|
7
7
|
include Stripe::APIOperations::Save
|
|
8
8
|
|
|
9
9
|
OBJECT_NAME = "payout".freeze
|
|
10
10
|
|
|
11
11
|
custom_method :cancel, http_verb: :post
|
|
12
12
|
|
|
13
|
-
def cancel
|
|
14
|
-
resp,
|
|
15
|
-
initialize_from(resp.data,
|
|
13
|
+
def cancel(params = {}, opts = {})
|
|
14
|
+
resp, opts = request(:post, resource_url + "/cancel", params, opts)
|
|
15
|
+
initialize_from(resp.data, opts)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def cancel_url
|
|
19
19
|
resource_url + "/cancel"
|
|
20
20
|
end
|
|
21
|
+
extend Gem::Deprecate
|
|
22
|
+
deprecate :cancel_url, :none, 2019, 11
|
|
21
23
|
end
|
|
22
24
|
end
|
data/lib/stripe/product.rb
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class Product < APIResource
|
|
5
|
-
extend Stripe::APIOperations::List
|
|
6
5
|
extend Stripe::APIOperations::Create
|
|
7
|
-
include Stripe::APIOperations::Save
|
|
8
6
|
include Stripe::APIOperations::Delete
|
|
7
|
+
extend Stripe::APIOperations::List
|
|
8
|
+
include Stripe::APIOperations::Save
|
|
9
9
|
|
|
10
10
|
OBJECT_NAME = "product".freeze
|
|
11
11
|
end
|
data/lib/stripe/recipient.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Stripe
|
|
|
5
5
|
class Recipient < APIResource
|
|
6
6
|
extend Stripe::APIOperations::Create
|
|
7
7
|
include Stripe::APIOperations::Delete
|
|
8
|
-
include Stripe::APIOperations::Save
|
|
9
8
|
extend Stripe::APIOperations::List
|
|
9
|
+
include Stripe::APIOperations::Save
|
|
10
10
|
|
|
11
11
|
OBJECT_NAME = "recipient".freeze
|
|
12
12
|
|
data/lib/stripe/sku.rb
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class SKU < APIResource
|
|
5
|
-
extend Stripe::APIOperations::List
|
|
6
5
|
extend Stripe::APIOperations::Create
|
|
7
|
-
include Stripe::APIOperations::Save
|
|
8
6
|
include Stripe::APIOperations::Delete
|
|
7
|
+
extend Stripe::APIOperations::List
|
|
8
|
+
include Stripe::APIOperations::Save
|
|
9
9
|
|
|
10
10
|
OBJECT_NAME = "sku".freeze
|
|
11
11
|
end
|
data/lib/stripe/source.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Stripe
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
url = "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
|
20
|
-
resp, opts = request(:delete, url, params,
|
|
20
|
+
resp, opts = request(:delete, url, params, opts)
|
|
21
21
|
initialize_from(resp.data, opts)
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -28,12 +28,12 @@ module Stripe
|
|
|
28
28
|
deprecate :delete, "#detach", 2017, 10
|
|
29
29
|
|
|
30
30
|
def source_transactions(params = {}, opts = {})
|
|
31
|
-
resp, opts = request(:get, resource_url + "/source_transactions", params,
|
|
31
|
+
resp, opts = request(:get, resource_url + "/source_transactions", params, opts)
|
|
32
32
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def verify(params = {}, opts = {})
|
|
36
|
-
resp, opts = request(:post, resource_url + "/verify", params,
|
|
36
|
+
resp, opts = request(:post, resource_url + "/verify", params, opts)
|
|
37
37
|
initialize_from(resp.data, opts)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -10,7 +10,7 @@ module Stripe
|
|
|
10
10
|
OBJECT_NAME = "subscription_item".freeze
|
|
11
11
|
|
|
12
12
|
def usage_record_summaries(params = {}, opts = {})
|
|
13
|
-
resp, opts = request(:get, resource_url + "/usage_record_summaries", params,
|
|
13
|
+
resp, opts = request(:get, resource_url + "/usage_record_summaries", params, opts)
|
|
14
14
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class SubscriptionSchedule < APIResource
|
|
5
|
-
extend Stripe::APIOperations::List
|
|
6
5
|
extend Stripe::APIOperations::Create
|
|
6
|
+
extend Stripe::APIOperations::List
|
|
7
7
|
include Stripe::APIOperations::Save
|
|
8
8
|
extend Stripe::APIOperations::NestedResource
|
|
9
9
|
|
|
@@ -28,7 +28,7 @@ module Stripe
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def revisions(params = {}, opts = {})
|
|
31
|
-
resp, opts = request(:get, resource_url + "/revisions", params,
|
|
31
|
+
resp, opts = request(:get, resource_url + "/revisions", params, opts)
|
|
32
32
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
33
33
|
end
|
|
34
34
|
end
|
data/lib/stripe/tax_id.rb
CHANGED
data/lib/stripe/tax_rate.rb
CHANGED
data/lib/stripe/topup.rb
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class Topup < APIResource
|
|
5
|
-
extend Stripe::APIOperations::List
|
|
6
5
|
extend Stripe::APIOperations::Create
|
|
6
|
+
extend Stripe::APIOperations::List
|
|
7
7
|
include Stripe::APIOperations::Save
|
|
8
8
|
|
|
9
9
|
OBJECT_NAME = "topup".freeze
|
|
10
10
|
|
|
11
11
|
custom_method :cancel, http_verb: :post
|
|
12
12
|
|
|
13
|
-
def cancel
|
|
14
|
-
resp,
|
|
15
|
-
initialize_from(resp.data,
|
|
13
|
+
def cancel(params = {}, opts = {})
|
|
14
|
+
resp, opts = request(:post, resource_url + "/cancel", params, opts)
|
|
15
|
+
initialize_from(resp.data, opts)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
data/lib/stripe/transfer.rb
CHANGED
data/lib/stripe/usage_record.rb
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class UsageRecord < APIResource
|
|
5
|
+
OBJECT_NAME = "usage_record".freeze
|
|
6
|
+
|
|
5
7
|
def self.create(params = {}, opts = {})
|
|
6
8
|
raise(ArgumentError, "Params must have a subscription_item key") unless params.key?(:subscription_item)
|
|
7
9
|
req_params = params.clone.delete_if { |key, _value| key == :subscription_item }
|
|
8
10
|
resp, opts = request(:post, "/v1/subscription_items/#{params[:subscription_item]}/usage_records", req_params, opts)
|
|
9
11
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
10
12
|
end
|
|
11
|
-
|
|
12
|
-
OBJECT_NAME = "usage_record".freeze
|
|
13
13
|
end
|
|
14
14
|
end
|
data/lib/stripe/util.rb
CHANGED
|
@@ -56,6 +56,7 @@ module Stripe
|
|
|
56
56
|
BankAccount::OBJECT_NAME => BankAccount,
|
|
57
57
|
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
|
|
58
58
|
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
|
|
59
|
+
Capability::OBJECT_NAME => Capability,
|
|
59
60
|
Card::OBJECT_NAME => Card,
|
|
60
61
|
Charge::OBJECT_NAME => Charge,
|
|
61
62
|
Checkout::Session::OBJECT_NAME => Checkout::Session,
|
|
@@ -135,6 +136,8 @@ module Stripe
|
|
|
135
136
|
# * +opts+ - Options for +StripeObject+ like an API key that will be reused
|
|
136
137
|
# on subsequent API calls.
|
|
137
138
|
def self.convert_to_stripe_object(data, opts = {})
|
|
139
|
+
opts = normalize_opts(opts)
|
|
140
|
+
|
|
138
141
|
case data
|
|
139
142
|
when Array
|
|
140
143
|
data.map { |i| convert_to_stripe_object(i, opts) }
|
data/lib/stripe/version.rb
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
module Stripe
|
|
4
4
|
class WebhookEndpoint < APIResource
|
|
5
5
|
extend Stripe::APIOperations::Create
|
|
6
|
-
include Stripe::APIOperations::Save
|
|
7
6
|
include Stripe::APIOperations::Delete
|
|
8
7
|
extend Stripe::APIOperations::List
|
|
8
|
+
include Stripe::APIOperations::Save
|
|
9
9
|
|
|
10
10
|
OBJECT_NAME = "webhook_endpoint".freeze
|
|
11
11
|
end
|
data/test/stripe/account_test.rb
CHANGED
|
@@ -266,6 +266,40 @@ module Stripe
|
|
|
266
266
|
end
|
|
267
267
|
end
|
|
268
268
|
|
|
269
|
+
context "#retrieve_capability" do
|
|
270
|
+
should "retrieve a capability" do
|
|
271
|
+
capability = Stripe::Account.retrieve_capability(
|
|
272
|
+
"acct_123",
|
|
273
|
+
"acap_123"
|
|
274
|
+
)
|
|
275
|
+
assert_requested :get, "#{Stripe.api_base}/v1/accounts/acct_123/capabilities/acap_123"
|
|
276
|
+
assert capability.is_a?(Stripe::Capability)
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
context "#update_capability" do
|
|
281
|
+
should "update a capability" do
|
|
282
|
+
capability = Stripe::Account.update_capability(
|
|
283
|
+
"acct_123",
|
|
284
|
+
"acap_123",
|
|
285
|
+
requested: true
|
|
286
|
+
)
|
|
287
|
+
assert_requested :post, "#{Stripe.api_base}/v1/accounts/acct_123/capabilities/acap_123"
|
|
288
|
+
assert capability.is_a?(Stripe::Capability)
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
context "#list_capabilities" do
|
|
293
|
+
should "list the account's external accounts" do
|
|
294
|
+
capabilities = Stripe::Account.list_capabilities(
|
|
295
|
+
"acct_123"
|
|
296
|
+
)
|
|
297
|
+
assert_requested :get, "#{Stripe.api_base}/v1/accounts/acct_123/capabilities"
|
|
298
|
+
assert capabilities.is_a?(Stripe::ListObject)
|
|
299
|
+
assert capabilities.data.is_a?(Array)
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
|
|
269
303
|
context "#create_external_account" do
|
|
270
304
|
should "create an external account" do
|
|
271
305
|
external_account = Stripe::Account.create_external_account(
|
|
@@ -5,7 +5,7 @@ require ::File.expand_path("../../test_helper", __FILE__)
|
|
|
5
5
|
|
|
6
6
|
module Stripe
|
|
7
7
|
class ApiResourceTest < Test::Unit::TestCase
|
|
8
|
-
class NestedTestAPIResource <
|
|
8
|
+
class NestedTestAPIResource < APIResource
|
|
9
9
|
save_nested_resource :external_account
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require ::File.expand_path("../../test_helper", __FILE__)
|
|
4
|
+
|
|
5
|
+
module Stripe
|
|
6
|
+
class CapabilityTest < Test::Unit::TestCase
|
|
7
|
+
context "#resource_url" do
|
|
8
|
+
should "return a resource URL" do
|
|
9
|
+
capability = Stripe::Capability.construct_from(
|
|
10
|
+
id: "acap_123",
|
|
11
|
+
account: "acct_123"
|
|
12
|
+
)
|
|
13
|
+
assert_equal "/v1/accounts/acct_123/capabilities/acap_123",
|
|
14
|
+
capability.resource_url
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
should "raise without an account" do
|
|
18
|
+
capability = Stripe::Capability.construct_from(id: "acap_123")
|
|
19
|
+
assert_raises NotImplementedError do
|
|
20
|
+
capability.resource_url
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
should "raise on #retrieve" do
|
|
26
|
+
assert_raises NotImplementedError do
|
|
27
|
+
Stripe::Capability.retrieve("acap_123")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
should "raise on #update" do
|
|
32
|
+
assert_raises NotImplementedError do
|
|
33
|
+
Stripe::Capability.update("acap_123", {})
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should "be saveable" do
|
|
38
|
+
capability = Stripe::Account.retrieve_capability("acct_123", "acap_123")
|
|
39
|
+
capability.requested = true
|
|
40
|
+
capability.save
|
|
41
|
+
assert_requested :post,
|
|
42
|
+
"#{Stripe.api_base}/v1/accounts/#{capability.account}/capabilities/#{capability.id}"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/test/test_helper.rb
CHANGED
|
@@ -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.
|
|
20
|
+
MOCK_MINIMUM_VERSION = "0.56.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,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stripe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.17.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-
|
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -81,6 +81,7 @@ files:
|
|
|
81
81
|
- lib/stripe/bank_account.rb
|
|
82
82
|
- lib/stripe/bitcoin_receiver.rb
|
|
83
83
|
- lib/stripe/bitcoin_transaction.rb
|
|
84
|
+
- lib/stripe/capability.rb
|
|
84
85
|
- lib/stripe/card.rb
|
|
85
86
|
- lib/stripe/charge.rb
|
|
86
87
|
- lib/stripe/checkout/session.rb
|
|
@@ -166,6 +167,7 @@ files:
|
|
|
166
167
|
- test/stripe/application_fee_test.rb
|
|
167
168
|
- test/stripe/balance_test.rb
|
|
168
169
|
- test/stripe/bank_account_test.rb
|
|
170
|
+
- test/stripe/capability_test.rb
|
|
169
171
|
- test/stripe/charge_test.rb
|
|
170
172
|
- test/stripe/checkout/session_test.rb
|
|
171
173
|
- test/stripe/country_spec_test.rb
|
|
@@ -272,6 +274,7 @@ test_files:
|
|
|
272
274
|
- test/stripe/application_fee_test.rb
|
|
273
275
|
- test/stripe/balance_test.rb
|
|
274
276
|
- test/stripe/bank_account_test.rb
|
|
277
|
+
- test/stripe/capability_test.rb
|
|
275
278
|
- test/stripe/charge_test.rb
|
|
276
279
|
- test/stripe/checkout/session_test.rb
|
|
277
280
|
- test/stripe/country_spec_test.rb
|