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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92a31d66b4e0b110e6daf96f0689fdcc626b341bc7550ac8f1d982eaae8796bf
4
- data.tar.gz: 14b9b6d090c28a8087edb9a45d61eadeae4c8fd6027995b206456cc45c95c9f5
3
+ metadata.gz: 8e64262b5b1ec981daba5a470cdaed3857b5b334b4b5b974b36369bb71d10fe6
4
+ data.tar.gz: 6e292f1ff2de695f2385736316d1d0329373cdfb8d944d399e42ffcda7014d2d
5
5
  SHA512:
6
- metadata.gz: d24b6c42b978e3a14c70ff6c9db5c08f6747ff73c64206ccb8a7374741b56e6f034a9451a03f4d93670743414a5c30011c311a709a02743219f593e9cf8299e1
7
- data.tar.gz: 16e2f0ab8bb4fa2053cc01f0e35b4a3a6e2bde9d8a55173b8781329378323045da0c826711a33c13117ccb8e17e58b04572c34591d9e123235f21d2378ee51d9
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 pushes to rubygems. Update `CHANGELOG.md` first.
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
- v1.0.0 is published with six bugs that are fixed in the working tree but not yet released see the unreleased section of `CHANGELOG.md`. Consumers on the published gem still hit them.
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.
@@ -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&.dig("fpts"),
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["co_owner"],
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SleeperApi
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.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.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eruity1