Module: Steam::UserStats
- Defined in:
- lib/steam-api/steam/user_stats.rb
Overview
A Ruby DSL for communicating with the Steam Web API.
Class Method Summary collapse
-
.achievement_percentages(appid) ⇒ Hash
Get Global Achievement Percentages for App.
- .client ⇒ Object
-
.game_schema(appid, language: nil) ⇒ Hash
Get stat schema.
-
.global_for_game(appid, params: {}) ⇒ Hash
Get Global Stats for Game.
-
.player_achievements(appid, steamid, language: nil) ⇒ Hash
Get Player Achievements.
-
.player_count(appid) ⇒ Hash
Get Number of Current Players.
-
.player_stats(appid, steamid) ⇒ Hash
Get User Stats for Game.
Class Method Details
.achievement_percentages(appid) ⇒ Hash
Get Global Achievement Percentages for App
11 12 13 14 15 16 17 |
# File 'lib/steam-api/steam/user_stats.rb', line 11 def self.achievement_percentages(appid) response = client.get 'GetGlobalAchievementPercentagesForApp/v2', params: { gameid: appid } response = response.parse_key('achievementpercentages') .parse_key('achievements') response end |
.client ⇒ Object
90 91 92 |
# File 'lib/steam-api/steam/user_stats.rb', line 90 def self.client build_client('ISteamUserStats') end |
.game_schema(appid, language: nil) ⇒ Hash
Get stat schema
44 45 46 47 48 49 |
# File 'lib/steam-api/steam/user_stats.rb', line 44 def self.game_schema(appid, language: nil) params = { appid: appid } params[:l] = language unless language.nil? response = client.get 'GetSchemaForGame/v2', params: params response.parse_key('game') end |
.global_for_game(appid, params: {}) ⇒ Hash
Get Global Stats for Game
33 34 35 36 37 |
# File 'lib/steam-api/steam/user_stats.rb', line 33 def self.global_for_game(appid, params: {}) params[:appid] = appid response = client.get 'GetGlobalStatsForGame/v1', params: params response.parse_key('response') end |
.player_achievements(appid, steamid, language: nil) ⇒ Hash
Get Player Achievements
69 70 71 72 73 74 75 76 77 |
# File 'lib/steam-api/steam/user_stats.rb', line 69 def self.player_achievements(appid, steamid, language: nil) params = { appid: appid, steamid: steamid } params[:l] = language unless language.nil? response = client.get 'GetPlayerAchievements/v1', params: params response = response.parse_key('playerstats') response.check_success response.delete('success') response end |
.player_count(appid) ⇒ Hash
Get Number of Current Players
55 56 57 58 59 60 |
# File 'lib/steam-api/steam/user_stats.rb', line 55 def self.player_count(appid) response = client.get 'GetNumberOfCurrentPlayers/v1', params: { appid: appid } response.parse_key('response') .parse_key('player_count') end |
.player_stats(appid, steamid) ⇒ Hash
Get User Stats for Game
84 85 86 87 88 |
# File 'lib/steam-api/steam/user_stats.rb', line 84 def self.player_stats(appid, steamid) params = { appid: appid, steamid: steamid } response = client.get 'GetUserStatsForGame/v2', params: params response.parse_key('playerstats') end |