Module: Steam::Player

Defined in:
lib/steam-api/steam/player.rb

Overview

A Ruby DSL for communicating with the Steam Web API.

Class Method Summary collapse

Class Method Details

.badges(steamid) ⇒ Object

Get a player’s Steam badges

Parameters:

  • steamid (Fixnum)

    The SteamID of the account.

See Also:

Since:

  • 1.0.0



51
52
53
54
55
# File 'lib/steam-api/steam/player.rb', line 51

def self.badges(steamid)
  response = client.get 'GetBadges/v1',
                        params: { steamid: steamid }
  response.parse_key('response')
end

.community_badge_progress(steamid) ⇒ Object

Get a player’s Steam Level

Parameters:

  • steamid (Fixnum)

    The SteamID of the account.

See Also:

Since:

  • 1.0.0



60
61
62
63
64
65
# File 'lib/steam-api/steam/player.rb', line 60

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: {}) ⇒ Object

Get Owned Games

Parameters:

  • params (Hash) (defaults to: {})

    Parameters to pass to the API

Options Hash (params:):

  • :steamid (Fixnum)

    The 64 bit ID of the player. (Optional)

  • :include_appinfo (Boolean) — default: false

    Whether or not to include additional details of apps - name and images.

  • :include_played_free_games (Boolean) — default: false

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

  • :appids_filter (Array)

    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 Also:

Since:

  • 1.0.0



19
20
21
22
23
# File 'lib/steam-api/steam/player.rb', line 19

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: {}) ⇒ Object

Get Recently Played Games

Parameters:

  • params (Hash) (defaults to: {})

    Parameters to pass to the API

Options Hash (params:):

  • :steamid (String)

    The SteamID of the account.

  • :count (String)

    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 Also:

Since:

  • 1.0.0



31
32
33
34
35
36
# File 'lib/steam-api/steam/player.rb', line 31

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) ⇒ Object

Get a player’s Steam Level

Parameters:

  • steamid (Fixnum)

    The SteamID of the account.

See Also:

Since:

  • 1.0.0



41
42
43
44
45
46
# File 'lib/steam-api/steam/player.rb', line 41

def self.steam_level(steamid)
  response = client.get 'GetSteamLevel/v1',
                        params: { steamid: steamid }
  response.parse_key('response')
          .parse_key('player_level')
end