stripe 3.3.2 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +20 -0
- data/.rubocop_todo.yml +62 -0
- data/.travis.yml +1 -1
- data/Gemfile +19 -12
- data/History.txt +10 -0
- data/README.md +5 -1
- data/Rakefile +8 -5
- data/VERSION +1 -1
- data/bin/stripe-console +2 -2
- data/lib/stripe.rb +72 -74
- data/lib/stripe/account.rb +15 -17
- data/lib/stripe/alipay_account.rb +10 -7
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +1 -1
- data/lib/stripe/api_operations/list.rb +2 -2
- data/lib/stripe/api_operations/request.rb +5 -12
- data/lib/stripe/api_operations/save.rb +6 -6
- data/lib/stripe/api_resource.rb +7 -9
- data/lib/stripe/apple_pay_domain.rb +2 -2
- data/lib/stripe/application_fee.rb +5 -5
- data/lib/stripe/application_fee_refund.rb +5 -5
- data/lib/stripe/balance.rb +1 -1
- data/lib/stripe/balance_transaction.rb +2 -2
- data/lib/stripe/bank_account.rb +7 -7
- data/lib/stripe/bitcoin_receiver.rb +4 -2
- data/lib/stripe/bitcoin_transaction.rb +3 -1
- data/lib/stripe/card.rb +5 -5
- data/lib/stripe/charge.rb +18 -18
- data/lib/stripe/country_spec.rb +2 -2
- data/lib/stripe/coupon.rb +1 -1
- data/lib/stripe/customer.rb +23 -23
- data/lib/stripe/dispute.rb +3 -3
- data/lib/stripe/ephemeral_key.rb +4 -4
- data/lib/stripe/errors.rb +4 -4
- data/lib/stripe/event.rb +1 -1
- data/lib/stripe/file_upload.rb +5 -5
- data/lib/stripe/invoice.rb +7 -7
- data/lib/stripe/invoice_item.rb +1 -1
- data/lib/stripe/invoice_line_item.rb +1 -1
- data/lib/stripe/list_object.rb +14 -18
- data/lib/stripe/login_link.rb +3 -3
- data/lib/stripe/oauth.rb +15 -13
- data/lib/stripe/order.rb +5 -5
- data/lib/stripe/order_return.rb +1 -1
- data/lib/stripe/payout.rb +3 -3
- data/lib/stripe/plan.rb +1 -1
- data/lib/stripe/product.rb +1 -1
- data/lib/stripe/recipient.rb +3 -2
- data/lib/stripe/recipient_transfer.rb +1 -2
- data/lib/stripe/refund.rb +1 -1
- data/lib/stripe/reversal.rb +5 -5
- data/lib/stripe/singleton_api_resource.rb +3 -3
- data/lib/stripe/sku.rb +1 -1
- data/lib/stripe/source.rb +13 -10
- data/lib/stripe/stripe_client.rb +149 -169
- data/lib/stripe/stripe_object.rb +77 -76
- data/lib/stripe/subscription.rb +5 -5
- data/lib/stripe/subscription_item.rb +2 -2
- data/lib/stripe/three_d_secure.rb +1 -1
- data/lib/stripe/token.rb +1 -1
- data/lib/stripe/transfer.rb +3 -3
- data/lib/stripe/util.rb +77 -62
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +14 -10
- data/stripe.gemspec +14 -14
- data/test/stripe/account_test.rb +69 -81
- data/test/stripe/alipay_account_test.rb +19 -1
- data/test/stripe/api_operations_test.rb +7 -7
- data/test/stripe/api_resource_test.rb +224 -260
- data/test/stripe/apple_pay_domain_test.rb +8 -8
- data/test/stripe/application_fee_refund_test.rb +8 -8
- data/test/stripe/application_fee_test.rb +3 -3
- data/test/stripe/balance_test.rb +2 -2
- data/test/stripe/bank_account_test.rb +9 -11
- data/test/stripe/charge_test.rb +11 -11
- data/test/stripe/country_spec_test.rb +4 -4
- data/test/stripe/coupon_test.rb +10 -10
- data/test/stripe/customer_card_test.rb +11 -15
- data/test/stripe/customer_test.rb +26 -27
- data/test/stripe/dispute_test.rb +8 -8
- data/test/stripe/ephemeral_key_test.rb +14 -14
- data/test/stripe/errors_test.rb +2 -2
- data/test/stripe/file_upload_test.rb +26 -28
- data/test/stripe/invoice_item_test.rb +14 -14
- data/test/stripe/invoice_line_item_test.rb +1 -1
- data/test/stripe/invoice_test.rb +37 -37
- data/test/stripe/list_object_test.rb +60 -76
- data/test/stripe/login_link_test.rb +14 -14
- data/test/stripe/oauth_test.rb +42 -50
- data/test/stripe/order_return_test.rb +5 -5
- data/test/stripe/order_test.rb +12 -12
- data/test/stripe/payout_test.rb +9 -9
- data/test/stripe/plan_test.rb +9 -9
- data/test/stripe/product_test.rb +8 -8
- data/test/stripe/recipient_test.rb +9 -10
- data/test/stripe/refund_test.rb +9 -9
- data/test/stripe/reversal_test.rb +10 -10
- data/test/stripe/sku_test.rb +8 -8
- data/test/stripe/source_test.rb +14 -16
- data/test/stripe/stripe_client_test.rb +235 -266
- data/test/stripe/stripe_object_test.rb +163 -147
- data/test/stripe/stripe_response_test.rb +4 -3
- data/test/stripe/subscription_item_test.rb +11 -11
- data/test/stripe/subscription_test.rb +14 -14
- data/test/stripe/three_d_secure_test.rb +2 -2
- data/test/stripe/transfer_test.rb +8 -8
- data/test/stripe/util_test.rb +59 -57
- data/test/stripe/webhook_test.rb +18 -16
- data/test/stripe_test.rb +4 -4
- data/test/test_data.rb +26 -26
- data/test/test_helper.rb +29 -25
- metadata +6 -10
- data/test/stripe/bitcoin_receiver_test.rb +0 -67
- data/test/stripe/bitcoin_transaction_test.rb +0 -19
- data/test/stripe/recipient_card_test.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce403b39d687753c9cf663b0288dfa87c0d42587
|
4
|
+
data.tar.gz: c070e94e6a67f23ba5c0cdcc4f20cf8b48003a56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae59948a1870bddb75f90057936a65903157625ee4dc42d00b72aad628d0dbe0ee92e81a9dbe9efd55c12b57a7b5dd7f7988fdb282862a8fcd204c927574148a
|
7
|
+
data.tar.gz: 45fd78747f6151a4fa74b64c0bdf6f89e6d68fc9735e1a694fa75c0df46812032b41ac82589bff93ae6fb68022d57089c420ff929ab202a9699d287679b650ab
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
DisplayCopNames: true
|
5
|
+
TargetRubyVersion: 2.0
|
6
|
+
|
7
|
+
Layout/CaseIndentation:
|
8
|
+
EnforcedStyle: end
|
9
|
+
|
10
|
+
Layout/IndentArray:
|
11
|
+
EnforcedStyle: consistent
|
12
|
+
|
13
|
+
Layout/IndentHash:
|
14
|
+
EnforcedStyle: consistent
|
15
|
+
|
16
|
+
Style/StringLiterals:
|
17
|
+
EnforcedStyle: double_quotes
|
18
|
+
|
19
|
+
Style/TrailingCommaInLiteral:
|
20
|
+
EnforcedStyleForMultiline: consistent_comma
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-09-27 21:19:01 +0200 using RuboCop version 0.50.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 18
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 49
|
12
|
+
|
13
|
+
# Offense count: 22
|
14
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Max: 461
|
17
|
+
|
18
|
+
# Offense count: 8
|
19
|
+
# Configuration parameters: CountComments.
|
20
|
+
Metrics/ClassLength:
|
21
|
+
Max: 581
|
22
|
+
|
23
|
+
# Offense count: 8
|
24
|
+
Metrics/CyclomaticComplexity:
|
25
|
+
Max: 13
|
26
|
+
|
27
|
+
# Offense count: 216
|
28
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
+
# URISchemes: http, https
|
30
|
+
Metrics/LineLength:
|
31
|
+
Max: 312
|
32
|
+
|
33
|
+
# Offense count: 29
|
34
|
+
# Configuration parameters: CountComments.
|
35
|
+
Metrics/MethodLength:
|
36
|
+
Max: 47
|
37
|
+
|
38
|
+
# Offense count: 2
|
39
|
+
# Configuration parameters: CountComments.
|
40
|
+
Metrics/ModuleLength:
|
41
|
+
Max: 423
|
42
|
+
|
43
|
+
# Offense count: 6
|
44
|
+
# Configuration parameters: CountKeywordArgs.
|
45
|
+
Metrics/ParameterLists:
|
46
|
+
Max: 7
|
47
|
+
|
48
|
+
# Offense count: 5
|
49
|
+
Metrics/PerceivedComplexity:
|
50
|
+
Max: 11
|
51
|
+
Exclude:
|
52
|
+
- 'lib/stripe/stripe_object.rb'
|
53
|
+
|
54
|
+
# Offense count: 2
|
55
|
+
Style/ClassVars:
|
56
|
+
Exclude:
|
57
|
+
- 'lib/stripe/stripe_object.rb'
|
58
|
+
- 'test/stripe/api_resource_test.rb'
|
59
|
+
|
60
|
+
# Offense count: 51
|
61
|
+
Style/Documentation:
|
62
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,29 +3,36 @@ source "https://rubygems.org"
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
6
|
+
gem "mocha", "~> 0.13.2"
|
7
|
+
gem "rake"
|
8
|
+
gem "shoulda-context"
|
9
|
+
gem "test-unit"
|
10
|
+
gem "timecop"
|
11
|
+
gem "webmock"
|
12
|
+
|
13
|
+
# Rubocop changes pretty quickly: new cops get added and old cops change
|
14
|
+
# names or go into new namespaces. This is a library and we don't have
|
15
|
+
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
|
16
|
+
# bad, pin to a specific version number here. Try to keep this relatively
|
17
|
+
# up-to-date, but it's not the end of the world if it's not.
|
18
|
+
gem "rubocop", "0.50.0"
|
12
19
|
|
13
20
|
# Rack 2.0+ requires Ruby >= 2.2.2 which is problematic for the test suite on
|
14
21
|
# older Ruby versions. Check Ruby the version here and put a maximum
|
15
22
|
# constraint on Rack if necessary.
|
16
|
-
if RUBY_VERSION >=
|
23
|
+
if RUBY_VERSION >= "2.2.2"
|
17
24
|
gem "rack", ">= 1.5"
|
18
25
|
else
|
19
|
-
gem "rack", ">= 1.5", "< 2.0"
|
26
|
+
gem "rack", ">= 1.5", "< 2.0" # rubocop:disable Bundler/DuplicatedGem
|
20
27
|
end
|
21
28
|
|
22
29
|
platforms :mri do
|
23
30
|
# to avoid problems, bring Byebug in on just versions of Ruby under which
|
24
31
|
# it's known to work well
|
25
|
-
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new(
|
26
|
-
gem
|
27
|
-
gem
|
28
|
-
gem
|
32
|
+
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("2.0.0")
|
33
|
+
gem "byebug"
|
34
|
+
gem "pry"
|
35
|
+
gem "pry-byebug"
|
29
36
|
end
|
30
37
|
end
|
31
38
|
end
|
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 3.4.1 2017-10-05
|
2
|
+
|
3
|
+
* [#586] Log query strings as well as form bodies with STRIPE_LOG
|
4
|
+
* [#588] Require minimum Faraday 0.10 for bug fix in parameter encoding
|
5
|
+
|
6
|
+
=== 3.4.0 2017-09-20
|
7
|
+
|
8
|
+
* Mark legacy Bitcoin API as deprecated, and remove corresponding tests
|
9
|
+
* Mark recipients API as deprecated, and remove recipient card tests
|
10
|
+
|
1
11
|
=== 3.3.2 2017-09-20
|
2
12
|
|
3
13
|
* Correct minimum required Ruby version in gemspec (it's 2.0.0)
|
data/README.md
CHANGED
@@ -174,7 +174,7 @@ instructions for installing via Homebrew and other methods):
|
|
174
174
|
|
175
175
|
Run all tests:
|
176
176
|
|
177
|
-
bundle exec rake
|
177
|
+
bundle exec rake test
|
178
178
|
|
179
179
|
Run a single test suite:
|
180
180
|
|
@@ -184,6 +184,10 @@ Run a single test:
|
|
184
184
|
|
185
185
|
bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
|
186
186
|
|
187
|
+
Run the linter:
|
188
|
+
|
189
|
+
bundle exec rake rubocop
|
190
|
+
|
187
191
|
Update bundled CA certificates from the [Mozilla cURL release][curl]:
|
188
192
|
|
189
193
|
bundle exec rake update_certs
|
data/Rakefile
CHANGED
@@ -1,17 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require "rake/testtask"
|
2
|
+
require "rubocop/rake_task"
|
2
3
|
|
3
|
-
task :
|
4
|
+
task default: %i[test rubocop]
|
4
5
|
|
5
6
|
Rake::TestTask.new do |t|
|
6
|
-
t.pattern =
|
7
|
+
t.pattern = "./test/**/*_test.rb"
|
7
8
|
end
|
8
9
|
|
10
|
+
RuboCop::RakeTask.new
|
11
|
+
|
9
12
|
desc "Update bundled certs"
|
10
13
|
task :update_certs do
|
11
14
|
require "faraday"
|
12
15
|
|
13
16
|
fetch_file "https://curl.haxx.se/ca/cacert.pem",
|
14
|
-
|
17
|
+
File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
|
15
18
|
end
|
16
19
|
|
17
20
|
#
|
@@ -19,7 +22,7 @@ end
|
|
19
22
|
#
|
20
23
|
|
21
24
|
def fetch_file(url, dest)
|
22
|
-
File.open(dest,
|
25
|
+
File.open(dest, "w") do |file|
|
23
26
|
resp = Faraday.get(url)
|
24
27
|
unless resp.status == 200
|
25
28
|
abort("bad response when fetching: #{url}\n" \
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.4.1
|
data/bin/stripe-console
CHANGED
data/lib/stripe.rb
CHANGED
@@ -1,88 +1,89 @@
|
|
1
1
|
# Stripe Ruby bindings
|
2
2
|
# API spec at https://stripe.com/docs/api
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
3
|
+
require "cgi"
|
4
|
+
require "logger"
|
5
|
+
require "openssl"
|
6
|
+
require "rbconfig"
|
7
|
+
require "securerandom"
|
8
|
+
require "set"
|
9
|
+
require "socket"
|
9
10
|
|
10
|
-
require
|
11
|
-
require
|
11
|
+
require "faraday"
|
12
|
+
require "json"
|
12
13
|
|
13
14
|
# Version
|
14
|
-
require
|
15
|
+
require "stripe/version"
|
15
16
|
|
16
17
|
# API operations
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "stripe/api_operations/create"
|
19
|
+
require "stripe/api_operations/save"
|
20
|
+
require "stripe/api_operations/delete"
|
21
|
+
require "stripe/api_operations/list"
|
22
|
+
require "stripe/api_operations/request"
|
22
23
|
|
23
24
|
# API resource support classes
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
25
|
+
require "stripe/errors"
|
26
|
+
require "stripe/util"
|
27
|
+
require "stripe/stripe_client"
|
28
|
+
require "stripe/stripe_object"
|
29
|
+
require "stripe/stripe_response"
|
30
|
+
require "stripe/list_object"
|
31
|
+
require "stripe/api_resource"
|
32
|
+
require "stripe/singleton_api_resource"
|
33
|
+
require "stripe/webhook"
|
33
34
|
|
34
35
|
# Named API resources
|
35
|
-
require
|
36
|
-
require
|
37
|
-
require
|
38
|
-
require
|
39
|
-
require
|
40
|
-
require
|
41
|
-
require
|
42
|
-
require
|
43
|
-
require
|
44
|
-
require
|
45
|
-
require
|
46
|
-
require
|
47
|
-
require
|
48
|
-
require
|
49
|
-
require
|
50
|
-
require
|
51
|
-
require
|
52
|
-
require
|
53
|
-
require
|
54
|
-
require
|
55
|
-
require
|
56
|
-
require
|
57
|
-
require
|
58
|
-
require
|
59
|
-
require
|
60
|
-
require
|
61
|
-
require
|
62
|
-
require
|
63
|
-
require
|
64
|
-
require
|
65
|
-
require
|
66
|
-
require
|
67
|
-
require
|
68
|
-
require
|
69
|
-
require
|
70
|
-
require
|
71
|
-
require
|
72
|
-
require
|
73
|
-
require
|
36
|
+
require "stripe/account"
|
37
|
+
require "stripe/alipay_account"
|
38
|
+
require "stripe/apple_pay_domain"
|
39
|
+
require "stripe/application_fee"
|
40
|
+
require "stripe/application_fee_refund"
|
41
|
+
require "stripe/balance"
|
42
|
+
require "stripe/balance_transaction"
|
43
|
+
require "stripe/bank_account"
|
44
|
+
require "stripe/bitcoin_receiver"
|
45
|
+
require "stripe/bitcoin_transaction"
|
46
|
+
require "stripe/card"
|
47
|
+
require "stripe/charge"
|
48
|
+
require "stripe/country_spec"
|
49
|
+
require "stripe/coupon"
|
50
|
+
require "stripe/customer"
|
51
|
+
require "stripe/dispute"
|
52
|
+
require "stripe/ephemeral_key"
|
53
|
+
require "stripe/event"
|
54
|
+
require "stripe/file_upload"
|
55
|
+
require "stripe/invoice"
|
56
|
+
require "stripe/invoice_item"
|
57
|
+
require "stripe/invoice_line_item"
|
58
|
+
require "stripe/login_link"
|
59
|
+
require "stripe/order"
|
60
|
+
require "stripe/order_return"
|
61
|
+
require "stripe/payout"
|
62
|
+
require "stripe/plan"
|
63
|
+
require "stripe/product"
|
64
|
+
require "stripe/recipient"
|
65
|
+
require "stripe/recipient_transfer"
|
66
|
+
require "stripe/refund"
|
67
|
+
require "stripe/reversal"
|
68
|
+
require "stripe/sku"
|
69
|
+
require "stripe/source"
|
70
|
+
require "stripe/subscription"
|
71
|
+
require "stripe/subscription_item"
|
72
|
+
require "stripe/three_d_secure"
|
73
|
+
require "stripe/token"
|
74
|
+
require "stripe/transfer"
|
74
75
|
|
75
76
|
# OAuth
|
76
|
-
require
|
77
|
+
require "stripe/oauth"
|
77
78
|
|
78
79
|
module Stripe
|
79
|
-
DEFAULT_CA_BUNDLE_PATH = File.dirname(__FILE__) +
|
80
|
+
DEFAULT_CA_BUNDLE_PATH = File.dirname(__FILE__) + "/data/ca-certificates.crt"
|
80
81
|
|
81
82
|
@app_info = nil
|
82
83
|
|
83
|
-
@api_base =
|
84
|
-
@connect_base =
|
85
|
-
@uploads_base =
|
84
|
+
@api_base = "https://api.stripe.com"
|
85
|
+
@connect_base = "https://connect.stripe.com"
|
86
|
+
@uploads_base = "https://uploads.stripe.com"
|
86
87
|
|
87
88
|
@log_level = nil
|
88
89
|
@logger = nil
|
@@ -170,7 +171,7 @@ module Stripe
|
|
170
171
|
val = LEVEL_INFO
|
171
172
|
end
|
172
173
|
|
173
|
-
if val
|
174
|
+
if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
|
174
175
|
raise ArgumentError, "log_level should only be set to `nil`, `debug` or `info`"
|
175
176
|
end
|
176
177
|
@log_level = val
|
@@ -212,18 +213,15 @@ module Stripe
|
|
212
213
|
}
|
213
214
|
end
|
214
215
|
|
215
|
-
private
|
216
|
-
|
217
216
|
# DEPRECATED. Use `Util#encode_parameters` instead.
|
218
217
|
def self.uri_encode(params)
|
219
218
|
Util.encode_parameters(params)
|
220
219
|
end
|
220
|
+
private_class_method :uri_encode
|
221
221
|
class << self
|
222
222
|
extend Gem::Deprecate
|
223
|
-
deprecate :uri_encode, "Stripe::Util#encode_parameters", 2016,
|
223
|
+
deprecate :uri_encode, "Stripe::Util#encode_parameters", 2016, 1
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
-
unless ENV["STRIPE_LOG"].nil?
|
228
|
-
Stripe.log_level = ENV["STRIPE_LOG"]
|
229
|
-
end
|
227
|
+
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
|
data/lib/stripe/account.rb
CHANGED
@@ -6,7 +6,7 @@ module Stripe
|
|
6
6
|
include Stripe::APIOperations::Delete
|
7
7
|
include Stripe::APIOperations::Save
|
8
8
|
|
9
|
-
OBJECT_NAME =
|
9
|
+
OBJECT_NAME = "account".freeze
|
10
10
|
|
11
11
|
save_nested_resource :external_account
|
12
12
|
|
@@ -15,7 +15,7 @@ module Stripe
|
|
15
15
|
deprecate :bank_account=, "#external_account=", 2017, 8
|
16
16
|
|
17
17
|
def resource_url
|
18
|
-
if self[
|
18
|
+
if self["id"]
|
19
19
|
super
|
20
20
|
else
|
21
21
|
"/v1/account"
|
@@ -23,13 +23,13 @@ module Stripe
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# @override To make id optional
|
26
|
-
def self.retrieve(id=ARGUMENT_NOT_PROVIDED, opts={})
|
26
|
+
def self.retrieve(id = ARGUMENT_NOT_PROVIDED, opts = {})
|
27
27
|
id = id.equal?(ARGUMENT_NOT_PROVIDED) ? nil : Util.check_string_argument!(id)
|
28
28
|
|
29
29
|
# Account used to be a singleton, where this method's signature was
|
30
30
|
# `(opts={})`. For the sake of not breaking folks who pass in an OAuth
|
31
31
|
# key in opts, let's lurkily string match for it.
|
32
|
-
if opts == {} && id.is_a?(String) && id.start_with?(
|
32
|
+
if opts == {} && id.is_a?(String) && id.start_with?("sk_")
|
33
33
|
# `super` properly assumes a String opts is the apiKey and normalizes as expected.
|
34
34
|
opts = id
|
35
35
|
id = nil
|
@@ -37,9 +37,9 @@ module Stripe
|
|
37
37
|
super(id, opts)
|
38
38
|
end
|
39
39
|
|
40
|
-
def reject(params={}, opts={})
|
40
|
+
def reject(params = {}, opts = {})
|
41
41
|
opts = Util.normalize_opts(opts)
|
42
|
-
resp, opts = request(:post, resource_url +
|
42
|
+
resp, opts = request(:post, resource_url + "/reject", params, opts)
|
43
43
|
initialize_from(resp.data, opts)
|
44
44
|
end
|
45
45
|
|
@@ -70,9 +70,9 @@ module Stripe
|
|
70
70
|
serialize_params_account(self, super)
|
71
71
|
end
|
72
72
|
|
73
|
-
def serialize_params_account(
|
74
|
-
if entity = @values[:legal_entity]
|
75
|
-
if owners = entity[:additional_owners]
|
73
|
+
def serialize_params_account(_obj, update_hash)
|
74
|
+
if (entity = @values[:legal_entity])
|
75
|
+
if (owners = entity[:additional_owners])
|
76
76
|
entity_update = update_hash[:legal_entity] ||= {}
|
77
77
|
entity_update[:additional_owners] =
|
78
78
|
serialize_additional_owners(entity, owners)
|
@@ -86,17 +86,17 @@ module Stripe
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def legal_entity
|
89
|
-
self[
|
89
|
+
self["legal_entity"]
|
90
90
|
end
|
91
91
|
|
92
92
|
def legal_entity=(_)
|
93
|
-
raise NoMethodError
|
93
|
+
raise NoMethodError, 'Overridding legal_entity can cause serious issues. Instead, set the individual fields of legal_entity like blah.legal_entity.first_name = \'Blah\''
|
94
94
|
end
|
95
95
|
|
96
|
-
def deauthorize(client_id=nil, opts={})
|
96
|
+
def deauthorize(client_id = nil, opts = {})
|
97
97
|
params = {
|
98
98
|
client_id: client_id,
|
99
|
-
stripe_user_id:
|
99
|
+
stripe_user_id: id,
|
100
100
|
}
|
101
101
|
OAuth.deauthorize(params, opts)
|
102
102
|
end
|
@@ -111,9 +111,7 @@ module Stripe
|
|
111
111
|
# url params provide no mechanism for deleting an item in an array,
|
112
112
|
# just overwriting the whole array or adding new items. So let's not
|
113
113
|
# allow deleting without a full overwrite until we have a solution.
|
114
|
-
raise ArgumentError
|
115
|
-
"You cannot delete an item from an array, you must instead set a new array"
|
116
|
-
)
|
114
|
+
raise ArgumentError, "You cannot delete an item from an array, you must instead set a new array"
|
117
115
|
end
|
118
116
|
|
119
117
|
update_hash = {}
|
@@ -127,7 +125,7 @@ module Stripe
|
|
127
125
|
|
128
126
|
if update != {} && (!original_value ||
|
129
127
|
update != legal_entity.serialize_params_value(original_value[i], nil, false, true))
|
130
|
-
|
128
|
+
update_hash[i.to_s] = update
|
131
129
|
end
|
132
130
|
end
|
133
131
|
update_hash
|