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.
-
.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.
Class Method Details
.achievement_percentages(appid) ⇒ Hash
Get Global Achievement Percentages for App
12 13 14 15 16 17 18 |
# File 'lib/steam-api/steam/user_stats.rb', line 12 def self.achievement_percentages(appid) response = client.get 'GetGlobalAchievementPercentagesForApp/v2', params: { gameid: appid } response = response.parse_key('achievementpercentages') .parse_key('achievements') response end |
.game_schema(appid, language: nil) ⇒ Hash
Get stat schema
43 44 45 46 47 48 |
# File 'lib/steam-api/steam/user_stats.rb', line 43 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
32 33 34 35 36 |
# File 'lib/steam-api/steam/user_stats.rb', line 32 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
68 69 70 71 72 73 74 75 76 |
# File 'lib/steam-api/steam/user_stats.rb', line 68 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
54 55 56 57 58 59 |
# File 'lib/steam-api/steam/user_stats.rb', line 54 def self.player_count(appid) response = client.get 'GetNumberOfCurrentPlayers/v1', params: { appid: appid } response.parse_key('response') .parse_key('player_count') end |