sleeper_api 1.0.1 → 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 +4 -4
- data/CHANGELOG.md +11 -0
- data/CLAUDE.md +6 -2
- data/lib/sleeper_api/league.rb +18 -2
- data/lib/sleeper_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e64262b5b1ec981daba5a470cdaed3857b5b334b4b5b974b36369bb71d10fe6
|
|
4
|
+
data.tar.gz: 6e292f1ff2de695f2385736316d1d0329373cdfb8d944d399e42ffcda7014d2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcad44e534d0f99daa36897d56b228e432e5374d9e829915fed7cc71612588b9576a96147cedb07cc658cd0a590769161ccd74ef82f48ed7d1b0c2d7dc210e88
|
|
7
|
+
data.tar.gz: ca0a00e724c6b35182add239a7a80c9b8129c3a1af2805f216f21b50971842fa968a1c902ab97686819c676390ef89e3fa0fb4635013d9f3f8f7c5aec565d7e6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [1.1.0] - 2026-08-22
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- `League#rosters` truncated every score. Sleeper splits a score across two integer fields — `fpts: 1617` with `fpts_decimal: 78` is 1617.78 — and `total_points` read `fpts` alone. The loss was invisible because what remained was still a plausible score, and no fixture carried a `fpts_decimal` to catch it. **This changes `total_points` from an Integer to a Float** for any roster whose score has a fractional part.
|
|
6
|
+
- `League#rosters` returned `co_owners: nil` for every roster, always. It read `roster["co_owner"]`, singular; no Sleeper payload has ever contained that key. Now reads the plural spelling, and still yields `nil` when the field is absent — Sleeper's documented roster object does not include co-owners, though the published docs are partial (the league `settings` object is rendered only as `{ settings object }`).
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- `League#rosters` now returns `points_against`, combining `fpts_against` with `fpts_against_decimal` the same way. Previously reachable only by digging into the raw `settings` hash that passes through wholesale.
|
|
11
|
+
|
|
1
12
|
## [1.0.1] - 2026-08-12
|
|
2
13
|
|
|
3
14
|
### Fixed
|
data/CLAUDE.md
CHANGED
|
@@ -54,6 +54,10 @@ RSpec + WebMock, with `WebMock.disable_net_connect!` — **specs must never hit
|
|
|
54
54
|
|
|
55
55
|
## Release
|
|
56
56
|
|
|
57
|
-
Version lives in `lib/sleeper_api/version.rb`. `bundle exec rake release` tags and
|
|
57
|
+
Version lives in `lib/sleeper_api/version.rb`. Update `CHANGELOG.md`, then `bundle exec rake release` from a clean `main`, which builds to `pkg/`, tags, pushes the tag, and uploads to rubygems.
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
**The API key needs the `push_rubygem` scope.** `gem signin` defaults to `index_rubygems` only — read access — and answering `n` to "Do you want to customise scopes?" produces a key that fails the upload with `This API key cannot perform the specified action on this gem`. Answer `y` and enable `push_rubygem`, or edit the key's scopes at https://rubygems.org/profile/api_keys. Credentials land in `~/.local/share/gem/credentials` (the XDG path, not `~/.gem/credentials`).
|
|
60
|
+
|
|
61
|
+
**`rake release` is not atomic.** It tags and pushes the tag *before* uploading, so a failed upload leaves the tag published and the gem unreleased. Recovering means `gem push pkg/sleeper_api-<version>.gem` on the existing artifact — re-running `rake release` fails on the tag that already exists.
|
|
62
|
+
|
|
63
|
+
Consumers do not get a fix until it is published *and* they bump their lockfile.
|
data/lib/sleeper_api/league.rb
CHANGED
|
@@ -281,7 +281,8 @@ module SleeperApi
|
|
|
281
281
|
injured_reserve: roster["reserve"] || [],
|
|
282
282
|
taxi: roster["taxi"] || [],
|
|
283
283
|
bench: (roster["players"] || []) - (roster["starters"] || []) - (roster["reserve"] || []) - (roster["taxi"] || []),
|
|
284
|
-
total_points: roster_settings
|
|
284
|
+
total_points: combined_points(roster_settings, "fpts"),
|
|
285
|
+
points_against: combined_points(roster_settings, "fpts_against"),
|
|
285
286
|
wins: roster_settings&.dig("wins"),
|
|
286
287
|
ties: roster_settings&.dig("ties"),
|
|
287
288
|
losses: roster_settings&.dig("losses"),
|
|
@@ -290,7 +291,7 @@ module SleeperApi
|
|
|
290
291
|
faab_used: roster_settings&.dig("waiver_budget_used"),
|
|
291
292
|
waiver_position: roster_settings&.dig("waiver_position"),
|
|
292
293
|
streak: roster_metadata&.dig("streak"),
|
|
293
|
-
co_owners: roster["
|
|
294
|
+
co_owners: roster["co_owners"],
|
|
294
295
|
keepers: roster["keepers"],
|
|
295
296
|
players_map: roster["player_map"],
|
|
296
297
|
players: roster["players"],
|
|
@@ -300,6 +301,21 @@ module SleeperApi
|
|
|
300
301
|
end
|
|
301
302
|
end
|
|
302
303
|
|
|
304
|
+
# Sleeper splits a score across two integer fields: fpts 1617 with
|
|
305
|
+
# fpts_decimal 78 is 1617.78. Reading fpts alone truncates every score in
|
|
306
|
+
# the league, and the loss is invisible because what remains is still a
|
|
307
|
+
# plausible number.
|
|
308
|
+
#
|
|
309
|
+
# Recombined as (whole * 100 + fraction) / 100.0 rather than
|
|
310
|
+
# whole + fraction / 100.0 — the latter accumulates two rounding steps and
|
|
311
|
+
# lands on 1617.7800000000002.
|
|
312
|
+
def combined_points(settings, key)
|
|
313
|
+
whole = settings&.dig(key)
|
|
314
|
+
return nil if whole.nil?
|
|
315
|
+
|
|
316
|
+
((whole * 100) + (settings["#{key}_decimal"] || 0)) / 100.0
|
|
317
|
+
end
|
|
318
|
+
|
|
303
319
|
def format_matchups(week)
|
|
304
320
|
week_matchups = @matchups[week] || []
|
|
305
321
|
return [] if week_matchups.empty?
|
data/lib/sleeper_api/version.rb
CHANGED