sports-odds-api 1.2.0 → 1.2.2

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: cbc29adb3f6b01cd771c2de2e42a5d4e56cdfba85adf2a4c87c85aeeed03863d
4
- data.tar.gz: f37b381a1a5df294f47f93617a74618c2d2cd6e68e330f4100b840475218148e
3
+ metadata.gz: f689a7b1270baa4209b9172d7de7ad334f3931c5dbb7e810724c01502cea09aa
4
+ data.tar.gz: f10d47f2bc573bfad258aaa4a14883e05e94e1fb343eaacc50f1ad842b967c59
5
5
  SHA512:
6
- metadata.gz: 80e2c1ce0b64145a4f4419caea0a692978f8f92d47e2277c43429bc55b91608bde163cc2eef91c479b27fb8d21968ca79320419a9c1bc74f5f84afe064856abb
7
- data.tar.gz: 055d3bc12991f1069d44c1803f644b4907bca175d844bfbdbeda9858adf179bd5d1bde176a069d93345a295869f7acf9ac166ffb10f944f1ff5907a9d73d2d8e
6
+ metadata.gz: 3a88d1344291e1d8bcc85d3414e38f1f9b16f2d23e9b8ce13ccef14637f5606c556de3054f6efcba69c0b97690fc24331816d16aa5022c7cd2c84ac42a8719de
7
+ data.tar.gz: 4ad9da993cb19e8a3ea0398ec730f46d4fb5c71032c69bb481c5900d0b7f7950500f545458b9b6d360ab94ab8c84df4efe232447a960d6163c4e552b0a3962af
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.2 (2025-11-26)
4
+
5
+ Full Changelog: [v1.2.1...v1.2.2](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.2.1...v1.2.2)
6
+
7
+ ### Chores
8
+
9
+ * explicitly require "base64" gem ([45d5be1](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/45d5be1f47fad8277c9480f60bb410f9f114ef0a))
10
+
11
+ ## 1.2.1 (2025-11-05)
12
+
13
+ Full Changelog: [v1.2.0...v1.2.1](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.2.0...v1.2.1)
14
+
15
+ ### Bug Fixes
16
+
17
+ * better thread safety via early initializing SSL store during HTTP client creation ([a1a17e9](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/a1a17e9b55716af2f249678eefe9e5c87bcd86a6))
18
+
19
+
20
+ ### Chores
21
+
22
+ * bump dependency version and update sorbet types ([04396d9](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/04396d9a1b72850230d84581fc3339e6cecdcd22))
23
+
3
24
  ## 1.2.0 (2025-10-25)
4
25
 
5
26
  Full Changelog: [v1.1.0...v1.2.0](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.1.0...v1.2.0)
data/README.md CHANGED
@@ -26,7 +26,7 @@ The REST API documentation can be found on [sportsgameodds.com](https://sportsga
26
26
  Add to your application's `Gemfile`:
27
27
 
28
28
  ```ruby
29
- gem "sports-odds-api", "~> 1.2.0"
29
+ gem "sports-odds-api", "~> 1.2.2"
30
30
  ```
31
31
 
32
32
  Or install manually:
@@ -201,7 +201,8 @@ module SportsOddsAPI
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
  )
@@ -224,6 +225,11 @@ module SportsOddsAPI
224
225
  # @return [Hash{String=>String}]
225
226
  private def auth_query = {}
226
227
 
228
+ # @api private
229
+ #
230
+ # @return [String]
231
+ private def user_agent = "#{self.class.name}/Ruby #{SportsOddsAPI::VERSION}"
232
+
227
233
  # @api private
228
234
  #
229
235
  # @return [String]
@@ -16,10 +16,11 @@ module SportsOddsAPI
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 SportsOddsAPI
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 SportsOddsAPI
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 SportsOddsAPI
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 SportsOddsAPI
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.2"
5
5
  end
@@ -3,12 +3,14 @@
3
3
  # Standard libraries.
4
4
  # rubocop:disable Lint/RedundantRequireStatement
5
5
  require "English"
6
+ require "base64"
6
7
  require "cgi"
7
8
  require "date"
8
9
  require "erb"
9
10
  require "etc"
10
11
  require "json"
11
12
  require "net/http"
13
+ require "openssl"
12
14
  require "pathname"
13
15
  require "rbconfig"
14
16
  require "securerandom"
data/manifest.yaml CHANGED
@@ -1,11 +1,13 @@
1
1
  dependencies:
2
2
  - English
3
+ - base64
3
4
  - cgi
4
5
  - date
5
6
  - erb
6
7
  - etc
7
8
  - json
8
9
  - net/http
10
+ - openssl
9
11
  - pathname
10
12
  - rbconfig
11
13
  - securerandom
@@ -185,6 +185,11 @@ module SportsOddsAPI
185
185
  private def auth_query
186
186
  end
187
187
 
188
+ # @api private
189
+ sig { returns(String) }
190
+ private def user_agent
191
+ end
192
+
188
193
  # @api private
189
194
  sig { returns(String) }
190
195
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module SportsOddsAPI
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 SportsOddsAPI
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: SportsOddsAPI::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -282,9 +282,13 @@ module SportsOddsAPI
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
+ SportsOddsAPI::Internal::Type::BaseModel
290
+ )
291
+ ).returns(T.attached_class)
288
292
  end
289
293
  def self.new(data = {})
290
294
  end
@@ -89,6 +89,8 @@ module SportsOddsAPI
89
89
 
90
90
  private def auth_query: -> ::Hash[String, String]
91
91
 
92
+ private def user_agent: -> String
93
+
92
94
  private def generate_idempotency_key: -> String
93
95
 
94
96
  private def build_request: (
@@ -17,7 +17,10 @@ module SportsOddsAPI
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: sports-odds-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sports Game Odds
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-25 00:00:00.000000000 Z
11
+ date: 2025-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool