steam_api_client 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 +4 -4
- data/CHANGELOG.md +8 -1
- data/docs/USAGE.md +28 -1
- data/lib/steam_api_client/endpoints.rb +14 -0
- data/lib/steam_api_client/models/player_badges.rb +29 -0
- data/lib/steam_api_client/models/player_ban.rb +17 -0
- data/lib/steam_api_client/version.rb +1 -1
- data/lib/steam_api_client.rb +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05561b6cbe30e78afaa9c6f67481698c938c95af7ad492b8296c88e07a2ef5bd
|
|
4
|
+
data.tar.gz: f14bb719c36232e629d71d80d9ba8bc3592c84855125deeb8cee9db965c3db3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8c5a13773d8f57a6bb124adaae1d3dc282026cda3ec066900fb461fdd23b773617f3953b46f8b9715d8881eb9833434ee2101e1044e9f9aafd14cfe3dcb5299
|
|
7
|
+
data.tar.gz: 3a7ff5be8ca4685d81203f58182c769297390803406ce97b9512572b2cbd1a5e31a1fe55665bc58be07426d47d5981b7d7deac889ad7777a668d782b3f42a0c2
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ 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
|
+
|
|
9
15
|
## [1.4.0] - 2026-11-04
|
|
10
16
|
|
|
11
17
|
### Added
|
|
@@ -222,7 +228,8 @@ The versions below were bumped in `version.rb` during development but **never pu
|
|
|
222
228
|
|
|
223
229
|
- Initial gem skeleton.
|
|
224
230
|
|
|
225
|
-
[Unreleased]: https://github.com/jpechaves/steam_api/compare/v1.
|
|
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
|
|
226
233
|
[1.4.0]: https://github.com/jpechaves/steam_api/compare/v1.3.0...v1.4.0
|
|
227
234
|
[1.3.0]: https://github.com/jpechaves/steam_api/compare/v1.2.0...v1.3.0
|
|
228
235
|
[1.2.0]: https://github.com/jpechaves/steam_api/compare/v1.1.0...v1.2.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.
|
|
@@ -441,6 +468,6 @@ Don't retry other 4xx errors: they won't succeed on their own.
|
|
|
441
468
|
|
|
442
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.
|
|
443
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.
|
|
444
|
-
- **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.
|
|
445
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.
|
|
446
473
|
- **SteamIDs are 64 bit Integers** (e.g. `76561197960435530`). Use `player_steamid` to get one from a vanity URL.
|
|
@@ -116,6 +116,20 @@ module SteamApiClient
|
|
|
116
116
|
params: {appid: param.integer, steamid: param.integer}
|
|
117
117
|
),
|
|
118
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
|
+
|
|
119
133
|
# The apps a player follows in the store => [Integer] app IDs ([] when not public)
|
|
120
134
|
# @see https://steamapi.xpaw.me/#IStoreService/GetGamesFollowed
|
|
121
135
|
Endpoint.new(
|
|
@@ -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
|
data/lib/steam_api_client.rb
CHANGED
|
@@ -23,6 +23,8 @@ 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"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: steam_api_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- João Pedro
|
|
@@ -65,6 +65,8 @@ files:
|
|
|
65
65
|
- lib/steam_api_client/models/news_item.rb
|
|
66
66
|
- lib/steam_api_client/models/package_details.rb
|
|
67
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
|
|
68
70
|
- lib/steam_api_client/models/player_game_stats.rb
|
|
69
71
|
- lib/steam_api_client/models/player_summary.rb
|
|
70
72
|
- lib/steam_api_client/models/store_search_result.rb
|