steam_api_client 1.3.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: 63721ffd174da8e4b24173f6507837633cf1930945bb2378228a04cced136099
4
- data.tar.gz: 1f4d9e6348bff39b44d7c09289ce74083eebb74e620cbba9020efc1a413f9530
3
+ metadata.gz: 05561b6cbe30e78afaa9c6f67481698c938c95af7ad492b8296c88e07a2ef5bd
4
+ data.tar.gz: f14bb719c36232e629d71d80d9ba8bc3592c84855125deeb8cee9db965c3db3a
5
5
  SHA512:
6
- metadata.gz: aa49878ef1061a3b417924c89a6a8453404a70db5e5287205c1c19b3427ac9c82028574fcbfbba58a739ae0549f73222c4e5246ddf65a93687ba0a7d05168e07
7
- data.tar.gz: 65dd3ce130994fb54155f674347da656f61231c4b9025bcd84625540f19173c247a809a92a1eab223ae6daf2f5470b7e2c481a9778c7c1918189b1a9f447a5ba
6
+ metadata.gz: a8c5a13773d8f57a6bb124adaae1d3dc282026cda3ec066900fb461fdd23b773617f3953b46f8b9715d8881eb9833434ee2101e1044e9f9aafd14cfe3dcb5299
7
+ data.tar.gz: 3a7ff5be8ca4685d81203f58182c769297390803406ce97b9512572b2cbd1a5e31a1fe55665bc58be07426d47d5981b7d7deac889ad7777a668d782b3f42a0c2
data/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.5.0] - 2026-11-04
10
+
11
+ ### Added
12
+
13
+ - `player_bans` and `player_badges`: VAC, game, community and trade ban status of up to 100 players, and a player's badges and level progress (#106).
14
+
15
+ ## [1.4.0] - 2026-11-04
16
+
17
+ ### Added
18
+
19
+ - `app_schema`: the achievements and stats an app defines, with display names, descriptions, icons and the hidden flag (#105).
20
+
9
21
  ## [1.3.0] - 2026-11-02
10
22
 
11
23
  ### Added
@@ -216,7 +228,9 @@ The versions below were bumped in `version.rb` during development but **never pu
216
228
 
217
229
  - Initial gem skeleton.
218
230
 
219
- [Unreleased]: https://github.com/jpechaves/steam_api/compare/v1.3.0...HEAD
231
+ [Unreleased]: https://github.com/jpechaves/steam_api/compare/v1.5.0...HEAD
232
+ [1.5.0]: https://github.com/jpechaves/steam_api/compare/v1.4.0...v1.5.0
233
+ [1.4.0]: https://github.com/jpechaves/steam_api/compare/v1.3.0...v1.4.0
220
234
  [1.3.0]: https://github.com/jpechaves/steam_api/compare/v1.2.0...v1.3.0
221
235
  [1.2.0]: https://github.com/jpechaves/steam_api/compare/v1.1.0...v1.2.0
222
236
  [1.1.0]: https://github.com/jpechaves/steam_api/compare/v1.0.0...v1.1.0
data/docs/USAGE.md CHANGED
@@ -191,6 +191,33 @@ stats.achievements.first # => #<data SteamApiClient::PlayerGameStats::Achievemen
191
191
 
192
192
  Stat values are Integers or Floats, as the game defines them. A private profile, or a game without stats, raises `Errors::HttpBadRequest`.
193
193
 
194
+ #### `player_bans`
195
+
196
+ 🔑 The ban status of up to 100 players. Steam leaves out IDs it doesn't know, and silently ignores IDs after the 100th.
197
+
198
+ ```ruby
199
+ client.player_bans.retrieve(steamids: [76561197960435530, 76561198000000001])
200
+ # => [#<data SteamApiClient::PlayerBan steam_id=76561197960435530, community_banned=false, vac_banned=false, number_of_vac_bans=0,
201
+ # days_since_last_ban=0, number_of_game_bans=0, economy_ban="none">, ...]
202
+ ```
203
+
204
+ `days_since_last_ban` counts from the last VAC or game ban (`0` when never banned). `number_of_game_bans` are bans set by game developers. `economy_ban` is the trade ban status: `"none"`, `"probation"` or `"banned"`.
205
+
206
+ #### `player_badges`
207
+
208
+ 🔑 A player's badges and Steam level progress, or `nil` when the profile isn't public.
209
+
210
+ ```ruby
211
+ progress = client.player_badges.retrieve(steamid: 76561198000000001)
212
+ progress.player_level # => 157
213
+ progress.player_xp_needed_to_level_up # => 1530
214
+ progress.badges.first
215
+ # => #<data SteamApiClient::PlayerBadges::Badge badge_id=13, level=1280, completion_time=1787785402, xp=1530, scarcity=251922,
216
+ # app_id=nil, community_item_id=nil, border_color=nil>
217
+ ```
218
+
219
+ `scarcity` is how many players have the badge. Game (trading card) badges also have `app_id`, `community_item_id` and `border_color` (`1` for foil). Times are unix timestamps. An ID that isn't a valid SteamID raises `Errors::HttpBadRequest`.
220
+
194
221
  #### `player_wishlist`
195
222
 
196
223
  The apps on a player's wishlist. No key needed.
@@ -329,6 +356,28 @@ client.app_global_achievements.retrieve(appid: 440).first
329
356
  # => #<data SteamApiClient::GlobalAchievement name="TF_SCOUT_LONG_DISTANCE_RUNNER", percent=49.5>
330
357
  ```
331
358
 
359
+ #### `app_schema`
360
+
361
+ 🔑 The achievements and stats an app defines, with display names, descriptions and icons in the requested language. `locale:` defaults to `"english"` (Steam's language names, e.g. `"portuguese"`). `nil` when the app has neither.
362
+
363
+ ```ruby
364
+ schema = client.app_schema.retrieve(appid: 620)
365
+ schema.game_name # => "Portal 2"
366
+ schema.achievements.first
367
+ # => #<data SteamApiClient::AppSchema::Achievement name="ACH.SURVIVE_CONTAINER_RIDE", display_name="Wake Up Call",
368
+ # description="Survive the manual override", hidden=false, icon="https://...jpg", icon_gray="https://..._BW.jpg", default_value=0>
369
+ schema.stats.first # => #<data SteamApiClient::AppSchema::Stat name="PS3.SP.progress", display_name=nil, default_value=0>
370
+ ```
371
+
372
+ Achievement `name`s are the API names `player_achievements` and `app_global_achievements` return, so the schema adds display names and icons to them:
373
+
374
+ ```ruby
375
+ titles = schema.achievements.to_h { [_1.name, _1.display_name] }
376
+ client.player_achievements.retrieve(appid: 620, steamid: id).achievements.select(&:achieved).map { titles[_1.api_name] }
377
+ ```
378
+
379
+ Hidden achievements usually have no `description` (`nil`). `game_name` is often `""` or an internal name. An unknown app raises `Errors::HttpBadRequest`, and an unreleased one `Errors::HttpForbidden`.
380
+
332
381
  #### `game_current_players`
333
382
 
334
383
  The number of players in a game right now.
@@ -419,6 +468,6 @@ Don't retry other 4xx errors: they won't succeed on their own.
419
468
 
420
469
  - **Rate limits.** Steam's [Web API terms](https://steamcommunity.com/dev/apiterms) allow 100,000 calls per day per key. The Storefront API (`app_details`, `package_details`, `app_dlc`, `store_search`, `featured`, `featured_categories`) is rate limited per IP address, commonly reported at about 200 requests per 5 minutes. Both answer `429` when you go over. Cache what you can.
421
470
  - **The Storefront API is unofficial.** The Storefront endpoints use the API behind Steam's store and Big Picture mode. Valve doesn't document it, and its fields change without notice.
422
- - **Private profiles.** What a player hides depends on their privacy settings. Depending on the endpoint, Steam answers with an error (`player_achievements`: 403, `player_game_stats`: 400, `player_friends`: 401) or with empty data, which the gem returns as `nil` or `[]` (`player_owned_games`, `player_recent_games`, `player_level`, `player_wishlist`, `player_wishlist_count`, `player_followed_games`). Steam answers the same way for an empty wishlist, so the wishlist endpoints can't tell the two apart. `player_summaries` still returns the public part of the profile.
471
+ - **Private profiles.** What a player hides depends on their privacy settings. Depending on the endpoint, Steam answers with an error (`player_achievements`: 403, `player_game_stats`: 400, `player_friends`: 401) or with empty data, which the gem returns as `nil` or `[]` (`player_owned_games`, `player_recent_games`, `player_level`, `player_badges`, `player_wishlist`, `player_wishlist_count`, `player_followed_games`). Steam answers the same way for an empty wishlist, so the wishlist endpoints can't tell the two apart. `player_summaries` still returns the public part of the profile.
423
472
  - **The key is in the URL.** Steam requires `?key=...` in the query string. Treat logs of request URLs as secrets (see [Configuration](#configuration)), and [rotate your key](https://steamcommunity.com/dev/apikey) if it leaks.
424
473
  - **SteamIDs are 64 bit Integers** (e.g. `76561197960435530`). Use `player_steamid` to get one from a vanity URL.
@@ -57,6 +57,17 @@ module SteamApiClient
57
57
  }
58
58
  ),
59
59
 
60
+ # The achievements and stats an app defines => AppSchema, or nil when it has none
61
+ # @see https://steamapi.xpaw.me/#ISteamUserStats/GetSchemaForGame
62
+ Endpoint.new(
63
+ :app_schema, "ISteamUserStats/GetSchemaForGame/v0002/", returns: AppSchema, at: %i[game],
64
+ params: {
65
+ appid: param.integer,
66
+ # Language of the display names and descriptions, e.g. "portuguese"
67
+ locale: param.string(as: :l, default: "english")
68
+ }
69
+ ),
70
+
60
71
  # The apps featured on the store's front page => Featured
61
72
  # @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#featured
62
73
  Endpoint.new(
@@ -105,6 +116,20 @@ module SteamApiClient
105
116
  params: {appid: param.integer, steamid: param.integer}
106
117
  ),
107
118
 
119
+ # A player's badges and Steam level progress => PlayerBadges, or nil when the profile isn't public
120
+ # @see https://steamapi.xpaw.me/#IPlayerService/GetBadges
121
+ Endpoint.new(
122
+ :player_badges, "IPlayerService/GetBadges/v1/", returns: PlayerBadges, at: %i[response],
123
+ params: {steamid: param.integer}
124
+ ),
125
+
126
+ # Ban status of up to 100 players => [PlayerBan] (unknown IDs are left out)
127
+ # @see https://steamapi.xpaw.me/#ISteamUser/GetPlayerBans
128
+ Endpoint.new(
129
+ :player_bans, "ISteamUser/GetPlayerBans/v1/", returns: [PlayerBan], at: %i[players],
130
+ params: {steamids: param.integer_list}
131
+ ),
132
+
108
133
  # The apps a player follows in the store => [Integer] app IDs ([] when not public)
109
134
  # @see https://steamapi.xpaw.me/#IStoreService/GetGamesFollowed
110
135
  Endpoint.new(
@@ -0,0 +1,37 @@
1
+ module SteamApiClient
2
+ # Built first, then named under AppSchema below
3
+ achievement = Model.define(
4
+ # The API name, as in `player_achievements` and `app_global_achievements`
5
+ name: :string,
6
+ # In the requested language
7
+ display_name: [:string, from: :displayName],
8
+ # nil for most hidden achievements
9
+ description: [:string, optional: true],
10
+ # Hidden until unlocked
11
+ hidden: :boolean,
12
+ # Icon URLs, unlocked and locked
13
+ icon: [:string, optional: true],
14
+ icon_gray: [:string, from: :icongray, optional: true],
15
+ default_value: [:integer, from: :defaultvalue, optional: true]
16
+ )
17
+ stat = Model.define(
18
+ # A game-defined stat, as in `player_game_stats`
19
+ name: :string,
20
+ # Often the same as the name, or ""
21
+ display_name: [:string, from: :displayName, optional: true],
22
+ # Integer or Float, as Steam sends it
23
+ default_value: [:number, from: :defaultvalue, optional: true]
24
+ )
25
+
26
+ # The achievements and stats an app defines, from `app_schema`
27
+ # @see https://steamapi.xpaw.me/#ISteamUserStats/GetSchemaForGame
28
+ AppSchema = Model.define(
29
+ # Often "" or an internal name like "ValveTestApp260"
30
+ game_name: [:string, from: :gameName, optional: true],
31
+ game_version: [:string, from: :gameVersion, optional: true],
32
+ achievements: [[achievement], from: %i[availableGameStats achievements], default: []],
33
+ stats: [[stat], from: %i[availableGameStats stats], default: []]
34
+ )
35
+ AppSchema.const_set(:Achievement, achievement)
36
+ AppSchema.const_set(:Stat, stat)
37
+ end
@@ -0,0 +1,29 @@
1
+ module SteamApiClient
2
+ # Built first, then named PlayerBadges::Badge below
3
+ badge = Model.define(
4
+ badge_id: [:integer, from: :badgeid],
5
+ level: :integer,
6
+ # In unix time
7
+ completion_time: :integer,
8
+ xp: :integer,
9
+ # How many players have this badge
10
+ scarcity: :integer,
11
+ # Only for game badges (trading cards)
12
+ app_id: [:integer, from: :appid, optional: true],
13
+ community_item_id: [:integer, from: :communityitemid, optional: true],
14
+ # 1 for a foil badge
15
+ border_color: [:integer, optional: true]
16
+ )
17
+
18
+ # A player's badges and Steam level progress, from `player_badges`
19
+ # @see https://steamapi.xpaw.me/#IPlayerService/GetBadges
20
+ PlayerBadges = Model.define(
21
+ player_level: :integer,
22
+ player_xp: :integer,
23
+ # The XP where the current level starts, and what's left for the next one
24
+ player_xp_needed_current_level: :integer,
25
+ player_xp_needed_to_level_up: :integer,
26
+ badges: [[badge], default: []]
27
+ )
28
+ PlayerBadges.const_set(:Badge, badge)
29
+ end
@@ -0,0 +1,17 @@
1
+ module SteamApiClient
2
+ # A player's ban status, from `player_bans`. Steam names these keys in PascalCase.
3
+ # @see https://steamapi.xpaw.me/#ISteamUser/GetPlayerBans
4
+ PlayerBan = Model.define(
5
+ steam_id: [:integer, from: :SteamId],
6
+ # Banned from the Steam Community
7
+ community_banned: [:boolean, from: :CommunityBanned],
8
+ vac_banned: [:boolean, from: :VACBanned],
9
+ number_of_vac_bans: [:integer, from: :NumberOfVACBans],
10
+ # Days since the last VAC or game ban (0 when never banned)
11
+ days_since_last_ban: [:integer, from: :DaysSinceLastBan],
12
+ # Bans set by game developers
13
+ number_of_game_bans: [:integer, from: :NumberOfGameBans],
14
+ # Trade ban status: "none", "probation" or "banned"
15
+ economy_ban: [:string, from: :EconomyBan]
16
+ )
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SteamApiClient
4
- VERSION = "1.3.0"
4
+ VERSION = "1.5.0"
5
5
  end
@@ -23,12 +23,15 @@ require_relative "steam_api_client/errors/missing_api_token"
23
23
  require_relative "steam_api_client/errors/response_parse_error"
24
24
 
25
25
  require_relative "steam_api_client/models/player_summary"
26
+ require_relative "steam_api_client/models/player_ban"
27
+ require_relative "steam_api_client/models/player_badges"
26
28
  require_relative "steam_api_client/models/friend"
27
29
  require_relative "steam_api_client/models/game"
28
30
  require_relative "steam_api_client/models/player_achievements"
29
31
  require_relative "steam_api_client/models/player_game_stats"
30
32
  require_relative "steam_api_client/models/news_item"
31
33
  require_relative "steam_api_client/models/global_achievement"
34
+ require_relative "steam_api_client/models/app_schema"
32
35
  require_relative "steam_api_client/models/app_details"
33
36
  require_relative "steam_api_client/models/package_details"
34
37
  require_relative "steam_api_client/models/app_dlc"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Pedro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-02 00:00:00.000000000 Z
11
+ date: 2026-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -55,6 +55,7 @@ files:
55
55
  - lib/steam_api_client/model/scalars.rb
56
56
  - lib/steam_api_client/models/app_details.rb
57
57
  - lib/steam_api_client/models/app_dlc.rb
58
+ - lib/steam_api_client/models/app_schema.rb
58
59
  - lib/steam_api_client/models/featured.rb
59
60
  - lib/steam_api_client/models/featured_categories.rb
60
61
  - lib/steam_api_client/models/featured_item.rb
@@ -64,6 +65,8 @@ files:
64
65
  - lib/steam_api_client/models/news_item.rb
65
66
  - lib/steam_api_client/models/package_details.rb
66
67
  - lib/steam_api_client/models/player_achievements.rb
68
+ - lib/steam_api_client/models/player_badges.rb
69
+ - lib/steam_api_client/models/player_ban.rb
67
70
  - lib/steam_api_client/models/player_game_stats.rb
68
71
  - lib/steam_api_client/models/player_summary.rb
69
72
  - lib/steam_api_client/models/store_search_result.rb