module Steam::Player

A Ruby DSL for communicating with the Steam Web API. @see developer.valvesoftware.com/wiki/Steam_Web_API @since 1.0.0

Public Class Methods

badges(steamid) click to toggle source

Get a player's Steam badges @param [Fixnum] steamid The SteamID of the account. @see wiki.teamfortress.com/wiki/WebAPI/GetBadges

# File lib/steam-api/steam/player.rb, line 53
def self.badges(steamid)
  response = client.get 'GetBadges/v1',
                        params: { steamid: steamid }
  response.parse_key('response')
end
client() click to toggle source
# File lib/steam-api/steam/player.rb, line 69
def self.client
  build_client 'IPlayerService'
end
community_badge_progress(steamid) click to toggle source

Get a player's Steam Level @param [Fixnum] steamid The SteamID of the account. @see wiki.teamfortress.com/wiki/WebAPI/GetCommunityBadgeProgress

# File lib/steam-api/steam/player.rb, line 62
def self.community_badge_progress(steamid)
  response = client.get 'GetCommunityBadgeProgress/v1',
                        params: { steamid: steamid }
  response.parse_key('response')
          .parse_key('quests')
end
owned_games(steamid, params: {}) click to toggle source

Get Owned Games @param [Hash] params Parameters to pass to the API @option params [Fixnum] :steamid The 64 bit ID of the player. (Optional) @option params [Integer] :include_appinfo (0) Whether or not to include

additional details of apps - name and images.

@option params [Boolean] :include_played_free_games (false) Whether or

not to list free-to-play games in the results.

@option params [Array] :appids_filter You can optionally filter the list

to a set of appids.
Note that these cannot be passed as a URL parameter, instead you must
use the JSON format described in
Steam_Web_API#Calling_Service_interfaces. The expected input is an
array of integers (in JSON: "appids_filter: [ 440, 500, 550 ]" )

@see wiki.teamfortress.com/wiki/WebAPI/GetOwnedGames

# File lib/steam-api/steam/player.rb, line 20
def self.owned_games(steamid, params: {})
  params[:steamid] = steamid
  response = client.get 'GetOwnedGames/v1', params: params
  response.parse_key('response')
end
recently_played_games(steamid, params: {}) click to toggle source

Get Recently Played Games @param [Hash] params Parameters to pass to the API @option params [String] :steamid The SteamID of the account. @option params [String] :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)

@see wiki.teamfortress.com/wiki/WebAPI/GetRecentlyPlayedGames

# File lib/steam-api/steam/player.rb, line 33
def self.recently_played_games(steamid, params: {})
  params[:steamid] = steamid
  response = client.get 'GetRecentlyPlayedGames/v1',
                        params: params
  response.parse_key('response')
end
steam_level(steamid) click to toggle source

Get a player's Steam Level @param [Fixnum] steamid The SteamID of the account. @see wiki.teamfortress.com/wiki/WebAPI/GetSteamLevel

# File lib/steam-api/steam/player.rb, line 43
def self.steam_level(steamid)
  response = client.get 'GetSteamLevel/v1',
                        params: { steamid: steamid }
  response.parse_key('response')
          .parse_key('player_level')
end