stripe 5.30.0 → 5.31.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,7 @@ module Stripe
20
20
  assert_equal "https://api.stripe.com", config.api_base
21
21
  assert_equal "https://connect.stripe.com", config.connect_base
22
22
  assert_equal "https://files.stripe.com", config.uploads_base
23
+ assert_equal nil, config.api_version
23
24
  end
24
25
 
25
26
  should "allow for overrides when a block is passed" do
@@ -41,7 +42,7 @@ module Stripe
41
42
  c.open_timeout = 100
42
43
  end
43
44
 
44
- duped_config = config.reverse_duplicate_merge(read_timeout: 500)
45
+ duped_config = config.reverse_duplicate_merge(read_timeout: 500, api_version: "2018-08-02")
45
46
 
46
47
  assert_equal config.open_timeout, duped_config.open_timeout
47
48
  assert_equal 500, duped_config.read_timeout
@@ -57,6 +58,24 @@ module Stripe
57
58
  end
58
59
  end
59
60
 
61
+ context "#max_network_retry_delay=" do
62
+ should "coerce the option into an integer" do
63
+ config = Stripe::StripeConfiguration.setup
64
+
65
+ config.max_network_retry_delay = "10"
66
+ assert_equal 10, config.max_network_retry_delay
67
+ end
68
+ end
69
+
70
+ context "#initial_network_retry_delay=" do
71
+ should "coerce the option into an integer" do
72
+ config = Stripe::StripeConfiguration.setup
73
+
74
+ config.initial_network_retry_delay = "10"
75
+ assert_equal 10, config.initial_network_retry_delay
76
+ end
77
+ end
78
+
60
79
  context "#log_level=" do
61
80
  should "be backwards compatible with old values" do
62
81
  config = Stripe::StripeConfiguration.setup
@@ -81,51 +100,60 @@ module Stripe
81
100
  should "clear when setting allow ca_bundle_path" do
82
101
  config = Stripe::StripeConfiguration.setup
83
102
 
84
- StripeClient.expects(:clear_all_connection_managers)
103
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
85
104
  config.ca_bundle_path = "/path/to/ca/bundle"
86
105
  end
87
106
 
88
107
  should "clear when setting open timeout" do
89
108
  config = Stripe::StripeConfiguration.setup
90
109
 
91
- StripeClient.expects(:clear_all_connection_managers)
110
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
92
111
  config.open_timeout = 10
93
112
  end
94
113
 
95
114
  should "clear when setting read timeout" do
96
115
  config = Stripe::StripeConfiguration.setup
97
116
 
98
- StripeClient.expects(:clear_all_connection_managers)
117
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
99
118
  config.read_timeout = 10
100
119
  end
101
120
 
102
121
  should "clear when setting uploads_base" do
103
122
  config = Stripe::StripeConfiguration.setup
104
123
 
105
- StripeClient.expects(:clear_all_connection_managers)
124
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
106
125
  config.uploads_base = "https://other.stripe.com"
107
126
  end
108
127
 
109
- should "clearn when setting api_base to be configured" do
128
+ should "clear when setting api_base to be configured" do
110
129
  config = Stripe::StripeConfiguration.setup
111
130
 
112
- StripeClient.expects(:clear_all_connection_managers)
131
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
113
132
  config.api_base = "https://other.stripe.com"
114
133
  end
115
134
 
116
135
  should "clear when setting connect_base" do
117
136
  config = Stripe::StripeConfiguration.setup
118
137
 
119
- StripeClient.expects(:clear_all_connection_managers)
138
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
120
139
  config.connect_base = "https://other.stripe.com"
121
140
  end
122
141
 
123
142
  should "clear when setting verify_ssl_certs" do
124
143
  config = Stripe::StripeConfiguration.setup
125
144
 
126
- StripeClient.expects(:clear_all_connection_managers)
145
+ StripeClient.expects(:clear_all_connection_managers).with(config: config)
127
146
  config.verify_ssl_certs = false
128
147
  end
129
148
  end
149
+
150
+ context "#key" do
151
+ should "generate the same key when values are identicial" do
152
+ assert_equal StripeConfiguration.setup.key, StripeConfiguration.setup.key
153
+
154
+ custom_config = StripeConfiguration.setup { |c| c.open_timeout = 1000 }
155
+ refute_equal StripeConfiguration.setup.key, custom_config.key
156
+ end
157
+ end
130
158
  end
131
159
  end
@@ -496,5 +496,15 @@ module Stripe
496
496
  assert obj.method(:id).is_a?(Method)
497
497
  end
498
498
  end
499
+
500
+ should "ignore properties that are reserved names" do
501
+ obj = Stripe::StripeObject.construct_from(metadata: { class: "something" })
502
+
503
+ # See comment on `StripeObject::RESERVED_FIELD_NAMES`
504
+ assert_equal Stripe::StripeObject, obj.metadata.class
505
+
506
+ # Value still accessible with hash syntax
507
+ assert_equal "something", obj.metadata[:class]
508
+ end
499
509
  end
500
510
  end
data/test/stripe_test.rb CHANGED
@@ -114,6 +114,11 @@ class StripeTest < Test::Unit::TestCase
114
114
  assert_equal "https://other.stripe.com", Stripe.api_base
115
115
  end
116
116
 
117
+ should "allow api_version to be configured" do
118
+ Stripe.api_version = "2018-02-28"
119
+ assert_equal "2018-02-28", Stripe.api_version
120
+ end
121
+
117
122
  should "allow connect_base to be configured" do
118
123
  Stripe.connect_base = "https://other.stripe.com"
119
124
  assert_equal "https://other.stripe.com", Stripe.connect_base
data/test/test_helper.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "coveralls"
4
- Coveralls.wear!("test_frameworks")
5
-
6
3
  require "stripe"
7
4
  require "test/unit"
8
5
  require "mocha/setup"
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.30.0
4
+ version: 5.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2021-04-02 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.
@@ -21,6 +21,7 @@ files:
21
21
  - ".editorconfig"
22
22
  - ".gitattributes"
23
23
  - ".github/ISSUE_TEMPLATE.md"
24
+ - ".github/workflows/ci.yml"
24
25
  - ".gitignore"
25
26
  - ".rubocop.yml"
26
27
  - ".rubocop_todo.yml"
@@ -248,7 +249,7 @@ metadata:
248
249
  github_repo: ssh://github.com/stripe/stripe-ruby
249
250
  homepage_uri: https://stripe.com/docs/api/ruby
250
251
  source_code_uri: https://github.com/stripe/stripe-ruby
251
- post_install_message:
252
+ post_install_message:
252
253
  rdoc_options: []
253
254
  require_paths:
254
255
  - lib
@@ -264,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
265
  version: '0'
265
266
  requirements: []
266
267
  rubygems_version: 3.1.2
267
- signing_key:
268
+ signing_key:
268
269
  specification_version: 4
269
270
  summary: Ruby bindings for the Stripe API
270
271
  test_files: