sports-odds-api 1.0.1 → 1.2.0

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: 0b2d3224b7a512959a77bc026bb7db55363c95d3f3b1ff6b595b3de3da3582fe
4
- data.tar.gz: 984de9885de8b49aa3f1abffd1e1eef409db256dd171c6d9dde16cc60fa8cab2
3
+ metadata.gz: cbc29adb3f6b01cd771c2de2e42a5d4e56cdfba85adf2a4c87c85aeeed03863d
4
+ data.tar.gz: f37b381a1a5df294f47f93617a74618c2d2cd6e68e330f4100b840475218148e
5
5
  SHA512:
6
- metadata.gz: 14bf0836a12cc6de42b06f89cd54ca7b5a9fcc13673f7da6e0a8f28f6426e76742e4e8598be9ec9712d3a5a770df0d63f190d1d2ef9435b8c66de2c3d3b3e768
7
- data.tar.gz: 3d89ccf0592090be52aeb320ba0cd7a29b67d685950c8bbf6efc49aa5319354cbce9cac394802d8c9f5eb3e342f04eee1314a01d657ece0f339668429f0ec618
6
+ metadata.gz: 80e2c1ce0b64145a4f4419caea0a692978f8f92d47e2277c43429bc55b91608bde163cc2eef91c479b27fb8d21968ca79320419a9c1bc74f5f84afe064856abb
7
+ data.tar.gz: 055d3bc12991f1069d44c1803f644b4907bca175d844bfbdbeda9858adf179bd5d1bde176a069d93345a295869f7acf9ac166ffb10f944f1ff5907a9d73d2d8e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0 (2025-10-25)
4
+
5
+ Full Changelog: [v1.1.0...v1.2.0](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.1.0...v1.2.0)
6
+
7
+ ### Features
8
+
9
+ * handle thread interrupts in the core HTTP client ([c604c4c](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/c604c4ceccf001d7ea7b4c2d6147a3da778dbf7d))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * absolutely qualified uris should always override the default ([93d7577](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/93d75779f4d6b7a83501a7effb19394103206bec))
15
+ * should not reuse buffers for `IO.copy_stream` interop ([fa798db](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/fa798db8d0892a30cd4cff502dd64b89d64b6558))
16
+
17
+
18
+ ### Chores
19
+
20
+ * ignore linter error for tests having large collections ([de89b4c](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/de89b4cc4a3ab2942f4e89690f0b6ab206fdf039))
21
+
22
+ ## 1.1.0 (2025-10-08)
23
+
24
+ Full Changelog: [v1.0.1...v1.1.0](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.0.1...v1.1.0)
25
+
26
+ ### Features
27
+
28
+ * test ([27c3d5b](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/27c3d5bcd939182a6e1bf55be066c160f7fbb327))
29
+
3
30
  ## 1.0.1 (2025-10-01)
4
31
 
5
32
  Full Changelog: [v1.0.0...v1.0.1](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.0.0...v1.0.1)
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.0.1"
29
+ gem "sports-odds-api", "~> 1.2.0"
30
30
  ```
31
31
 
32
32
  Or install manually:
@@ -128,40 +128,48 @@ module SportsOddsAPI
128
128
  url, deadline = request.fetch_values(:url, :deadline)
129
129
 
130
130
  req = nil
131
- eof = false
132
131
  finished = false
133
- closing = nil
134
132
 
135
133
  # rubocop:disable Metrics/BlockLength
136
134
  enum = Enumerator.new do |y|
137
135
  next if finished
138
136
 
139
137
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
138
+ eof = false
139
+ closing = nil
140
+ ::Thread.handle_interrupt(Object => :never) do
141
+ ::Thread.handle_interrupt(Object => :immediate) do
142
+ req, closing = self.class.build_request(request) do
143
+ self.class.calibrate_socket_timeout(conn, deadline)
144
+ end
149
145
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ unless conn.started?
148
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
149
+ conn.start
150
+ end
158
151
 
159
152
  self.class.calibrate_socket_timeout(conn, deadline)
153
+ conn.request(req) do |rsp|
154
+ y << [req, rsp]
155
+ break if finished
156
+
157
+ rsp.read_body do |bytes|
158
+ y << bytes.force_encoding(Encoding::BINARY)
159
+ break if finished
160
+
161
+ self.class.calibrate_socket_timeout(conn, deadline)
162
+ end
163
+ eof = true
164
+ end
165
+ end
166
+ ensure
167
+ begin
168
+ conn.finish if !eof && conn&.started?
169
+ ensure
170
+ closing&.call
160
171
  end
161
- eof = true
162
172
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
173
  end
166
174
  rescue Timeout::Error
167
175
  raise SportsOddsAPI::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +182,6 @@ module SportsOddsAPI
174
182
  body = SportsOddsAPI::Internal::Util.fused_enum(enum, external: true) do
175
183
  finished = true
176
184
  loop { enum.next }
177
- ensure
178
- closing&.call
179
185
  end
180
186
  [Integer(response.code), response, body]
181
187
  end
@@ -346,8 +346,9 @@ module SportsOddsAPI
346
346
  base_path, base_query = lhs.fetch_values(:path, :query)
347
347
  slashed = base_path.end_with?("/") ? base_path : "#{base_path}/"
348
348
 
349
- parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query)
350
- override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path)
349
+ merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)}
350
+ parsed_path, parsed_query = merged.fetch_values(:path, :query)
351
+ override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path)
351
352
 
352
353
  joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override)
353
354
  query = deep_merge(
@@ -473,10 +474,9 @@ module SportsOddsAPI
473
474
  # @return [Enumerable<String>]
474
475
  def writable_enum(&blk)
475
476
  Enumerator.new do |y|
476
- buf = String.new
477
477
  y.define_singleton_method(:write) do
478
- self << buf.replace(_1)
479
- buf.bytesize
478
+ self << _1.dup
479
+ _1.bytesize
480
480
  end
481
481
 
482
482
  blk.call(y)
@@ -40,7 +40,6 @@ module SportsOddsAPI
40
40
  optional :players, -> { SportsOddsAPI::Internal::Type::HashOf[SportsOddsAPI::Event::Player] }
41
41
 
42
42
  # @!attribute results
43
- # Nested results in the format `<periodID>.<statEntityID>.<statID> → number`.
44
43
  #
45
44
  # @return [Hash{Symbol=>Hash{Symbol=>Hash{Symbol=>Float}}}, nil]
46
45
  optional :results,
@@ -68,27 +67,16 @@ module SportsOddsAPI
68
67
 
69
68
  # @!method initialize(activity: nil, event_id: nil, info: nil, league_id: nil, manual: nil, odds: nil, players: nil, results: nil, sport_id: nil, status: nil, teams: nil, type: nil)
70
69
  # @param activity [SportsOddsAPI::Models::Event::Activity]
71
- #
72
70
  # @param event_id [String]
73
- #
74
71
  # @param info [SportsOddsAPI::Models::Event::Info]
75
- #
76
72
  # @param league_id [String]
77
- #
78
73
  # @param manual [Boolean]
79
- #
80
74
  # @param odds [Hash{Symbol=>SportsOddsAPI::Models::Event::Odd}]
81
- #
82
75
  # @param players [Hash{Symbol=>SportsOddsAPI::Models::Event::Player}]
83
- #
84
- # @param results [Hash{Symbol=>Hash{Symbol=>Hash{Symbol=>Float}}}] Nested results in the format `<periodID>.<statEntityID>.<statID> → number`.
85
- #
76
+ # @param results [Hash{Symbol=>Hash{Symbol=>Hash{Symbol=>Float}}}]
86
77
  # @param sport_id [String]
87
- #
88
78
  # @param status [SportsOddsAPI::Models::Event::Status]
89
- #
90
79
  # @param teams [SportsOddsAPI::Models::Event::Teams]
91
- #
92
80
  # @param type [String]
93
81
 
94
82
  # @see SportsOddsAPI::Models::Event#activity
@@ -35,11 +35,17 @@ module SportsOddsAPI
35
35
  optional :ended, SportsOddsAPI::Internal::Type::Boolean
36
36
 
37
37
  # @!attribute event_id
38
- # An eventID or comma-separated list of eventIDs to get Event data for
38
+ # An eventID to get Event data for
39
39
  #
40
40
  # @return [String, nil]
41
41
  optional :event_id, String
42
42
 
43
+ # @!attribute event_ids
44
+ # A comma separated list of eventIDs to get Event data for
45
+ #
46
+ # @return [String, nil]
47
+ optional :event_ids, String
48
+
43
49
  # @!attribute finalized
44
50
  # Only include finalized Events (true), exclude unfinalized Events (false) or all
45
51
  # Events (omit)
@@ -143,7 +149,7 @@ module SportsOddsAPI
143
149
  # @return [String, nil]
144
150
  optional :type, String
145
151
 
146
- # @!method initialize(bookmaker_id: nil, cancelled: nil, cursor: nil, ended: nil, event_id: nil, finalized: nil, include_alt_lines: nil, include_opposing_odds: nil, league_id: nil, limit: nil, live: nil, odd_id: nil, odds_available: nil, odds_present: nil, player_id: nil, sport_id: nil, started: nil, starts_after: nil, starts_before: nil, team_id: nil, type: nil, request_options: {})
152
+ # @!method initialize(bookmaker_id: nil, cancelled: nil, cursor: nil, ended: nil, event_id: nil, event_ids: nil, finalized: nil, include_alt_lines: nil, include_opposing_odds: nil, league_id: nil, limit: nil, live: nil, odd_id: nil, odds_available: nil, odds_present: nil, player_id: nil, sport_id: nil, started: nil, starts_after: nil, starts_before: nil, team_id: nil, type: nil, request_options: {})
147
153
  # Some parameter documentations has been truncated, see
148
154
  # {SportsOddsAPI::Models::EventGetParams} for more details.
149
155
  #
@@ -155,7 +161,9 @@ module SportsOddsAPI
155
161
  #
156
162
  # @param ended [Boolean] Only include Events which have have ended (true), only Events which have not end
157
163
  #
158
- # @param event_id [String] An eventID or comma-separated list of eventIDs to get Event data for
164
+ # @param event_id [String] An eventID to get Event data for
165
+ #
166
+ # @param event_ids [String] A comma separated list of eventIDs to get Event data for
159
167
  #
160
168
  # @param finalized [Boolean] Only include finalized Events (true), exclude unfinalized Events (false) or all
161
169
  #
@@ -8,7 +8,7 @@ module SportsOddsAPI
8
8
  #
9
9
  # Get a list of Events
10
10
  #
11
- # @overload get(bookmaker_id: nil, cancelled: nil, cursor: nil, ended: nil, event_id: nil, finalized: nil, include_alt_lines: nil, include_opposing_odds: nil, league_id: nil, limit: nil, live: nil, odd_id: nil, odds_available: nil, odds_present: nil, player_id: nil, sport_id: nil, started: nil, starts_after: nil, starts_before: nil, team_id: nil, type: nil, request_options: {})
11
+ # @overload get(bookmaker_id: nil, cancelled: nil, cursor: nil, ended: nil, event_id: nil, event_ids: nil, finalized: nil, include_alt_lines: nil, include_opposing_odds: nil, league_id: nil, limit: nil, live: nil, odd_id: nil, odds_available: nil, odds_present: nil, player_id: nil, sport_id: nil, started: nil, starts_after: nil, starts_before: nil, team_id: nil, type: nil, request_options: {})
12
12
  #
13
13
  # @param bookmaker_id [String] A bookmakerID or comma-separated list of bookmakerIDs to include odds for
14
14
  #
@@ -18,7 +18,9 @@ module SportsOddsAPI
18
18
  #
19
19
  # @param ended [Boolean] Only include Events which have have ended (true), only Events which have not end
20
20
  #
21
- # @param event_id [String] An eventID or comma-separated list of eventIDs to get Event data for
21
+ # @param event_id [String] An eventID to get Event data for
22
+ #
23
+ # @param event_ids [String] A comma separated list of eventIDs to get Event data for
22
24
  #
23
25
  # @param finalized [Boolean] Only include finalized Events (true), exclude unfinalized Events (false) or all
24
26
  #
@@ -65,6 +67,7 @@ module SportsOddsAPI
65
67
  query: parsed.transform_keys(
66
68
  bookmaker_id: "bookmakerID",
67
69
  event_id: "eventID",
70
+ event_ids: "eventIDs",
68
71
  include_alt_lines: "includeAltLines",
69
72
  include_opposing_odds: "includeOpposingOdds",
70
73
  league_id: "leagueID",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SportsOddsAPI
4
- VERSION = "1.0.1"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -56,7 +56,6 @@ module SportsOddsAPI
56
56
  end
57
57
  attr_writer :players
58
58
 
59
- # Nested results in the format `<periodID>.<statEntityID>.<statID> → number`.
60
59
  sig do
61
60
  returns(
62
61
  T.nilable(T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Float]]])
@@ -119,7 +118,6 @@ module SportsOddsAPI
119
118
  manual: nil,
120
119
  odds: nil,
121
120
  players: nil,
122
- # Nested results in the format `<periodID>.<statEntityID>.<statID> → number`.
123
121
  results: nil,
124
122
  sport_id: nil,
125
123
  status: nil,
@@ -42,13 +42,20 @@ module SportsOddsAPI
42
42
  sig { params(ended: T::Boolean).void }
43
43
  attr_writer :ended
44
44
 
45
- # An eventID or comma-separated list of eventIDs to get Event data for
45
+ # An eventID to get Event data for
46
46
  sig { returns(T.nilable(String)) }
47
47
  attr_reader :event_id
48
48
 
49
49
  sig { params(event_id: String).void }
50
50
  attr_writer :event_id
51
51
 
52
+ # A comma separated list of eventIDs to get Event data for
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :event_ids
55
+
56
+ sig { params(event_ids: String).void }
57
+ attr_writer :event_ids
58
+
52
59
  # Only include finalized Events (true), exclude unfinalized Events (false) or all
53
60
  # Events (omit)
54
61
  sig { returns(T.nilable(T::Boolean)) }
@@ -175,6 +182,7 @@ module SportsOddsAPI
175
182
  cursor: String,
176
183
  ended: T::Boolean,
177
184
  event_id: String,
185
+ event_ids: String,
178
186
  finalized: T::Boolean,
179
187
  include_alt_lines: T::Boolean,
180
188
  include_opposing_odds: T::Boolean,
@@ -206,8 +214,10 @@ module SportsOddsAPI
206
214
  # Only include Events which have have ended (true), only Events which have not
207
215
  # ended (false) or all Events (omit)
208
216
  ended: nil,
209
- # An eventID or comma-separated list of eventIDs to get Event data for
217
+ # An eventID to get Event data for
210
218
  event_id: nil,
219
+ # A comma separated list of eventIDs to get Event data for
220
+ event_ids: nil,
211
221
  # Only include finalized Events (true), exclude unfinalized Events (false) or all
212
222
  # Events (omit)
213
223
  finalized: nil,
@@ -259,6 +269,7 @@ module SportsOddsAPI
259
269
  cursor: String,
260
270
  ended: T::Boolean,
261
271
  event_id: String,
272
+ event_ids: String,
262
273
  finalized: T::Boolean,
263
274
  include_alt_lines: T::Boolean,
264
275
  include_opposing_odds: T::Boolean,
@@ -11,6 +11,7 @@ module SportsOddsAPI
11
11
  cursor: String,
12
12
  ended: T::Boolean,
13
13
  event_id: String,
14
+ event_ids: String,
14
15
  finalized: T::Boolean,
15
16
  include_alt_lines: T::Boolean,
16
17
  include_opposing_odds: T::Boolean,
@@ -42,8 +43,10 @@ module SportsOddsAPI
42
43
  # Only include Events which have have ended (true), only Events which have not
43
44
  # ended (false) or all Events (omit)
44
45
  ended: nil,
45
- # An eventID or comma-separated list of eventIDs to get Event data for
46
+ # An eventID to get Event data for
46
47
  event_id: nil,
48
+ # A comma separated list of eventIDs to get Event data for
49
+ event_ids: nil,
47
50
  # Only include finalized Events (true), exclude unfinalized Events (false) or all
48
51
  # Events (omit)
49
52
  finalized: nil,
@@ -7,6 +7,7 @@ module SportsOddsAPI
7
7
  cursor: String,
8
8
  ended: bool,
9
9
  event_id: String,
10
+ event_ids: String,
10
11
  finalized: bool,
11
12
  include_alt_lines: bool,
12
13
  include_opposing_odds: bool,
@@ -50,6 +51,10 @@ module SportsOddsAPI
50
51
 
51
52
  def event_id=: (String) -> String
52
53
 
54
+ attr_reader event_ids: String?
55
+
56
+ def event_ids=: (String) -> String
57
+
53
58
  attr_reader finalized: bool?
54
59
 
55
60
  def finalized=: (bool) -> bool
@@ -120,6 +125,7 @@ module SportsOddsAPI
120
125
  ?cursor: String,
121
126
  ?ended: bool,
122
127
  ?event_id: String,
128
+ ?event_ids: String,
123
129
  ?finalized: bool,
124
130
  ?include_alt_lines: bool,
125
131
  ?include_opposing_odds: bool,
@@ -145,6 +151,7 @@ module SportsOddsAPI
145
151
  cursor: String,
146
152
  ended: bool,
147
153
  event_id: String,
154
+ event_ids: String,
148
155
  finalized: bool,
149
156
  include_alt_lines: bool,
150
157
  include_opposing_odds: bool,
@@ -7,6 +7,7 @@ module SportsOddsAPI
7
7
  ?cursor: String,
8
8
  ?ended: bool,
9
9
  ?event_id: String,
10
+ ?event_ids: String,
10
11
  ?finalized: bool,
11
12
  ?include_alt_lines: bool,
12
13
  ?include_opposing_odds: bool,
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.0.1
4
+ version: 1.2.0
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-01 00:00:00.000000000 Z
11
+ date: 2025-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool