- Summary
- steam_api
- Installation
- Usage
- Configuring the client
- Authorization
- GetNewsForApp (v0002)
- GetGlobalAchievementPercentagesForApp (v0002)
- GetPlayerSummaries (v0002)
- GetFriendList (v0001)
- GetPlayerAchievements (v0001)
- GetUserStatsForGame (v0002)
- GetOwnedGames (v0001)
- GetRecentlyPlayedGames (v0001)
- ResolveVanityURL (v0001)
- GetNumberOfCurrentPlayers (v0001)
- GetSteamLevel (v0001)
- App Details
- Development
- Code quality
- Contributing
- License
- Code of Conduct
A project for fetching information from Steam Web Api.
Install the gem and add to the application's Gemfile by executing:
$ bundle add steam-interface
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install steam-interface
And then execute:
$ bundle install
Almost all use of the Steam Web API requires the use of an API Key. You can acquire one by filling out this form.
Just use the following snippet to configure the client:
SteamApi::Client.configure do |config|
config.api_token = 'your-API-token-value'
end
After having the token, you can initialize the client like the configuring section, or if you want a standalone usage, you can do it this way:
client = SteamApi::Client.new('dev-api-token')
Some endpoints don't need an API Key, so you can use the client without providing any. You can find which in the next section.
GetNewsForApp returns the latest of a game specified by its appID.
- Arguments
- appid: AppID of the game you want the news of.
- count: How many news enties you want to get returned.
- maxlength: Maximum length of each news entry. Defaults to 300
client = SteamApi::Client.new
client.app_news.retrieve(400, 3, 300)
Returns a global achievements overview of a specific game in percentages.
- Arguments
- gameid: AppID of the game you want the news of.
client = SteamApi::Client.new
client.app_global_achievements.retrieve(440)
Returns basic profile information for a list of 64-bit Steam IDs.
- Arguments
- steamids: Comma-delimited list of 64 bit Steam IDs to return profile information for. Up to 100 Steam IDs can be requested.
- key: Steam Api Key.
client = SteamApi::Client.new(your_api_token)
# You can a list with multiple IDs here
client.player_summaries.retrieve([76561198160009756])
Returns the friend list of any Steam user, provided their Steam Community profile visibility is set to "Public".
- Arguments
- steamid: 64 bit Steam ID to return friend list for.
- relationship: Relationship filter. Possibles values: 'all', 'friend'. Defaults to 'all'
- key: Your Steam API Key.
client = SteamApi::Client.new(your_api_token)
client.player_friends.retrieve(76561198160009756, 'friend') # 76561197972495328
Returns a list of achievements for this user by app id
- Arguments
- appid: The ID for the game you're requesting
- steamid: The SteamID of the account.
- key: Your Steam API Key.
client = SteamApi::Client.new(your_api_token)
client.player_achievements.retrieve(1245620, 76561198160009756) # 1245620: Elden Ring
Returns a list of achievements for this user by app id
- Arguments
- appid: The ID for the game you're requesting
- steamid: The SteamID of the account.
- key: Your Steam API Key.
client = SteamApi::Client.new(your_api_token)
client.player_game_stats.retrieve(1245620, 76561198160009756) # 1245620: Elden Ring
GetOwnedGames returns a list of games a player owns along with some playtime information, if the profile is publicly visible. Private, friends-only, and other privacy settings are not supported unless you are asking for your own personal details (ie the WebAPI key you are using is linked to the steamid you are requesting).
- Arguments
- steamid: The SteamID of the account.
- include_appinfo: Include game name and logo information in the output. The default is to return appids only. Defaults to 'false'.
- include_played_free_games: By default, free games like Team Fortress 2 are excluded (as technically everyone owns them). If include_played_free_games is set, they will be returned if the player has played them at some point. This is the same behavior as the games list on the Steam Community. Defaults to 'false'.
- key: Your Steam API Key.
client = SteamApi::Client.new(your_api_token)
client.player_owned_games.retrieve(76561198160009756) # Defaults other args to false
client.player_owned_games.retrieve(76561198160009756, include_appinfo: true, include_played_free_games: true)
GetRecentlyPlayedGames returns a list of games a player has played in the last two weeks, if the profile is publicly visible. Private, friends-only, and other privacy settings are not supported unless you are asking for your own personal details (ie the WebAPI key you are using is linked to the steamid you are requesting).
- Arguments
- steamid: The SteamID of the account.
- count: Optionally limit to a certain number of games (the number of games a person has played in the last 2 weeks is typically very small). Defaults to 5.
- key: Your Steam API Key.
client = SteamApi::Client.new(your_api_token)
client.player_recent_games.retrieve(76561198160009756) # Public profile
client.player_recent_games.retrieve(76561197972495328, count=10) # Private profile (everything empty)
Returns the SteamID of the account.
- Arguments
- vanityurl: The user's vanity URL that you would like to retrieve a steam ID for, e.g. http://steamcommunity.com/id/gabelogannewell would use "gabelogannewell"
- key: Your Steam API Key.
client = SteamApi::Client.new(your_api_token)
client.player_steamid.retrieve('gabelogannewell')
client.player_steamid.retrieve('sosolidkk1')
Returns the number of current players on given Game
- Arguments
- appid: The ID for the game you're requesting.
client = SteamApi::Client.new
client.game_current_players.retrieve(440) # Team Fortress 2
client.game_current_players.retrieve(1245620) # Elden Ring
Returns the steam level of the player.
- Arguments
- steamid: The SteamID of the account.
client = SteamApi::Client.new(your_api_token)
client.player_level.retrieve(76561198160009756)
Returns the store details for the given app id.
- Arguments
- appid: The ID for the game you're requesting.
- By default, the current implementation of the SteamApi supports multiple AppIDs at the same time. But this gem does not (yet) supports it.
- filters (optional): The filters for the data you want to be fetched. For the complete filter listing please access the StoreFrontAPI for appdetails endpoint.
- The filter
basic
returns the following keys:type
name
steam_appid
required_age
dlc
detailed_description
about_the_game
supported_languages
detailed_description
supported_languages
header_image
website
pc_requirements
mac_requirements
linux_requirements
- The filter
- cc (country_code, optional): The code for the country currency you want the prices to come.
- l (locale, optional): The language the descriptions and text, in general, should be returned.
- appid: The ID for the game you're requesting.
client = SteamApi::Client.new
client.app_details.retrieve(appid: 1091500) # without filter, it returns everything
client.app_details.retrieve(appid: 1091500, filters: ['basic']) # with a filter
client.app_details.retrieve(appid: 1091500, filters: ['basic', 'recommendations', 'achievements']) # with multiple filters
client.app_details.retrieve(appid: 1091500, country_code: 'BR', locale: 'pt') # with different country code and locale
This project runs on docker to better system compatibility and better compatibility and uniform access to OS resources.
Optionally you can run it directly on your machine OS, this is specially useful for MacOS and Windows developers due to performance downgrade on docker virtualization layer. But keep in mind that the CI process runs on docker and its results must prevails over any kind of result difference to your machine.
On your local development machine, you must have installed:
ruby
: any version >= 3.0
Run bin/setup
to setup the gem using bundler.
Launch a new interactive session on ruby with bin/console
.
Execute all automated tests by running bin/rspec
.
We use standardrb tool to run all linters and code quality tools, both in development and on CI.
To run these tools use:
$ bin/lint
Bug reports and pull requests are welcome on GitHub at https://github.com/sosolidkk/steam_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Steam project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.