stripe 5.23.1 → 5.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33f1cdd1289229d711bcba485944474bfc3b645aaf0402bf2d4236eff4a87a4e
4
- data.tar.gz: d2e05e209525b15095fcdbbfacb9f3e05ce4d7eb902c06c19f468bbd5a192184
3
+ metadata.gz: dad4d3bffd7ba2748a3331de5d3b97108732144b33818a5e79efd6eb597e4834
4
+ data.tar.gz: c46abe2511c5316276921da29766c22aed11bb92b136b53fb7ea82fb542640c5
5
5
  SHA512:
6
- metadata.gz: 2dcb34a7af495d2a704d3b48c35b08b1680bb24ea541e46e90c247ca57689fbaf213f798ef018a9fa9ed17644e42e76b7666f8fac2dd104f495f460492c5fb99
7
- data.tar.gz: 232b4bef2acfc1b452ee1314c67d6e688a01a5860e4be93ad49491b65506cc3e10763c3a1090e2aeaa5137a1438f42a8f7e4f7741f4e1909f894ddb5dcef3639
6
+ metadata.gz: 824c459fec4234b09e6d04d20b79728db4ccd19e0dc5cbe9874d319a995b62cb7c252dff31fad3c0fae295682bd68cfbb9fb52f0e98044f3708f1999c0f55d16
7
+ data.tar.gz: 6f1557c58e7c0ab6e407444208c142953889ec1f2746464804cf38d6766550aca0577902982211a696522f47e5ffc06d304f17c4fc7b4fdfbe60c1603077a72d
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.24.0 - 2020-08-26
4
+ * [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
5
+ * [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
6
+
3
7
  ## 5.23.1 - 2020-08-05
4
8
  * [#936](https://github.com/stripe/stripe-ruby/pull/936) Rename API resource's `request` method
5
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.23.1
1
+ 5.24.0
@@ -12,6 +12,7 @@ require "securerandom"
12
12
  require "set"
13
13
  require "socket"
14
14
  require "uri"
15
+ require "forwardable"
15
16
 
16
17
  # Version
17
18
  require "stripe/version"
@@ -38,6 +39,7 @@ require "stripe/error_object"
38
39
  require "stripe/api_resource"
39
40
  require "stripe/singleton_api_resource"
40
41
  require "stripe/webhook"
42
+ require "stripe/stripe_configuration"
41
43
 
42
44
  # Named API resources
43
45
  require "stripe/resources"
@@ -48,47 +50,41 @@ require "stripe/oauth"
48
50
  module Stripe
49
51
  DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
50
52
 
51
- @app_info = nil
52
-
53
- @api_base = "https://api.stripe.com"
54
- @connect_base = "https://connect.stripe.com"
55
- @uploads_base = "https://files.stripe.com"
56
-
57
- @log_level = nil
58
- @logger = nil
59
-
60
- @proxy = nil
61
-
62
- @max_network_retries = 0
63
- @max_network_retry_delay = 2
64
- @initial_network_retry_delay = 0.5
65
-
66
- @ca_bundle_path = DEFAULT_CA_BUNDLE_PATH
67
- @ca_store = nil
68
- @verify_ssl_certs = true
53
+ # map to the same values as the standard library's logger
54
+ LEVEL_DEBUG = Logger::DEBUG
55
+ LEVEL_ERROR = Logger::ERROR
56
+ LEVEL_INFO = Logger::INFO
69
57
 
70
- @open_timeout = 30
71
- @read_timeout = 80
58
+ @app_info = nil
72
59
 
73
- @enable_telemetry = true
60
+ @configuration = Stripe::StripeConfiguration.setup
74
61
 
75
62
  class << self
76
- attr_accessor :api_key
77
- attr_accessor :api_version
63
+ extend Forwardable
64
+
65
+ # User configurable options
66
+ def_delegators :@configuration, :api_key, :api_key=
67
+ def_delegators :@configuration, :api_version, :api_version=
68
+ def_delegators :@configuration, :stripe_account, :stripe_account=
69
+ def_delegators :@configuration, :api_base, :api_base=
70
+ def_delegators :@configuration, :uploads_base, :uploads_base=
71
+ def_delegators :@configuration, :connect_base, :connect_base=
72
+ def_delegators :@configuration, :open_timeout, :open_timeout=
73
+ def_delegators :@configuration, :read_timeout, :read_timeout=
74
+ def_delegators :@configuration, :proxy, :proxy=
75
+ def_delegators :@configuration, :verify_ssl_certs, :verify_ssl_certs=
76
+ def_delegators :@configuration, :ca_bundle_path, :ca_bundle_path=
77
+ def_delegators :@configuration, :log_level, :log_level=
78
+ def_delegators :@configuration, :logger, :logger=
79
+ def_delegators :@configuration, :max_network_retries, :max_network_retries=
80
+ def_delegators :@configuration, :enable_telemetry=, :enable_telemetry?
81
+
82
+ # Internal configurations
83
+ def_delegators :@configuration, :max_network_retry_delay
84
+ def_delegators :@configuration, :initial_network_retry_delay
85
+ def_delegators :@configuration, :ca_store
86
+
78
87
  attr_accessor :client_id
79
- attr_accessor :stripe_account
80
-
81
- # These all get manual attribute writers so that we can reset connections
82
- # if they change.
83
- attr_reader :api_base
84
- attr_reader :connect_base
85
- attr_reader :open_timeout
86
- attr_reader :proxy
87
- attr_reader :read_timeout
88
- attr_reader :uploads_base
89
- attr_reader :verify_ssl_certs
90
-
91
- attr_reader :max_network_retry_delay, :initial_network_retry_delay
92
88
  end
93
89
 
94
90
  # Gets the application for a plugin that's identified some. See
@@ -101,126 +97,6 @@ module Stripe
101
97
  @app_info = info
102
98
  end
103
99
 
104
- def self.api_base=(api_base)
105
- @api_base = api_base
106
- StripeClient.clear_all_connection_managers
107
- end
108
-
109
- # The location of a file containing a bundle of CA certificates. By default
110
- # the library will use an included bundle that can successfully validate
111
- # Stripe certificates.
112
- def self.ca_bundle_path
113
- @ca_bundle_path
114
- end
115
-
116
- def self.ca_bundle_path=(path)
117
- @ca_bundle_path = path
118
-
119
- # empty this field so a new store is initialized
120
- @ca_store = nil
121
-
122
- StripeClient.clear_all_connection_managers
123
- end
124
-
125
- # A certificate store initialized from the the bundle in #ca_bundle_path and
126
- # which is used to validate TLS on every request.
127
- #
128
- # This was added to the give the gem "pseudo thread safety" in that it seems
129
- # when initiating many parallel requests marshaling the certificate store is
130
- # the most likely point of failure (see issue #382). Any program attempting
131
- # to leverage this pseudo safety should make a call to this method (i.e.
132
- # `Stripe.ca_store`) in their initialization code because it marshals lazily
133
- # and is itself not thread safe.
134
- def self.ca_store
135
- @ca_store ||= begin
136
- store = OpenSSL::X509::Store.new
137
- store.add_file(ca_bundle_path)
138
- store
139
- end
140
- end
141
-
142
- def self.connect_base=(connect_base)
143
- @connect_base = connect_base
144
- StripeClient.clear_all_connection_managers
145
- end
146
-
147
- def self.enable_telemetry?
148
- @enable_telemetry
149
- end
150
-
151
- def self.enable_telemetry=(val)
152
- @enable_telemetry = val
153
- end
154
-
155
- # map to the same values as the standard library's logger
156
- LEVEL_DEBUG = Logger::DEBUG
157
- LEVEL_ERROR = Logger::ERROR
158
- LEVEL_INFO = Logger::INFO
159
-
160
- # When set prompts the library to log some extra information to $stdout and
161
- # $stderr about what it's doing. For example, it'll produce information about
162
- # requests, responses, and errors that are received. Valid log levels are
163
- # `debug` and `info`, with `debug` being a little more verbose in places.
164
- #
165
- # Use of this configuration is only useful when `.logger` is _not_ set. When
166
- # it is, the decision what levels to print is entirely deferred to the logger.
167
- def self.log_level
168
- @log_level
169
- end
170
-
171
- def self.log_level=(val)
172
- # Backwards compatibility for values that we briefly allowed
173
- if val == "debug"
174
- val = LEVEL_DEBUG
175
- elsif val == "info"
176
- val = LEVEL_INFO
177
- end
178
-
179
- if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
180
- raise ArgumentError,
181
- "log_level should only be set to `nil`, `debug` or `info`"
182
- end
183
- @log_level = val
184
- end
185
-
186
- # Sets a logger to which logging output will be sent. The logger should
187
- # support the same interface as the `Logger` class that's part of Ruby's
188
- # standard library (hint, anything in `Rails.logger` will likely be
189
- # suitable).
190
- #
191
- # If `.logger` is set, the value of `.log_level` is ignored. The decision on
192
- # what levels to print is entirely deferred to the logger.
193
- def self.logger
194
- @logger
195
- end
196
-
197
- def self.logger=(val)
198
- @logger = val
199
- end
200
-
201
- def self.max_network_retries
202
- @max_network_retries
203
- end
204
-
205
- def self.max_network_retries=(val)
206
- @max_network_retries = val.to_i
207
- end
208
-
209
- def self.open_timeout=(open_timeout)
210
- @open_timeout = open_timeout
211
- StripeClient.clear_all_connection_managers
212
- end
213
-
214
- def self.proxy=(proxy)
215
- @proxy = proxy
216
- StripeClient.clear_all_connection_managers
217
- end
218
-
219
- def self.read_timeout=(read_timeout)
220
- @read_timeout = read_timeout
221
- StripeClient.clear_all_connection_managers
222
- end
223
-
224
100
  # Sets some basic information about the running application that's sent along
225
101
  # with API requests. Useful for plugin authors to identify their plugin when
226
102
  # communicating with Stripe.
@@ -234,16 +110,6 @@ module Stripe
234
110
  version: version,
235
111
  }
236
112
  end
237
-
238
- def self.uploads_base=(uploads_base)
239
- @uploads_base = uploads_base
240
- StripeClient.clear_all_connection_managers
241
- end
242
-
243
- def self.verify_ssl_certs=(verify_ssl_certs)
244
- @verify_ssl_certs = verify_ssl_certs
245
- StripeClient.clear_all_connection_managers
246
- end
247
113
  end
248
114
 
249
115
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
@@ -0,0 +1,167 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ # Configurable options:
5
+ #
6
+ # =ca_bundle_path=
7
+ # The location of a file containing a bundle of CA certificates. By default
8
+ # the library will use an included bundle that can successfully validate
9
+ # Stripe certificates.
10
+ #
11
+ # =log_level=
12
+ # When set prompts the library to log some extra information to $stdout and
13
+ # $stderr about what it's doing. For example, it'll produce information about
14
+ # requests, responses, and errors that are received. Valid log levels are
15
+ # `debug` and `info`, with `debug` being a little more verbose in places.
16
+ #
17
+ # Use of this configuration is only useful when `.logger` is _not_ set. When
18
+ # it is, the decision what levels to print is entirely deferred to the logger.
19
+ #
20
+ # =logger=
21
+ # The logger should support the same interface as the `Logger` class that's
22
+ # part of Ruby's standard library (hint, anything in `Rails.logger` will
23
+ # likely be suitable).
24
+ #
25
+ # If `.logger` is set, the value of `.log_level` is ignored. The decision on
26
+ # what levels to print is entirely deferred to the logger.
27
+ class StripeConfiguration
28
+ attr_accessor :api_key
29
+ attr_accessor :api_version
30
+ attr_accessor :client_id
31
+ attr_accessor :enable_telemetry
32
+ attr_accessor :logger
33
+ attr_accessor :stripe_account
34
+
35
+ attr_reader :api_base
36
+ attr_reader :uploads_base
37
+ attr_reader :connect_base
38
+ attr_reader :ca_bundle_path
39
+ attr_reader :log_level
40
+ attr_reader :initial_network_retry_delay
41
+ attr_reader :max_network_retries
42
+ attr_reader :max_network_retry_delay
43
+ attr_reader :open_timeout
44
+ attr_reader :read_timeout
45
+ attr_reader :proxy
46
+ attr_reader :verify_ssl_certs
47
+
48
+ def self.setup
49
+ new.tap do |instance|
50
+ yield(instance) if block_given?
51
+ end
52
+ end
53
+
54
+ # Create a new config based off an existing one. This is useful when the
55
+ # caller wants to override the global configuration
56
+ def reverse_duplicate_merge(hash)
57
+ dup.tap do |instance|
58
+ hash.each do |option, value|
59
+ instance.public_send("#{option}=", value)
60
+ end
61
+ end
62
+ end
63
+
64
+ def initialize
65
+ @ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
66
+ @enable_telemetry = true
67
+ @verify_ssl_certs = true
68
+
69
+ @max_network_retries = 0
70
+ @initial_network_retry_delay = 0.5
71
+ @max_network_retry_delay = 2
72
+
73
+ @open_timeout = 30
74
+ @read_timeout = 80
75
+
76
+ @api_base = "https://api.stripe.com"
77
+ @connect_base = "https://connect.stripe.com"
78
+ @uploads_base = "https://files.stripe.com"
79
+ end
80
+
81
+ def log_level=(val)
82
+ # Backwards compatibility for values that we briefly allowed
83
+ if val == "debug"
84
+ val = Stripe::LEVEL_DEBUG
85
+ elsif val == "info"
86
+ val = Stripe::LEVEL_INFO
87
+ end
88
+
89
+ levels = [Stripe::LEVEL_INFO, Stripe::LEVEL_DEBUG, Stripe::LEVEL_ERROR]
90
+
91
+ if !val.nil? && !levels.include?(val)
92
+ raise ArgumentError,
93
+ "log_level should only be set to `nil`, `debug` or `info`"
94
+ end
95
+ @log_level = val
96
+ end
97
+
98
+ def max_network_retries=(val)
99
+ @max_network_retries = val.to_i
100
+ end
101
+
102
+ def open_timeout=(open_timeout)
103
+ @open_timeout = open_timeout
104
+ StripeClient.clear_all_connection_managers
105
+ end
106
+
107
+ def read_timeout=(read_timeout)
108
+ @read_timeout = read_timeout
109
+ StripeClient.clear_all_connection_managers
110
+ end
111
+
112
+ def proxy=(proxy)
113
+ @proxy = proxy
114
+ StripeClient.clear_all_connection_managers
115
+ end
116
+
117
+ def verify_ssl_certs=(verify_ssl_certs)
118
+ @verify_ssl_certs = verify_ssl_certs
119
+ StripeClient.clear_all_connection_managers
120
+ end
121
+
122
+ def uploads_base=(uploads_base)
123
+ @uploads_base = uploads_base
124
+ StripeClient.clear_all_connection_managers
125
+ end
126
+
127
+ def connect_base=(connect_base)
128
+ @connect_base = connect_base
129
+ StripeClient.clear_all_connection_managers
130
+ end
131
+
132
+ def api_base=(api_base)
133
+ @api_base = api_base
134
+ StripeClient.clear_all_connection_managers
135
+ end
136
+
137
+ def ca_bundle_path=(path)
138
+ @ca_bundle_path = path
139
+
140
+ # empty this field so a new store is initialized
141
+ @ca_store = nil
142
+
143
+ StripeClient.clear_all_connection_managers
144
+ end
145
+
146
+ # A certificate store initialized from the the bundle in #ca_bundle_path and
147
+ # which is used to validate TLS on every request.
148
+ #
149
+ # This was added to the give the gem "pseudo thread safety" in that it seems
150
+ # when initiating many parallel requests marshaling the certificate store is
151
+ # the most likely point of failure (see issue #382). Any program attempting
152
+ # to leverage this pseudo safety should make a call to this method (i.e.
153
+ # `Stripe.ca_store`) in their initialization code because it marshals lazily
154
+ # and is itself not thread safe.
155
+ def ca_store
156
+ @ca_store ||= begin
157
+ store = OpenSSL::X509::Store.new
158
+ store.add_file(ca_bundle_path)
159
+ store
160
+ end
161
+ end
162
+
163
+ def enable_telemetry?
164
+ enable_telemetry
165
+ end
166
+ end
167
+ end
@@ -375,7 +375,7 @@ module Stripe
375
375
  begin
376
376
  super
377
377
  rescue NoMethodError => e
378
- # If we notice the accessed name if our set of transient values we can
378
+ # If we notice the accessed name of our set of transient values we can
379
379
  # give the user a slightly more helpful error message. If not, just
380
380
  # raise right away.
381
381
  raise unless @transient_values.include?(name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "5.23.1"
4
+ VERSION = "5.24.0"
5
5
  end
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("../test_helper", __dir__)
4
+
5
+ module Stripe
6
+ class StripeConfigurationTest < Test::Unit::TestCase
7
+ context ".setup" do
8
+ should "initialize a new configuration with defaults" do
9
+ config = Stripe::StripeConfiguration.setup
10
+
11
+ assert_equal Stripe::DEFAULT_CA_BUNDLE_PATH, config.ca_bundle_path
12
+ assert_equal true, config.enable_telemetry
13
+ assert_equal true, config.verify_ssl_certs
14
+ assert_equal 2, config.max_network_retry_delay
15
+ assert_equal 0.5, config.initial_network_retry_delay
16
+ assert_equal 0, config.max_network_retries
17
+ assert_equal 30, config.open_timeout
18
+ assert_equal 80, config.read_timeout
19
+ assert_equal "https://api.stripe.com", config.api_base
20
+ assert_equal "https://connect.stripe.com", config.connect_base
21
+ assert_equal "https://files.stripe.com", config.uploads_base
22
+ end
23
+
24
+ should "allow for overrides when a block is passed" do
25
+ config = Stripe::StripeConfiguration.setup do |c|
26
+ c.open_timeout = 100
27
+ c.read_timeout = 100
28
+ end
29
+
30
+ assert_equal 100, config.open_timeout
31
+ assert_equal 100, config.read_timeout
32
+ end
33
+ end
34
+
35
+ context "#reverse_duplicate_merge" do
36
+ should "return a duplicate object with overrides" do
37
+ config = Stripe::StripeConfiguration.setup do |c|
38
+ c.open_timeout = 100
39
+ end
40
+
41
+ duped_config = config.reverse_duplicate_merge(read_timeout: 500)
42
+
43
+ assert_equal config.open_timeout, duped_config.open_timeout
44
+ assert_equal 500, duped_config.read_timeout
45
+ end
46
+ end
47
+
48
+ context "#max_network_retries=" do
49
+ should "coerce the option into an integer" do
50
+ config = Stripe::StripeConfiguration.setup
51
+
52
+ config.max_network_retries = "10"
53
+ assert_equal 10, config.max_network_retries
54
+ end
55
+ end
56
+
57
+ context "#log_level=" do
58
+ should "be backwards compatible with old values" do
59
+ config = Stripe::StripeConfiguration.setup
60
+
61
+ config.log_level = "debug"
62
+ assert_equal Stripe::LEVEL_DEBUG, config.log_level
63
+
64
+ config.log_level = "info"
65
+ assert_equal Stripe::LEVEL_INFO, config.log_level
66
+ end
67
+
68
+ should "raise an error if the value isn't valid" do
69
+ config = Stripe::StripeConfiguration.setup
70
+
71
+ assert_raises ArgumentError do
72
+ config.log_level = "Foo"
73
+ end
74
+ end
75
+ end
76
+
77
+ context "options that require all connection managers to be cleared" do
78
+ should "clear when setting allow ca_bundle_path" do
79
+ config = Stripe::StripeConfiguration.setup
80
+
81
+ StripeClient.expects(:clear_all_connection_managers)
82
+ config.ca_bundle_path = "/path/to/ca/bundle"
83
+ end
84
+
85
+ should "clear when setting open timeout" do
86
+ config = Stripe::StripeConfiguration.setup
87
+
88
+ StripeClient.expects(:clear_all_connection_managers)
89
+ config.open_timeout = 10
90
+ end
91
+
92
+ should "clear when setting read timeout" do
93
+ config = Stripe::StripeConfiguration.setup
94
+
95
+ StripeClient.expects(:clear_all_connection_managers)
96
+ config.read_timeout = 10
97
+ end
98
+
99
+ should "clear when setting uploads_base" do
100
+ config = Stripe::StripeConfiguration.setup
101
+
102
+ StripeClient.expects(:clear_all_connection_managers)
103
+ config.uploads_base = "https://other.stripe.com"
104
+ end
105
+
106
+ should "clearn when setting api_base to be configured" do
107
+ config = Stripe::StripeConfiguration.setup
108
+
109
+ StripeClient.expects(:clear_all_connection_managers)
110
+ config.api_base = "https://other.stripe.com"
111
+ end
112
+
113
+ should "clear when setting connect_base" do
114
+ config = Stripe::StripeConfiguration.setup
115
+
116
+ StripeClient.expects(:clear_all_connection_managers)
117
+ config.connect_base = "https://other.stripe.com"
118
+ end
119
+
120
+ should "clear when setting verify_ssl_certs" do
121
+ config = Stripe::StripeConfiguration.setup
122
+
123
+ StripeClient.expects(:clear_all_connection_managers)
124
+ config.verify_ssl_certs = false
125
+ end
126
+ end
127
+ end
128
+ end
@@ -23,28 +23,97 @@ class StripeTest < Test::Unit::TestCase
23
23
  end
24
24
  end
25
25
 
26
- should "allow ca_bundle_path to be configured" do
27
- begin
28
- old = Stripe.ca_bundle_path
29
- Stripe.ca_bundle_path = "path/to/ca/bundle"
30
- assert_equal "path/to/ca/bundle", Stripe.ca_bundle_path
31
- ensure
32
- Stripe.ca_bundle_path = old
26
+ context "forwardable configurations" do
27
+ context "internal configurations" do
28
+ should "return the certificate store" do
29
+ assert Stripe.ca_store.is_a?(OpenSSL::X509::Store)
30
+ end
31
+
32
+ should "return the max_network_retry_delay" do
33
+ assert_equal 2, Stripe.max_network_retry_delay
34
+ end
35
+
36
+ should "return the initial_network_retry_delay" do
37
+ assert_equal 0.5, Stripe.initial_network_retry_delay
38
+ end
33
39
  end
34
- end
35
40
 
36
- should "allow max_network_retries to be configured" do
37
- begin
38
- old = Stripe.max_network_retries
39
- Stripe.max_network_retries = 99
40
- assert_equal 99, Stripe.max_network_retries
41
- ensure
42
- Stripe.max_network_retries = old
41
+ should "allow ca_bundle_path to be configured" do
42
+ Stripe::StripeClient.expects(:clear_all_connection_managers)
43
+ Stripe.ca_bundle_path = "/path/to/ca/bundle"
44
+ assert_equal "/path/to/ca/bundle", Stripe.ca_bundle_path
43
45
  end
44
- end
45
46
 
46
- should "have default open and read timeouts" do
47
- assert_equal Stripe.open_timeout, 30
48
- assert_equal Stripe.read_timeout, 80
47
+ should "allow open timeout to be configured" do
48
+ Stripe.open_timeout = 10
49
+ assert_equal 10, Stripe.open_timeout
50
+ end
51
+
52
+ should "allow read timeout to be configured" do
53
+ Stripe.read_timeout = 10
54
+ assert_equal 10, Stripe.read_timeout
55
+ end
56
+
57
+ should "allow api_key to be configured" do
58
+ Stripe.api_key = "sk_local_test"
59
+ assert_equal "sk_local_test", Stripe.api_key
60
+ end
61
+
62
+ should "allow stripe_account to be configured" do
63
+ Stripe.stripe_account = "acct_1234"
64
+ assert_equal "acct_1234", Stripe.stripe_account
65
+ end
66
+
67
+ should "allow enable_telemetry to be configured" do
68
+ begin
69
+ old = Stripe.enable_telemetry?
70
+
71
+ Stripe.enable_telemetry = false
72
+ assert_equal false, Stripe.enable_telemetry?
73
+ ensure
74
+ Stripe.enable_telemetry = old
75
+ end
76
+ end
77
+
78
+ should "allow log_level to be configured" do
79
+ Stripe.log_level = "debug"
80
+ assert_equal ::Logger::DEBUG, Stripe.log_level
81
+ end
82
+
83
+ should "allow logger to be configured" do
84
+ logger = Object.new
85
+ Stripe.logger = logger
86
+ assert_equal logger, Stripe.logger
87
+ end
88
+
89
+ should "allow proxy to be configured" do
90
+ Stripe.proxy = "http://proxy"
91
+ assert_equal "http://proxy", Stripe.proxy
92
+ end
93
+
94
+ should "allow uploads_base to be configured" do
95
+ Stripe.uploads_base = "https://other.stripe.com"
96
+ assert_equal "https://other.stripe.com", Stripe.uploads_base
97
+ end
98
+
99
+ should "allow api_base to be configured" do
100
+ Stripe.api_base = "https://other.stripe.com"
101
+ assert_equal "https://other.stripe.com", Stripe.api_base
102
+ end
103
+
104
+ should "allow connect_base to be configured" do
105
+ Stripe.connect_base = "https://other.stripe.com"
106
+ assert_equal "https://other.stripe.com", Stripe.connect_base
107
+ end
108
+
109
+ should "allow verify_ssl_certs to be configured" do
110
+ Stripe.verify_ssl_certs = false
111
+ assert_equal false, Stripe.verify_ssl_certs
112
+ end
113
+
114
+ should "allow client_id to be configured" do
115
+ Stripe.client_id = "client"
116
+ assert_equal "client", Stripe.client_id
117
+ end
49
118
  end
50
119
  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: 5.23.1
4
+ version: 5.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.
@@ -138,6 +138,7 @@ files:
138
138
  - lib/stripe/resources/webhook_endpoint.rb
139
139
  - lib/stripe/singleton_api_resource.rb
140
140
  - lib/stripe/stripe_client.rb
141
+ - lib/stripe/stripe_configuration.rb
141
142
  - lib/stripe/stripe_object.rb
142
143
  - lib/stripe/stripe_response.rb
143
144
  - lib/stripe/util.rb
@@ -211,6 +212,7 @@ files:
211
212
  - test/stripe/sku_test.rb
212
213
  - test/stripe/source_test.rb
213
214
  - test/stripe/stripe_client_test.rb
215
+ - test/stripe/stripe_configuration_test.rb
214
216
  - test/stripe/stripe_object_test.rb
215
217
  - test/stripe/stripe_response_test.rb
216
218
  - test/stripe/subscription_item_test.rb
@@ -329,6 +331,7 @@ test_files:
329
331
  - test/stripe/sku_test.rb
330
332
  - test/stripe/source_test.rb
331
333
  - test/stripe/stripe_client_test.rb
334
+ - test/stripe/stripe_configuration_test.rb
332
335
  - test/stripe/stripe_object_test.rb
333
336
  - test/stripe/stripe_response_test.rb
334
337
  - test/stripe/subscription_item_test.rb