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



53
54
55
56
57
# 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

.clientObject

Since:

  • 1.0.0



69
70
71
# File 'lib/steam-api/steam/player.rb', line 69

def self.client
  build_client 'IPlayerService'
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



62
63
64
65
66
67
# 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: {}) ⇒ 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 (Integer) — default: 0

    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



20
21
22
23
24
# 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: {}) ⇒ 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



33
34
35
36
37
38
# 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) ⇒ Object

Get a player’s Steam Level

Parameters:

  • steamid (Fixnum)

    The SteamID of the account.

See Also:

Since:

  • 1.0.0



43
44
45
46
47
48
# 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