stripe 3.3.2 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +20 -0
  4. data/.rubocop_todo.yml +62 -0
  5. data/.travis.yml +1 -1
  6. data/Gemfile +19 -12
  7. data/History.txt +10 -0
  8. data/README.md +5 -1
  9. data/Rakefile +8 -5
  10. data/VERSION +1 -1
  11. data/bin/stripe-console +2 -2
  12. data/lib/stripe.rb +72 -74
  13. data/lib/stripe/account.rb +15 -17
  14. data/lib/stripe/alipay_account.rb +10 -7
  15. data/lib/stripe/api_operations/create.rb +1 -1
  16. data/lib/stripe/api_operations/delete.rb +1 -1
  17. data/lib/stripe/api_operations/list.rb +2 -2
  18. data/lib/stripe/api_operations/request.rb +5 -12
  19. data/lib/stripe/api_operations/save.rb +6 -6
  20. data/lib/stripe/api_resource.rb +7 -9
  21. data/lib/stripe/apple_pay_domain.rb +2 -2
  22. data/lib/stripe/application_fee.rb +5 -5
  23. data/lib/stripe/application_fee_refund.rb +5 -5
  24. data/lib/stripe/balance.rb +1 -1
  25. data/lib/stripe/balance_transaction.rb +2 -2
  26. data/lib/stripe/bank_account.rb +7 -7
  27. data/lib/stripe/bitcoin_receiver.rb +4 -2
  28. data/lib/stripe/bitcoin_transaction.rb +3 -1
  29. data/lib/stripe/card.rb +5 -5
  30. data/lib/stripe/charge.rb +18 -18
  31. data/lib/stripe/country_spec.rb +2 -2
  32. data/lib/stripe/coupon.rb +1 -1
  33. data/lib/stripe/customer.rb +23 -23
  34. data/lib/stripe/dispute.rb +3 -3
  35. data/lib/stripe/ephemeral_key.rb +4 -4
  36. data/lib/stripe/errors.rb +4 -4
  37. data/lib/stripe/event.rb +1 -1
  38. data/lib/stripe/file_upload.rb +5 -5
  39. data/lib/stripe/invoice.rb +7 -7
  40. data/lib/stripe/invoice_item.rb +1 -1
  41. data/lib/stripe/invoice_line_item.rb +1 -1
  42. data/lib/stripe/list_object.rb +14 -18
  43. data/lib/stripe/login_link.rb +3 -3
  44. data/lib/stripe/oauth.rb +15 -13
  45. data/lib/stripe/order.rb +5 -5
  46. data/lib/stripe/order_return.rb +1 -1
  47. data/lib/stripe/payout.rb +3 -3
  48. data/lib/stripe/plan.rb +1 -1
  49. data/lib/stripe/product.rb +1 -1
  50. data/lib/stripe/recipient.rb +3 -2
  51. data/lib/stripe/recipient_transfer.rb +1 -2
  52. data/lib/stripe/refund.rb +1 -1
  53. data/lib/stripe/reversal.rb +5 -5
  54. data/lib/stripe/singleton_api_resource.rb +3 -3
  55. data/lib/stripe/sku.rb +1 -1
  56. data/lib/stripe/source.rb +13 -10
  57. data/lib/stripe/stripe_client.rb +149 -169
  58. data/lib/stripe/stripe_object.rb +77 -76
  59. data/lib/stripe/subscription.rb +5 -5
  60. data/lib/stripe/subscription_item.rb +2 -2
  61. data/lib/stripe/three_d_secure.rb +1 -1
  62. data/lib/stripe/token.rb +1 -1
  63. data/lib/stripe/transfer.rb +3 -3
  64. data/lib/stripe/util.rb +77 -62
  65. data/lib/stripe/version.rb +1 -1
  66. data/lib/stripe/webhook.rb +14 -10
  67. data/stripe.gemspec +14 -14
  68. data/test/stripe/account_test.rb +69 -81
  69. data/test/stripe/alipay_account_test.rb +19 -1
  70. data/test/stripe/api_operations_test.rb +7 -7
  71. data/test/stripe/api_resource_test.rb +224 -260
  72. data/test/stripe/apple_pay_domain_test.rb +8 -8
  73. data/test/stripe/application_fee_refund_test.rb +8 -8
  74. data/test/stripe/application_fee_test.rb +3 -3
  75. data/test/stripe/balance_test.rb +2 -2
  76. data/test/stripe/bank_account_test.rb +9 -11
  77. data/test/stripe/charge_test.rb +11 -11
  78. data/test/stripe/country_spec_test.rb +4 -4
  79. data/test/stripe/coupon_test.rb +10 -10
  80. data/test/stripe/customer_card_test.rb +11 -15
  81. data/test/stripe/customer_test.rb +26 -27
  82. data/test/stripe/dispute_test.rb +8 -8
  83. data/test/stripe/ephemeral_key_test.rb +14 -14
  84. data/test/stripe/errors_test.rb +2 -2
  85. data/test/stripe/file_upload_test.rb +26 -28
  86. data/test/stripe/invoice_item_test.rb +14 -14
  87. data/test/stripe/invoice_line_item_test.rb +1 -1
  88. data/test/stripe/invoice_test.rb +37 -37
  89. data/test/stripe/list_object_test.rb +60 -76
  90. data/test/stripe/login_link_test.rb +14 -14
  91. data/test/stripe/oauth_test.rb +42 -50
  92. data/test/stripe/order_return_test.rb +5 -5
  93. data/test/stripe/order_test.rb +12 -12
  94. data/test/stripe/payout_test.rb +9 -9
  95. data/test/stripe/plan_test.rb +9 -9
  96. data/test/stripe/product_test.rb +8 -8
  97. data/test/stripe/recipient_test.rb +9 -10
  98. data/test/stripe/refund_test.rb +9 -9
  99. data/test/stripe/reversal_test.rb +10 -10
  100. data/test/stripe/sku_test.rb +8 -8
  101. data/test/stripe/source_test.rb +14 -16
  102. data/test/stripe/stripe_client_test.rb +235 -266
  103. data/test/stripe/stripe_object_test.rb +163 -147
  104. data/test/stripe/stripe_response_test.rb +4 -3
  105. data/test/stripe/subscription_item_test.rb +11 -11
  106. data/test/stripe/subscription_test.rb +14 -14
  107. data/test/stripe/three_d_secure_test.rb +2 -2
  108. data/test/stripe/transfer_test.rb +8 -8
  109. data/test/stripe/util_test.rb +59 -57
  110. data/test/stripe/webhook_test.rb +18 -16
  111. data/test/stripe_test.rb +4 -4
  112. data/test/test_data.rb +26 -26
  113. data/test/test_helper.rb +29 -25
  114. metadata +6 -10
  115. data/test/stripe/bitcoin_receiver_test.rb +0 -67
  116. data/test/stripe/bitcoin_transaction_test.rb +0 -19
  117. data/test/stripe/recipient_card_test.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7556ff46c0830dc8802c25c59273daac90b0529a
4
- data.tar.gz: 3fcb48558368c256fa0dd205b8c3590740e72bdb
3
+ metadata.gz: ce403b39d687753c9cf663b0288dfa87c0d42587
4
+ data.tar.gz: c070e94e6a67f23ba5c0cdcc4f20cf8b48003a56
5
5
  SHA512:
6
- metadata.gz: 6df92106f55a4e3e55f61a64637fc3b6f348fcc1cf3d492c08cf490b1d6a205d646d0657eeabaf4ee09e7a7d46916c6a532d8e137c9a80b4a737d6bde20e61f9
7
- data.tar.gz: b19388725051c6a8164712111d47af59556b3bf9a11047d26ec53ceec1e59611d2b3006d7f8a9be52de6d7f42cad0617fd81a29dcdebbf75ed290d850f5e5905
6
+ metadata.gz: ae59948a1870bddb75f90057936a65903157625ee4dc42d00b72aad628d0dbe0ee92e81a9dbe9efd55c12b57a7b5dd7f7988fdb282862a8fcd204c927574148a
7
+ data.tar.gz: 45fd78747f6151a4fa74b64c0bdf6f89e6d68fc9735e1a694fa75c0df46812032b41ac82589bff93ae6fb68022d57089c420ff929ab202a9699d287679b650ab
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  .rvmrc
4
4
  Gemfile.lock
5
5
  tags
6
+ /.bundle/
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
@@ -16,7 +16,7 @@ sudo: false
16
16
 
17
17
  env:
18
18
  global:
19
- - STRIPE_MOCK_VERSION=0.1.12
19
+ - STRIPE_MOCK_VERSION=0.2.0
20
20
 
21
21
  cache:
22
22
  directories:
data/Gemfile CHANGED
@@ -3,29 +3,36 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'mocha', '~> 0.13.2'
7
- gem 'rake'
8
- gem 'shoulda-context'
9
- gem 'test-unit'
10
- gem 'timecop'
11
- gem 'webmock'
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 >= '2.2.2'
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('2.0.0')
26
- gem 'byebug'
27
- gem 'pry'
28
- gem 'pry-byebug'
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 'rake/testtask'
1
+ require "rake/testtask"
2
+ require "rubocop/rake_task"
2
3
 
3
- task :default => [:test]
4
+ task default: %i[test rubocop]
4
5
 
5
6
  Rake::TestTask.new do |t|
6
- t.pattern = './test/**/*_test.rb'
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
- File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
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, 'w') do |file|
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.3.2
1
+ 3.4.1
data/bin/stripe-console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'irb'
4
- require 'irb/completion'
3
+ require "irb"
4
+ require "irb/completion"
5
5
 
6
6
  require "#{File.dirname(__FILE__)}/../lib/stripe"
7
7
 
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 'cgi'
4
- require 'logger'
5
- require 'openssl'
6
- require 'rbconfig'
7
- require 'set'
8
- require 'socket'
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 'faraday'
11
- require 'json'
11
+ require "faraday"
12
+ require "json"
12
13
 
13
14
  # Version
14
- require 'stripe/version'
15
+ require "stripe/version"
15
16
 
16
17
  # API operations
17
- require 'stripe/api_operations/create'
18
- require 'stripe/api_operations/save'
19
- require 'stripe/api_operations/delete'
20
- require 'stripe/api_operations/list'
21
- require 'stripe/api_operations/request'
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 'stripe/errors'
25
- require 'stripe/util'
26
- require 'stripe/stripe_client'
27
- require 'stripe/stripe_object'
28
- require 'stripe/stripe_response'
29
- require 'stripe/list_object'
30
- require 'stripe/api_resource'
31
- require 'stripe/singleton_api_resource'
32
- require 'stripe/webhook'
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 'stripe/account'
36
- require 'stripe/alipay_account'
37
- require 'stripe/apple_pay_domain'
38
- require 'stripe/application_fee'
39
- require 'stripe/application_fee_refund'
40
- require 'stripe/balance'
41
- require 'stripe/balance_transaction'
42
- require 'stripe/bank_account'
43
- require 'stripe/bitcoin_receiver'
44
- require 'stripe/bitcoin_transaction'
45
- require 'stripe/card'
46
- require 'stripe/charge'
47
- require 'stripe/country_spec'
48
- require 'stripe/coupon'
49
- require 'stripe/customer'
50
- require 'stripe/dispute'
51
- require 'stripe/ephemeral_key'
52
- require 'stripe/event'
53
- require 'stripe/file_upload'
54
- require 'stripe/invoice'
55
- require 'stripe/invoice_item'
56
- require 'stripe/invoice_line_item'
57
- require 'stripe/login_link'
58
- require 'stripe/order'
59
- require 'stripe/order_return'
60
- require 'stripe/payout'
61
- require 'stripe/plan'
62
- require 'stripe/product'
63
- require 'stripe/recipient'
64
- require 'stripe/recipient_transfer'
65
- require 'stripe/refund'
66
- require 'stripe/reversal'
67
- require 'stripe/sku'
68
- require 'stripe/source'
69
- require 'stripe/subscription'
70
- require 'stripe/subscription_item'
71
- require 'stripe/three_d_secure'
72
- require 'stripe/token'
73
- require 'stripe/transfer'
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 'stripe/oauth'
77
+ require "stripe/oauth"
77
78
 
78
79
  module Stripe
79
- DEFAULT_CA_BUNDLE_PATH = File.dirname(__FILE__) + '/data/ca-certificates.crt'
80
+ DEFAULT_CA_BUNDLE_PATH = File.dirname(__FILE__) + "/data/ca-certificates.crt"
80
81
 
81
82
  @app_info = nil
82
83
 
83
- @api_base = 'https://api.stripe.com'
84
- @connect_base = 'https://connect.stripe.com'
85
- @uploads_base = 'https://uploads.stripe.com'
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 != nil && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(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, 01
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?
@@ -6,7 +6,7 @@ module Stripe
6
6
  include Stripe::APIOperations::Delete
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = 'account'
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['id']
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?('sk_')
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 + '/reject', params, opts)
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(obj, update_hash)
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['legal_entity']
89
+ self["legal_entity"]
90
90
  end
91
91
 
92
92
  def legal_entity=(_)
93
- raise NoMethodError.new('Overridding legal_entity can cause serious issues. Instead, set the individual fields of legal_entity like blah.legal_entity.first_name = \'Blah\'')
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: self.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.new(
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
- update_hash[i.to_s] = update
128
+ update_hash[i.to_s] = update
131
129
  end
132
130
  end
133
131
  update_hash