sports-odds-api 1.0.0 → 1.1.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: ed23b744aefd6897f1ffe2c1b8b6ec7d2017a5c38f9f61407e9036a64c4b539c
4
- data.tar.gz: 330d785ea83722954b4a1861bce87df552f61bf5640cd43d28a19b24ce39699b
3
+ metadata.gz: af8ba5240a10551a7d6813a7b0eda5d179e5dbd22d371219640904edcb6301dc
4
+ data.tar.gz: 316c6f763856ef2e86bbe4997acae37a89f3f652b34d9021a30c801ee46acdbe
5
5
  SHA512:
6
- metadata.gz: a294de700247d92d72620d6ecd464313dc711d36bcccba1c848dbe1ce8a7da399559a4dcb59bfe3fcaf70982c6a86423af8d45ef3cb6bc0fbcf02bdedc20337b
7
- data.tar.gz: b482d8805041a5b6d2efd02090c05f598b3b998619ba553502633be7406285304e8608f88f4c6d548b0b27d7c2a8c333639638d9faf8770757eb44fc21be5e2d
6
+ metadata.gz: cfff9c7dbda3e8b9397ce1540d99b6ad0809bf4eacdc1e00b64847d5450d4872fd37cb63017bb3f067be599ccfe34fe8b9f7c63fcc775f03289b92ab24664825
7
+ data.tar.gz: 8ba69e284efa18b87c099c5bd7d4e6a379c74c4ff9904b9724590605f8102aca7c228fc883d25e91ec0231b05979ee4aab284a81180d6db34831135a9b818b53
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 (2025-10-08)
4
+
5
+ Full Changelog: [v1.0.1...v1.1.0](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.0.1...v1.1.0)
6
+
7
+ ### Features
8
+
9
+ * test ([27c3d5b](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/27c3d5bcd939182a6e1bf55be066c160f7fbb327))
10
+
11
+ ## 1.0.1 (2025-10-01)
12
+
13
+ Full Changelog: [v1.0.0...v1.0.1](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v1.0.0...v1.0.1)
14
+
15
+ ### Bug Fixes
16
+
17
+ * always send `filename=...` for multipart requests where a file is expected ([28e1cb8](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/28e1cb8e5af175c4c0afa49da5596c939dcd9758))
18
+ * coroutine leaks from connection pool ([6c9b16e](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/6c9b16e9c830d664af77e6a25bf3110b32e60091))
19
+ * shorten multipart boundary sep to less than RFC specificed max length ([cda53c9](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/cda53c9aa624162299230dccbd47838f3e6e4e30))
20
+
21
+
22
+ ### Chores
23
+
24
+ * allow fast-format to use bsd sed as well ([de4c0f0](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/de4c0f0a2e46a2f8c1e04540a31ac7a17202d467))
25
+ * **internal:** codegen related update ([8101617](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/81016173ee5cadb07e1ea09785adbc79fa8ccf5b))
26
+ * **internal:** codegen related update ([b1186c6](https://github.com/SportsGameOdds/sports-odds-api-ruby/commit/b1186c6bee86fe8b82456612407a78f33c6a655e))
27
+
3
28
  ## 1.0.0 (2025-09-23)
4
29
 
5
30
  Full Changelog: [v0.0.1...v1.0.0](https://github.com/SportsGameOdds/sports-odds-api-ruby/compare/v0.0.1...v1.0.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.0.0"
29
+ gem "sports-odds-api", "~> 1.1.0"
30
30
  ```
31
31
 
32
32
  Or install manually:
@@ -38,18 +38,21 @@ module SportsOddsAPI
38
38
  def to_yaml(*a) = read.to_yaml(*a)
39
39
 
40
40
  # @param content [Pathname, StringIO, IO, String]
41
- # @param filename [String, nil]
41
+ # @param filename [Pathname, String, nil]
42
42
  # @param content_type [String, nil]
43
43
  def initialize(content, filename: nil, content_type: nil)
44
- @content = content
44
+ @content_type = content_type
45
45
  @filename =
46
- case content
47
- in Pathname
48
- filename.nil? ? content.basename.to_path : ::File.basename(filename)
46
+ case [filename, (@content = content)]
47
+ in [String | Pathname, _]
48
+ ::File.basename(filename)
49
+ in [nil, Pathname]
50
+ content.basename.to_path
51
+ in [nil, IO]
52
+ content.to_path
49
53
  else
50
- filename.nil? ? nil : ::File.basename(filename)
54
+ filename
51
55
  end
52
- @content_type = content_type
53
56
  end
54
57
  end
55
58
  end
@@ -134,9 +134,9 @@ module SportsOddsAPI
134
134
 
135
135
  # rubocop:disable Metrics/BlockLength
136
136
  enum = Enumerator.new do |y|
137
- with_pool(url, deadline: deadline) do |conn|
138
- next if finished
137
+ next if finished
139
138
 
139
+ with_pool(url, deadline: deadline) do |conn|
140
140
  req, closing = self.class.build_request(request) do
141
141
  self.class.calibrate_socket_timeout(conn, deadline)
142
142
  end
@@ -149,7 +149,7 @@ module SportsOddsAPI
149
149
 
150
150
  self.class.calibrate_socket_timeout(conn, deadline)
151
151
  conn.request(req) do |rsp|
152
- y << [conn, req, rsp]
152
+ y << [req, rsp]
153
153
  break if finished
154
154
 
155
155
  rsp.read_body do |bytes|
@@ -160,6 +160,8 @@ module SportsOddsAPI
160
160
  end
161
161
  eof = true
162
162
  end
163
+ ensure
164
+ conn.finish if !eof && conn&.started?
163
165
  end
164
166
  rescue Timeout::Error
165
167
  raise SportsOddsAPI::Errors::APITimeoutError.new(url: url, request: req)
@@ -168,16 +170,11 @@ module SportsOddsAPI
168
170
  end
169
171
  # rubocop:enable Metrics/BlockLength
170
172
 
171
- conn, _, response = enum.next
173
+ _, response = enum.next
172
174
  body = SportsOddsAPI::Internal::Util.fused_enum(enum, external: true) do
173
175
  finished = true
174
- tap do
175
- enum.next
176
- rescue StopIteration
177
- nil
178
- end
176
+ loop { enum.next }
179
177
  ensure
180
- conn.finish if !eof && conn&.started?
181
178
  closing&.call
182
179
  end
183
180
  [Integer(response.code), response, body]
@@ -82,17 +82,20 @@ module SportsOddsAPI
82
82
  #
83
83
  # @return [Pathname, StringIO, IO, String, Object]
84
84
  def dump(value, state:)
85
- # rubocop:disable Lint/DuplicateBranch
86
85
  case value
86
+ in StringIO | String
87
+ # https://datatracker.ietf.org/doc/html/rfc7578#section-4.2
88
+ # while not required, a filename is recommended, and in practice many servers do expect this
89
+ SportsOddsAPI::FilePart.new(value, filename: "upload")
87
90
  in IO
88
91
  state[:can_retry] = false
92
+ value.to_path.nil? ? SportsOddsAPI::FilePart.new(value, filename: "upload") : value
89
93
  in SportsOddsAPI::FilePart if value.content.is_a?(IO)
90
94
  state[:can_retry] = false
95
+ value
91
96
  else
97
+ value
92
98
  end
93
- # rubocop:enable Lint/DuplicateBranch
94
-
95
- value
96
99
  end
97
100
 
98
101
  # @api private
@@ -566,7 +566,8 @@ module SportsOddsAPI
566
566
  #
567
567
  # @return [Array(String, Enumerable<String>)]
568
568
  private def encode_multipart_streaming(body)
569
- boundary = SecureRandom.urlsafe_base64(60)
569
+ # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570
+ boundary = SecureRandom.urlsafe_base64(46)
570
571
 
571
572
  closing = []
572
573
  strio = writable_enum do |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.0"
4
+ VERSION = "1.1.0"
5
5
  end
@@ -27,7 +27,7 @@ module SportsOddsAPI
27
27
  sig do
28
28
  params(
29
29
  content: T.any(Pathname, StringIO, IO, String),
30
- filename: T.nilable(String),
30
+ filename: T.nilable(T.any(Pathname, String)),
31
31
  content_type: T.nilable(String)
32
32
  ).returns(T.attached_class)
33
33
  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,
@@ -14,7 +14,7 @@ module SportsOddsAPI
14
14
 
15
15
  def initialize: (
16
16
  Pathname | StringIO | IO | String content,
17
- ?filename: String?,
17
+ ?filename: (Pathname | String)?,
18
18
  ?content_type: String?
19
19
  ) -> void
20
20
  end
@@ -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.0
4
+ version: 1.1.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-09-23 00:00:00.000000000 Z
11
+ date: 2025-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool