sleeper_api 1.4.0 → 1.5.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: c89b9383f35e517efd9ce353f9c14b1463f37375cc7dc4c30310c5c57370cdab
4
- data.tar.gz: 336f7a25653bdbad75ec3094d150389fb5abba4244ef80ffbe97ce702e6a7ce9
3
+ metadata.gz: 0fdd2ef6194210448caf049cdd89a37182bcd13205e45ea9543945c172d36fd4
4
+ data.tar.gz: 811a0991f5c863956c62c637971571aef98ccd379f9a3bff4b33ad1d28405290
5
5
  SHA512:
6
- metadata.gz: 49c0c6f2843e597c53cf8c8c548a348f7c03255e6a38306a8e43190523f2ad485125145e9dc844b4f6b1ea326b74286e8a26cffa34c8c8522caeb70822477f0b
7
- data.tar.gz: 45c2ebd6bc9b2e9ef3cd4f5f53c6635cd00f8199f9f5da7d0061d740c99f27aa94a1894ac682d072fb542e5c0498996ba799d1ee8c094689281188befdce33f3
6
+ metadata.gz: 16f575a6d822157d44b7d5aef135626371e0fb03ed8359c70abf82f49bf6d9ae1373ff7a5ee49cbf4c32986593eec23e838b08e70ce5306e29d5fb3df5229be4
7
+ data.tar.gz: b7b325b17bfd0c9d921ec16dbaa07fdcf6f277d242732db1f414d11f0c5846664ac300c2fc64f2401a3ef54402c112b8a9e89651f986ba3628a5fdcabc38f394
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ ## [1.5.0] - 2026-09-25
2
+
3
+ ### Added
4
+
5
+ - **`Client#scores(season, week = nil)` — games with their kickoff times.** Each
6
+ game carries `start_time`, epoch milliseconds, which is **the only kickoff
7
+ time Sleeper publishes**: `#schedule` has a `date` and nothing finer. Measured
8
+ 2026-09-25 against ATL @ GB, the previous night's Thursday game — its
9
+ `start_time` is 2026-09-25T00:15Z and agrees with `metadata.date_time` on
10
+ every game of the week.
11
+
12
+ ⚠️ **Also on `api.sleeper.com`**, like `#stats_with_context`, and with a
13
+ different shape: the season type is a **path segment**
14
+ (`/scores/nfl/regular/2026/3`), and the query-parameter form answers 200 with
15
+ nothing.
16
+
17
+ **Leave the week off for the whole season** — all 272 games of 2026 in one
18
+ ~610 KB call (~93 KB gzipped), against ~57 KB a week. `metadata` is the live
19
+ game (`quarter`, `time_remaining`, quarter scores, `is_in_progress`) plus the
20
+ TV channel, spread and forecast. Its `status` vocabulary (`scheduled`,
21
+ `closed`) differs from the top level's (`pre_game`, `complete`), and neither
22
+ value a live game carries has been read yet. Nothing 404s: week 19 and a
23
+ garbage season type answer `[]`.
24
+
1
25
  ## [1.4.0] - 2026-09-14
2
26
 
3
27
  ### Added
data/CLAUDE.md CHANGED
@@ -46,6 +46,11 @@ Four layers, with a deliberate split between HTTP and modeling:
46
46
  default**, because `/stats/nfl/2021/16` is a real path on both and they
47
47
  return different things; paths on `.app` quote exactly as they did before.
48
48
 
49
+ v1.5.0 added a second `WEB_HOST` endpoint, `#scores`, the only source of a
50
+ **kickoff time** — and its season type is a path segment where
51
+ `#stats_with_context` takes a query parameter. The host does not have one
52
+ convention; each path is measured on its own.
53
+
49
54
  **When an endpoint almost has what you need, try the other host before
50
55
  concluding the data does not exist.** Four epics of stats work in the
51
56
  consuming app never surfaced the per-week team, because the documented-looking
@@ -340,6 +340,43 @@ module SleeperApi
340
340
  make_request("/stats/#{segments.join("/")}?season_type=#{query}", host: WEB_HOST)
341
341
  end
342
342
 
343
+ # Get games with their kickoff times — undocumented, on the web host.
344
+ #
345
+ # **The only kickoff time Sleeper publishes.** #schedule carries a `date`
346
+ # and nothing finer; each game here has `start_time`, epoch milliseconds —
347
+ # 2026's Thursday opener of week 3, ATL @ GB, is 1790295300000, which is
348
+ # 2026-09-25T00:15Z and agrees with `metadata.date_time` on every game.
349
+ # Measured 2026-09-25, the morning after that game.
350
+ #
351
+ # `metadata` is the live game: `quarter`, `time_remaining`, the score by
352
+ # quarter, `is_in_progress`, `is_over`, plus the TV `channel`, the spread and
353
+ # a forecast. Its `status` is a different vocabulary from the top level's —
354
+ # `scheduled`/`closed` against `pre_game`/`complete` — and neither value a
355
+ # live game carries has been read here yet. Match with a fallback.
356
+ #
357
+ # **Leave the week off for the whole season** — all 272 games of 2026 in one
358
+ # call, ~610 KB (~93 KB gzipped), against ~57 KB a week. Unlike
359
+ # #stats_with_context, the season form is useful.
360
+ #
361
+ # The season type is a **path segment**, not a query parameter —
362
+ # `/scores/nfl/2026/3?season_type=regular` answers 200 with nothing. Shares
363
+ # the host's traps: nothing 404s (week 19, a garbage season type all answer
364
+ # `200` with `[]`), and `pre`/`post` restart week numbering.
365
+ #
366
+ # @param season [Integer, String] Season year, e.g. 2026
367
+ # @param week [Integer, String, nil] Week number; nil for the whole season
368
+ # @param season_type [String] "regular" (default), "pre", or "post"
369
+ # @param sport [String] Sport code (default: "nfl")
370
+ # @return [HTTParty::Response] Array of games, each with `game_id`, `week`,
371
+ # `status`, `start_time`, `date` and a nested `metadata`
372
+ def scores(season, week = nil, season_type: "regular", sport: "nfl")
373
+ segments = [sport, season_type, season, week].compact.map do |segment|
374
+ ERB::Util.url_encode(segment.to_s)
375
+ end
376
+
377
+ make_request("/scores/#{segments.join("/")}", host: WEB_HOST)
378
+ end
379
+
343
380
  # Get a season's game schedule.
344
381
  #
345
382
  # Undocumented, and served from the host root rather than /v1 — hence the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SleeperApi
4
- VERSION = "1.4.0"
4
+ VERSION = "1.5.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sleeper_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eruity1