The project is in a healthy, maintained state
A Ruby client for the Steam Web API (player summaries, friends, owned and recent games, achievements, stats, levels, vanity URLs, app news, current players) and the Storefront API (app details). Results come back as plain Ruby Data objects with snake_case fields, and HTTP failures as specific error classes. Its only dependency is Faraday.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 2.0
 Project Readme

Summary

  • Summary
  • steam_api_client
    • Features
    • Installation
    • Usage
    • Development
      • Requirements
      • Initial Setup
      • Running the Interactive Console
      • Running Tests
      • Code Quality
      • Releasing
    • Contributing
    • License
    • Code of Conduct

steam_api_client

Gem Version CI

Previously developed as steam_api. It is not related to the steam_api gem on RubyGems.

A Ruby gem for interacting with the Steam Web API. It returns plain Ruby objects (Data) with snake_case fields, such as game details, player information, and achievements, and its only dependency is Faraday.

Features

  • Fetch game details, news, and global achievements.
  • Retrieve player summaries, friends, achievements, and game stats.
  • Get owned games, recently played games, and Steam levels.
  • Supports both authenticated and unauthenticated requests.
  • Easy-to-use client configuration.

Installation

Add the gem to your application's Gemfile:

gem "steam_api_client"

and run bundle install. Or let Bundler do both:

$ bundle add steam_api_client

Without Bundler, install it with:

$ gem install steam_api_client

and load it with:

require "steam_api_client"

Usage

SteamApiClient::Client.configure do |config|
  config.api_token = ENV.fetch("STEAM_API_KEY") # https://steamcommunity.com/dev/apikey
end

client = SteamApiClient::Client.new

player = client.player_summaries.retrieve(steamids: [76561197960435530]).first
player.persona_name # => "Robin"

client.player_level.retrieve(steamid: player.steam_id)                  # => 32
client.player_owned_games.retrieve(steamid: player.steam_id)            # => OwnedGames, or nil when private
client.app_details.retrieve(appid: 440, filters: ["basic"]).name        # => "Team Fortress 2"
client.game_current_players.retrieve(appid: 440)                        # => 88231

Results are immutable Data objects with snake_case fields (or Integers, or Arrays of them). HTTP errors raise SteamApiClient::Errors::* classes, e.g. HttpTooManyRequests with #retry_after.

See docs/USAGE.md for every endpoint and what it returns, configuration (timeouts, adapter, Faraday middleware, logging without leaking the key), errors and retries, and Steam's limits.

Development

Requirements

  • Ruby >= 3.3

Initial Setup

Run the following command to set up the gem using Bundler:

$ bin/setup

Running the Interactive Console

Launch an interactive Ruby session:

$ bin/console

Running Tests

Execute all automated tests:

$ bin/rspec

Code Quality

We use standardrb for linting and code quality checks. To analyze the code, run:

$ bin/lint

Releasing

Each pull request with a user-visible change adds a line under ## [Unreleased] in CHANGELOG.md. Pull requests don't change the version.

To release the merged changes, open a release pull request:

$ git checkout -b release/0.10.0
$ bin/bump minor         # or patch / major: bumps version.rb and Gemfile.lock, moves [Unreleased] under "## [0.10.0] - <today>"

Commit, open the pull request, and merge it. Then publish from main:

$ bin/release            # build and push the gem (asks for your RubyGems MFA code), then tag v<version> and push the tag
$ bin/release --dry-run  # show what would happen without building, pushing or tagging

bin/release checks out and pulls main first, and refuses to run with uncommitted changes or without a CHANGELOG entry. Steps that are already done are skipped, so running it again for a released version does nothing.

Contributing

Bug reports, endpoint requests and pull requests are welcome on GitHub. Every change starts with an issue; see CONTRIBUTING.md for the setup, the checks and the CHANGELOG rules. Security problems go through SECURITY.md, not public issues.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Code of Conduct.

License

This gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Steam project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Code of Conduct.