steam_api_client 1.2.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: '09f9edc74aff7de3fa4975dca173fd7a3388ea4a732671b67db45e09de6a06e5'
4
- data.tar.gz: 92bbc4d8b4214e32fb2c8d5e8e5a18a3e6844712b4cf916552f02a46a96ec82b
3
+ metadata.gz: c0b06cbf7dc49fbd605cab7c84469fd11a1bde80779469db95bbe30b5867701d
4
+ data.tar.gz: 5b32661f36c1ad7495760925e0348f5778933bd647f0f876b3bdbfdcc8a621df
5
5
  SHA512:
6
- metadata.gz: 87a2e53bcd76c574b6f6389071a5156073ad893734ef79377fb34c48406f120652dd93e0a4d8f79b2bd54b5984c6415a5a55e618839ba330d7febb6415c76af8
7
- data.tar.gz: 3ee3b3c3059e76060a40f63a14bfabd9881983f077f438c8ea90a239d6efeb89602cfed40c7022dfec6225b8b6578508f8821abecae7b4e7287ba0dd261fc60b
6
+ metadata.gz: 887564c19ec25082f2498e8f55c2c316b499abd4c19d3bf00ed97206f7c2028fa81e1266649470fd6f2966aa2c39f5f99d8f5726e406d0bd52dfaa787b269c63
7
+ data.tar.gz: '04545587357f1c91db0e6fa2fb4585c029f9b363aa09c55815d8222d12c39e79190d404a22c9bf38b4df86ed6f75c251d970165a96331519fec24a0dda57de86'
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.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
+
15
+ ## [1.3.0] - 2026-11-02
16
+
17
+ ### Added
18
+
19
+ - `featured` and `featured_categories` from the Storefront API: the apps on the store's front page, and its specials, top sellers, new releases and upcoming apps. No API key needed (#108).
20
+
9
21
  ## [1.2.0] - 2026-11-02
10
22
 
11
23
  ### Added
@@ -210,7 +222,9 @@ The versions below were bumped in `version.rb` during development but **never pu
210
222
 
211
223
  - Initial gem skeleton.
212
224
 
213
- [Unreleased]: https://github.com/jpechaves/steam_api/compare/v1.2.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
227
+ [1.3.0]: https://github.com/jpechaves/steam_api/compare/v1.2.0...v1.3.0
214
228
  [1.2.0]: https://github.com/jpechaves/steam_api/compare/v1.1.0...v1.2.0
215
229
  [1.1.0]: https://github.com/jpechaves/steam_api/compare/v1.0.0...v1.1.0
216
230
  [1.0.0]: https://github.com/jpechaves/steam_api/compare/v0.10.0...v1.0.0
data/docs/USAGE.md CHANGED
@@ -281,6 +281,34 @@ client.store_search.retrieve(term: "portal").first
281
281
 
282
282
  `price` is `nil` for free apps, `metascore` when the app has no Metacritic score. No match is `[]`.
283
283
 
284
+ #### `featured`
285
+
286
+ The apps featured on the store's front page, per platform. Storefront API, no key needed. Takes `country_code:` and `locale:`.
287
+
288
+ ```ruby
289
+ featured = client.featured.retrieve(country_code: "DE", locale: "german")
290
+ featured.featured_win.first
291
+ # => #<data SteamApiClient::FeaturedItem id=3447280, type=0, name="Fantasy World Manager", discounted=true, discount_percent=10,
292
+ # original_price=1499, final_price=1349, currency="EUR", discount_expiration=1794416432, ...>
293
+ ```
294
+
295
+ `SteamApiClient::Featured` fields: `large_capsules`, `featured_win`, `featured_mac`, `featured_linux` (each a list of `FeaturedItem`, `[]` when empty), `layout`.
296
+
297
+ `SteamApiClient::FeaturedItem` fields: `id`, `type` (`0` for apps), `name`, `discounted`, `discount_percent`, `original_price` and `final_price` (in cents; `original_price` is `nil` for free apps), `currency`, `discount_expiration` (unix time, `nil` when not discounted), `large_capsule_image`, `small_capsule_image`, `header_image`, `windows_available`, `mac_available`, `linux_available`, `streaming_video_available`, `controller_support`.
298
+
299
+ #### `featured_categories`
300
+
301
+ The store front page's lists: specials, upcoming apps, top sellers and new releases. Storefront API, no key needed. Takes `country_code:` and `locale:`.
302
+
303
+ ```ruby
304
+ lists = client.featured_categories.retrieve
305
+ lists.specials
306
+ # => #<data SteamApiClient::FeaturedCategories::Category id="cat_specials", name="Specials", items=[#<data SteamApiClient::FeaturedItem ...>, ...]>
307
+ lists.top_sellers.items.map(&:name)
308
+ ```
309
+
310
+ `SteamApiClient::FeaturedCategories` fields: `specials`, `coming_soon`, `top_sellers`, `new_releases`, each a `FeaturedCategories::Category` (`id`, `name` in the requested language, `items`: `FeaturedItem`), or `nil` when Steam leaves the list out. Steam also sends the spotlights, the daily deal, genres and trailers, whose shapes vary: use `retrieve_raw` for those.
311
+
284
312
  #### `app_news`
285
313
 
286
314
  The latest news of an app. `count:` is required, `maxlength:` (default 300) shortens each item's contents.
@@ -301,6 +329,28 @@ client.app_global_achievements.retrieve(appid: 440).first
301
329
  # => #<data SteamApiClient::GlobalAchievement name="TF_SCOUT_LONG_DISTANCE_RUNNER", percent=49.5>
302
330
  ```
303
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
+
304
354
  #### `game_current_players`
305
355
 
306
356
  The number of players in a game right now.
@@ -389,7 +439,7 @@ Don't retry other 4xx errors: they won't succeed on their own.
389
439
 
390
440
  ## Limits and caveats
391
441
 
392
- - **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`) 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.
442
+ - **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.
393
443
  - **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.
394
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.
395
445
  - **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.
@@ -57,6 +57,37 @@ 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
+
71
+ # The apps featured on the store's front page => Featured
72
+ # @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#featured
73
+ Endpoint.new(
74
+ :featured, "featured/", api: :store, key: false, returns: Featured,
75
+ params: {
76
+ country_code: param.string(as: :cc, default: "US"),
77
+ locale: param.string(as: :l, default: "en")
78
+ }
79
+ ),
80
+
81
+ # The store front page's specials, top sellers, new releases and upcoming apps => FeaturedCategories
82
+ # @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#featuredcategories
83
+ Endpoint.new(
84
+ :featured_categories, "featuredcategories/", api: :store, key: false, returns: FeaturedCategories,
85
+ params: {
86
+ country_code: param.string(as: :cc, default: "US"),
87
+ locale: param.string(as: :l, default: "en")
88
+ }
89
+ ),
90
+
60
91
  # Number of players currently in a game => Integer
61
92
  # @see https://wiki.teamfortress.com/wiki/WebAPI/GetNumberOfCurrentPlayers
62
93
  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,12 @@
1
+ module SteamApiClient
2
+ # The apps featured on the store's front page, from `featured`
3
+ # @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#featured
4
+ Featured = Model.define(
5
+ large_capsules: [[FeaturedItem], default: []],
6
+ featured_win: [[FeaturedItem], default: []],
7
+ featured_mac: [[FeaturedItem], default: []],
8
+ featured_linux: [[FeaturedItem], default: []],
9
+ # The front page's layout, e.g. "defcon1"
10
+ layout: [:string, optional: true]
11
+ )
12
+ end
@@ -0,0 +1,21 @@
1
+ module SteamApiClient
2
+ # Built first, then named FeaturedCategories::Category below
3
+ category = Model.define(
4
+ # e.g. "cat_specials"
5
+ id: :string,
6
+ name: :string,
7
+ items: [[FeaturedItem], default: []]
8
+ )
9
+
10
+ # The store front page's lists, from `featured_categories`. The spotlights,
11
+ # daily deal, genres and trailers Steam also sends vary in shape, so they're
12
+ # left to `retrieve_raw`.
13
+ # @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#featuredcategories
14
+ FeaturedCategories = Model.define(
15
+ specials: [category, optional: true],
16
+ coming_soon: [category, optional: true],
17
+ top_sellers: [category, optional: true],
18
+ new_releases: [category, optional: true]
19
+ )
20
+ FeaturedCategories.const_set(:Category, category)
21
+ end
@@ -0,0 +1,28 @@
1
+ module SteamApiClient
2
+ # An app on the store's front page, from `featured` and `featured_categories`.
3
+ # Every field but the ID is nil when Steam leaves it out.
4
+ # @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#featured
5
+ FeaturedItem = Model.define(
6
+ id: :integer,
7
+ # 0 for apps
8
+ type: [:integer, optional: true],
9
+ name: [:string, optional: true],
10
+ discounted: [:boolean, optional: true],
11
+ discount_percent: [:integer, optional: true],
12
+ # In cents. nil for free apps.
13
+ original_price: [:integer, optional: true],
14
+ final_price: [:integer, optional: true],
15
+ currency: [:string, optional: true],
16
+ # When the discount ends, in unix time. nil when not discounted.
17
+ discount_expiration: [:integer, optional: true],
18
+ large_capsule_image: [:string, optional: true],
19
+ small_capsule_image: [:string, optional: true],
20
+ header_image: [:string, optional: true],
21
+ windows_available: [:boolean, optional: true],
22
+ mac_available: [:boolean, optional: true],
23
+ linux_available: [:boolean, optional: true],
24
+ streaming_video_available: [:boolean, from: :streamingvideo_available, optional: true],
25
+ # "full", "partial", or nil
26
+ controller_support: [:string, optional: true]
27
+ )
28
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SteamApiClient
4
- VERSION = "1.2.0"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -29,10 +29,14 @@ 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"
35
36
  require_relative "steam_api_client/models/store_search_result"
37
+ require_relative "steam_api_client/models/featured_item"
38
+ require_relative "steam_api_client/models/featured"
39
+ require_relative "steam_api_client/models/featured_categories"
36
40
  require_relative "steam_api_client/models/wishlist_item"
37
41
 
38
42
  require_relative "steam_api_client/endpoints"
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.2.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,10 @@ 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
59
+ - lib/steam_api_client/models/featured.rb
60
+ - lib/steam_api_client/models/featured_categories.rb
61
+ - lib/steam_api_client/models/featured_item.rb
58
62
  - lib/steam_api_client/models/friend.rb
59
63
  - lib/steam_api_client/models/game.rb
60
64
  - lib/steam_api_client/models/global_achievement.rb