Module: SteamUser

Defined in:
lib/steamwebapi/user.rb

Class Method Summary collapse

Class Method Details

.friend_list(steamid, relationship = 'friend') ⇒ Object



23
24
25
26
# File 'lib/steamwebapi/user.rb', line 23

def self.friend_list(steamid, relationship='friend')
  args = {key: @key, steamid: steamid, relationship: relationship}
  SteamAPI.get('ISteamUser', 'GetFriendList', 'v0001', args)
end

.global_achievements_percent(gameid) ⇒ Object

ISteamUserStats



29
30
31
32
# File 'lib/steamwebapi/user.rb', line 29

def self.global_achievements_percent(gameid)
  args = {gameid: gameid}
  SteamAPI.get('ISteamUserStats', 'GetGlobalAchievementPercentagesForApp', 'v0002', args)
end

.global_stats(appid, count = '1', name = []) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/steamwebapi/user.rb', line 34

def self.global_stats(appid, count='1', name=[])
  args = {appid: appid, count: count}
  name.each do |v|
    args.merge!("name[#{name.index(v)}]" => v)
  end
  SteamAPI.get('ISteamUserStats', 'GetGlobalStatsForGame', 'v0001', args)
end

.is_playing_shared(steamid, appid) ⇒ Object



76
77
78
79
# File 'lib/steamwebapi/user.rb', line 76

def self.is_playing_shared(steamid, appid)
  args = {key: @key, steamid: steamid, appid_playing: appid}
  SteamAPI.get('IPlayerService', 'IsPlayingSharedGame', 'v0001', args)
end

.key(key) ⇒ Object



5
6
7
8
# File 'lib/steamwebapi/user.rb', line 5

def self.key(key)
  @key = key
  self
end

.owned_games(steamid, appinfo = false, freegames = false) ⇒ Object

IPlayerService



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/steamwebapi/user.rb', line 53

def self.owned_games(steamid, appinfo=false, freegames=false)
  args = {key: @key, steamid: steamid}

  if appinfo
    args[:include_appinfo] = '1'
  else
    args[:include_appinfo] = '0'
  end

  if freegames
    args[:include_played_free_games] = '1'
  else
    args[:include_played_free_games] = '0'
  end

  SteamAPI.get('IPlayerService', 'GetOwnedGames', 'v0001', args)
end

.player_achievements(steamid, appid, language = 'english') ⇒ Object



42
43
44
45
# File 'lib/steamwebapi/user.rb', line 42

def self.player_achievements(steamid, appid, language='english')
  args = {key: @key, steamid: steamid, appid: appid, l: language}
  SteamAPI.get('ISteamUserStats', 'GetPlayerAchievements', 'v0001', args)
end

.recently_played(steamid, count = '1') ⇒ Object



71
72
73
74
# File 'lib/steamwebapi/user.rb', line 71

def self.recently_played(steamid, count='1')
  args = {key: @key, steamid: steamid, count: count}
  SteamAPI.get('IPlayerService', 'GetRecentlyPlayedGames', 'v0001', args)
end

.summaries(steamids = []) ⇒ Object

ISteamUser



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/steamwebapi/user.rb', line 11

def self.summaries(steamids=[])
  args = {key: @key}
  unless steamids.empty?
    ids = ''
    steamids.each do |id|
      ids += "#{id},"
    end
    args[:steamids] = ids
  end
  SteamAPI.get('ISteamUser', 'GetPlayerSummaries', 'v0002', args)
end

.user_stats_for_game(steamid, appid, language = 'english') ⇒ Object



47
48
49
50
# File 'lib/steamwebapi/user.rb', line 47

def self.user_stats_for_game(steamid, appid, language='english')
  args = {key: @key, steamid: steamid, appid: appid, l: language}
  SteamAPI.get('ISteamUserStats', 'GetUserStatsForGame', 'v0002', args)
end