dodopayments 1.56.3 → 1.56.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cce501b48b61829f70d3d0d1e8e03862a505cdf2a1c628e146f951085c9df0b9
4
- data.tar.gz: f0412008c77faed9c7e8ec7ada5fdd4c4030364de29fe3b9b2a31dac5c13a5c9
3
+ metadata.gz: 7e87a36ea54d7bec5d0cfd23f516b508eb98921982d150de3a7a9915f035991a
4
+ data.tar.gz: 43cfde45462e61c446f009697d73bcef8fe05f8ba132f2ff7e532f2611cf6396
5
5
  SHA512:
6
- metadata.gz: ede618c7672f91de7e1d0237c965398a76e46acfdb31091547d8a4a32c2db22c66e44f1420ea55b35bf5287c5f0d38d58721cd8b6af3c3420ab7848fc1dce6ad
7
- data.tar.gz: acac1e750dab7664afd9c898a4166a1aaa2336ea12d7c1388e1cfa233e35999a6e95000528e9868f0df8c20a0f28e0daa115b2e7e1f25a635e2d4fc6fb68da63
6
+ metadata.gz: 1bb6591747447b4ed03a1808cef250ec12cd6db967fa7ae62ce82324b68c5b0db2f17597787eb0c510f9055340858f57b4f7d340d759e0f01eb525e8712cd021
7
+ data.tar.gz: dd5a3ab5bbab2a2cde57c36358906142d473a39992d85c4ee673b9f8aaeb1a0c24f70641b69c5febe310b14e3f08436d949fde1a389fdedf2de69c245789716d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.56.4 (2025-11-05)
4
+
5
+ Full Changelog: [v1.56.3...v1.56.4](https://github.com/dodopayments/dodopayments-ruby/compare/v1.56.3...v1.56.4)
6
+
7
+ ### Bug Fixes
8
+
9
+ * better thread safety via early initializing SSL store during HTTP client creation ([931e1ee](https://github.com/dodopayments/dodopayments-ruby/commit/931e1eeb8a5cda3c0359ca8dd58621ac10f2aa5a))
10
+
11
+
12
+ ### Chores
13
+
14
+ * bump dependency version and update sorbet types ([af5f49a](https://github.com/dodopayments/dodopayments-ruby/commit/af5f49a7f1d0ed6de5f230e6a9c93ef9ea0d6a38))
15
+
3
16
  ## 1.56.3 (2025-10-29)
4
17
 
5
18
  Full Changelog: [v1.56.2...v1.56.3](https://github.com/dodopayments/dodopayments-ruby/compare/v1.56.2...v1.56.3)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "dodopayments", "~> 1.56.3"
20
+ gem "dodopayments", "~> 1.56.4"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -201,7 +201,8 @@ module Dodopayments
201
201
  self.class::PLATFORM_HEADERS,
202
202
  {
203
203
  "accept" => "application/json",
204
- "content-type" => "application/json"
204
+ "content-type" => "application/json",
205
+ "user-agent" => user_agent
205
206
  },
206
207
  headers
207
208
  )
@@ -219,6 +220,11 @@ module Dodopayments
219
220
  # @return [Hash{String=>String}]
220
221
  private def auth_headers = {}
221
222
 
223
+ # @api private
224
+ #
225
+ # @return [String]
226
+ private def user_agent = "#{self.class.name}/Ruby #{Dodopayments::VERSION}"
227
+
222
228
  # @api private
223
229
  #
224
230
  # @return [String]
@@ -16,10 +16,11 @@ module Dodopayments
16
16
  class << self
17
17
  # @api private
18
18
  #
19
+ # @param cert_store [OpenSSL::X509::Store]
19
20
  # @param url [URI::Generic]
20
21
  #
21
22
  # @return [Net::HTTP]
22
- def connect(url)
23
+ def connect(cert_store:, url:)
23
24
  port =
24
25
  case [url.port, url.scheme]
25
26
  in [Integer, _]
@@ -33,6 +34,8 @@ module Dodopayments
33
34
  Net::HTTP.new(url.host, port).tap do
34
35
  _1.use_ssl = %w[https wss].include?(url.scheme)
35
36
  _1.max_retries = 0
37
+
38
+ (_1.cert_store = cert_store) if _1.use_ssl?
36
39
  end
37
40
  end
38
41
 
@@ -102,7 +105,7 @@ module Dodopayments
102
105
  pool =
103
106
  @mutex.synchronize do
104
107
  @pools[origin] ||= ConnectionPool.new(size: @size) do
105
- self.class.connect(url)
108
+ self.class.connect(cert_store: @cert_store, url: url)
106
109
  end
107
110
  end
108
111
 
@@ -192,6 +195,7 @@ module Dodopayments
192
195
  def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
193
196
  @mutex = Mutex.new
194
197
  @size = size
198
+ @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
195
199
  @pools = {}
196
200
  end
197
201
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "1.56.3"
4
+ VERSION = "1.56.4"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -9,6 +9,7 @@ require "erb"
9
9
  require "etc"
10
10
  require "json"
11
11
  require "net/http"
12
+ require "openssl"
12
13
  require "pathname"
13
14
  require "rbconfig"
14
15
  require "securerandom"
data/manifest.yaml CHANGED
@@ -6,6 +6,7 @@ dependencies:
6
6
  - etc
7
7
  - json
8
8
  - net/http
9
+ - openssl
9
10
  - pathname
10
11
  - rbconfig
11
12
  - securerandom
@@ -180,6 +180,11 @@ module Dodopayments
180
180
  private def auth_headers
181
181
  end
182
182
 
183
+ # @api private
184
+ sig { returns(String) }
185
+ private def user_agent
186
+ end
187
+
183
188
  # @api private
184
189
  sig { returns(String) }
185
190
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module Dodopayments
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module Dodopayments
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: Dodopayments::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -282,9 +282,13 @@ module Dodopayments
282
282
 
283
283
  # Create a new instance of a model.
284
284
  sig do
285
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
286
- T.attached_class
287
- )
285
+ params(
286
+ data:
287
+ T.any(
288
+ T::Hash[Symbol, T.anything],
289
+ Dodopayments::Internal::Type::BaseModel
290
+ )
291
+ ).returns(T.attached_class)
288
292
  end
289
293
  def self.new(data = {})
290
294
  end
@@ -87,6 +87,8 @@ module Dodopayments
87
87
 
88
88
  private def auth_headers: -> ::Hash[String, String]
89
89
 
90
+ private def user_agent: -> String
91
+
90
92
  private def generate_idempotency_key: -> String
91
93
 
92
94
  private def build_request: (
@@ -17,7 +17,10 @@ module Dodopayments
17
17
 
18
18
  DEFAULT_MAX_CONNECTIONS: Integer
19
19
 
20
- def self.connect: (URI::Generic url) -> top
20
+ def self.connect: (
21
+ cert_store: OpenSSL::X509::Store,
22
+ url: URI::Generic
23
+ ) -> top
21
24
 
22
25
  def self.calibrate_socket_timeout: (top conn, Float deadline) -> void
23
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dodopayments
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.56.3
4
+ version: 1.56.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dodo Payments
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-29 00:00:00.000000000 Z
11
+ date: 2025-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool