sleeper_api 1.7.0 → 1.8.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: 764f1f24badfe4fbb8f017956f376a7e5604561d4d386e01a2ca77cf2174ddb8
4
- data.tar.gz: 2616db091ddd38b8e942dce78929f8e56e2ad75de4e0bc5b5b5d52b7697bbddd
3
+ metadata.gz: da00a42dc3d3fa73feab8e1c2278f0cdcf7a274b12709c540c2f988782828269
4
+ data.tar.gz: 8b2fc35f6dd3a3b546cafae1679ac0dbca75193d7886fcb12b57c5bf616da667
5
5
  SHA512:
6
- metadata.gz: aea41e6b36a4cad02e526d35b0de424a32b20ce59d8d683bf8eccdd366669053c037c7ae6d2be6151031018c06d5b8d717733c8f941d3f9e7ab5bb6feb19cdb9
7
- data.tar.gz: 2348a7481c68aaab18441ddf0096a02b5a4dc3a409ae7d7d1c90365af6139d1bdc919c62a9c9ab247c973c2bb03a7e989f17167ae3c5d23bdd95c2fc17ccf5a8
6
+ metadata.gz: c953ad4e95e986db6ef5f6f559a7cf464a9cdeaf98ccf83e4cb25f1e99008152066e5b15ad7b852de444a13fafd81b795d6b338b5ced2cebe3e9710223aa966a
7
+ data.tar.gz: 4ccdabb09c1bd25a39e7f32ce6cd97c58b5237b8c18f9a030aa3d9307f26b0f736cd63cf6f3f9cfb6381305aa0f9b0b8cc038431f06bd52d37f3c74bb5edb75d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [1.8.0] - 2026-10-02
2
+
3
+ ### Added
4
+
5
+ - **`Client#player_news(player_id, sport: "nfl", limit: 10)`** fetches one
6
+ player's recent news from the undocumented
7
+ `api.sleeper.com/players/{sport}/{id}/news`, newest first: RotoWire,
8
+ FantasyPros and RotoBaller items with a `metadata` title, description and
9
+ usually an analysis. Measured 2026-10-02: Sleeper returns at most 10 whatever
10
+ the limit, there is no paging, and an unknown id answers `200` with `[]`. The
11
+ path exists on the web host only.
12
+
1
13
  ## [1.7.0] - 2026-10-02
2
14
 
3
15
  ### Added
data/CLAUDE.md CHANGED
@@ -70,7 +70,7 @@ Four layers, with a deliberate split between HTTP and modeling:
70
70
 
71
71
  **Guard nil defensively.** Sleeper omits fields freely — users without `metadata`, rosters without `players`, matchups without `points`. Real leagues hit these; the spec fixtures often don't. Use `&.dig` rather than `[]` on anything nested off an API response.
72
72
 
73
- **Never fan out `get_players`.** It's a multi-megabyte payload of every NFL player. It's cached for 24h in an ivar on the client instance — which means the cache dies with the client. Consumers holding a short-lived client re-download it every time. For one player, `#player(id)` fetches `/v1/players/nfl/{id}` live (~1.2 KB, undocumented, uncached); an unknown id is a **404** there, not the `200`/`null` an unknown user gets, and becomes `PlayerNotFound`.
73
+ **Never fan out `get_players`.** It's a multi-megabyte payload of every NFL player. It's cached for 24h in an ivar on the client instance — which means the cache dies with the client. Consumers holding a short-lived client re-download it every time. For one player, `#player(id)` fetches `/v1/players/nfl/{id}` live (~1.2 KB, undocumented, uncached); an unknown id is a **404** there, not the `200`/`null` an unknown user gets, and becomes `PlayerNotFound`. `#player_news(id)` is that player's news on `WEB_HOST` only (`.app` 404s the path): at most 10 items whatever `limit` says, and an unknown id is `200` with `[]`, not a 404.
74
74
 
75
75
  ### Undocumented endpoints carry undocumented vocabularies
76
76
 
data/README.md CHANGED
@@ -252,6 +252,11 @@ puts "#{player['first_name']} #{player['last_name']} - #{player['position']}"
252
252
  fresh = client.player("1234")
253
253
  puts "#{fresh['injury_status']} (#{fresh['injury_body_part']})"
254
254
 
255
+ # One player's recent news, newest first (at most 10, from api.sleeper.com)
256
+ client.player_news("1234").each do |item|
257
+ puts "#{item['source']}: #{item.dig('metadata', 'title')}"
258
+ end
259
+
255
260
  # Get trending players
256
261
  trending_adds = client.trending_players(type: "add", limit: 10)
257
262
  trending_drops = client.trending_players(type: "drop", limit: 10)
@@ -487,6 +487,20 @@ module SleeperApi
487
487
  not_found: -> { PlayerNotFound.new("No Sleeper player #{player_id.to_s.inspect}") })
488
488
  end
489
489
 
490
+ # One player's recent news, newest first: RotoWire, FantasyPros and
491
+ # RotoBaller items, each with a `metadata` title, description and usually
492
+ # an analysis. Undocumented and on WEB_HOST only; Sleeper returns at most
493
+ # 10 whatever the limit, and an unknown id answers 200 with [].
494
+ #
495
+ # @param player_id [String] Player ID
496
+ # @param sport [String] Sport code (default: "nfl")
497
+ # @param limit [Integer] How many items, up to 10
498
+ # @return [HTTParty::Response] The items, newest first
499
+ def player_news(player_id, sport: "nfl", limit: 10)
500
+ query = URI.encode_www_form(limit: limit)
501
+ make_request("#{path("players", sport, player_id, "news")}?#{query}", host: WEB_HOST)
502
+ end
503
+
490
504
  private
491
505
 
492
506
  # Every request path is built here, from escaped segments. An unescaped
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SleeperApi
4
- VERSION = "1.7.0"
4
+ VERSION = "1.8.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.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eruity1