steam_api_client 1.3.0 → 1.4.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: c0b06cbf7dc49fbd605cab7c84469fd11a1bde80779469db95bbe30b5867701d
4
+ data.tar.gz: 5b32661f36c1ad7495760925e0348f5778933bd647f0f876b3bdbfdcc8a621df
5
5
  SHA512:
6
- metadata.gz: aa49878ef1061a3b417924c89a6a8453404a70db5e5287205c1c19b3427ac9c82028574fcbfbba58a739ae0549f73222c4e5246ddf65a93687ba0a7d05168e07
7
- data.tar.gz: 65dd3ce130994fb54155f674347da656f61231c4b9025bcd84625540f19173c247a809a92a1eab223ae6daf2f5470b7e2c481a9778c7c1918189b1a9f447a5ba
6
+ metadata.gz: 887564c19ec25082f2498e8f55c2c316b499abd4c19d3bf00ed97206f7c2028fa81e1266649470fd6f2966aa2c39f5f99d8f5726e406d0bd52dfaa787b269c63
7
+ data.tar.gz: '04545587357f1c91db0e6fa2fb4585c029f9b363aa09c55815d8222d12c39e79190d404a22c9bf38b4df86ed6f75c251d970165a96331519fec24a0dda57de86'
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.4.0] - 2026-11-04
10
+
11
+ ### Added
12
+
13
+ - `app_schema`: the achievements and stats an app defines, with display names, descriptions, icons and the hidden flag (#105).
14
+
9
15
  ## [1.3.0] - 2026-11-02
10
16
 
11
17
  ### Added
@@ -216,7 +222,8 @@ The versions below were bumped in `version.rb` during development but **never pu
216
222
 
217
223
  - Initial gem skeleton.
218
224
 
219
- [Unreleased]: https://github.com/jpechaves/steam_api/compare/v1.3.0...HEAD
225
+ [Unreleased]: https://github.com/jpechaves/steam_api/compare/v1.4.0...HEAD
226
+ [1.4.0]: https://github.com/jpechaves/steam_api/compare/v1.3.0...v1.4.0
220
227
  [1.3.0]: https://github.com/jpechaves/steam_api/compare/v1.2.0...v1.3.0
221
228
  [1.2.0]: https://github.com/jpechaves/steam_api/compare/v1.1.0...v1.2.0
222
229
  [1.1.0]: https://github.com/jpechaves/steam_api/compare/v1.0.0...v1.1.0
data/docs/USAGE.md CHANGED
@@ -329,6 +329,28 @@ client.app_global_achievements.retrieve(appid: 440).first
329
329
  # => #<data SteamApiClient::GlobalAchievement name="TF_SCOUT_LONG_DISTANCE_RUNNER", percent=49.5>
330
330
  ```
331
331
 
332
+ #### `app_schema`
333
+
334
+ 🔑 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.
335
+
336
+ ```ruby
337
+ schema = client.app_schema.retrieve(appid: 620)
338
+ schema.game_name # => "Portal 2"
339
+ schema.achievements.first
340
+ # => #<data SteamApiClient::AppSchema::Achievement name="ACH.SURVIVE_CONTAINER_RIDE", display_name="Wake Up Call",
341
+ # description="Survive the manual override", hidden=false, icon="https://...jpg", icon_gray="https://..._BW.jpg", default_value=0>
342
+ schema.stats.first # => #<data SteamApiClient::AppSchema::Stat name="PS3.SP.progress", display_name=nil, default_value=0>
343
+ ```
344
+
345
+ Achievement `name`s are the API names `player_achievements` and `app_global_achievements` return, so the schema adds display names and icons to them:
346
+
347
+ ```ruby
348
+ titles = schema.achievements.to_h { [_1.name, _1.display_name] }
349
+ client.player_achievements.retrieve(appid: 620, steamid: id).achievements.select(&:achieved).map { titles[_1.api_name] }
350
+ ```
351
+
352
+ 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`.
353
+
332
354
  #### `game_current_players`
333
355
 
334
356
  The number of players in a game right now.
@@ -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(
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SteamApiClient
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -29,6 +29,7 @@ require_relative "steam_api_client/models/player_achievements"
29
29
  require_relative "steam_api_client/models/player_game_stats"
30
30
  require_relative "steam_api_client/models/news_item"
31
31
  require_relative "steam_api_client/models/global_achievement"
32
+ require_relative "steam_api_client/models/app_schema"
32
33
  require_relative "steam_api_client/models/app_details"
33
34
  require_relative "steam_api_client/models/package_details"
34
35
  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.4.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