Module: Steam::User
- Defined in:
- lib/steam-api/steam/user.rb
Overview
A Ruby DSL for communicating with the Steam::User Web API.
Class Method Summary collapse
-
.bans(steamids) ⇒ Hash
Get Multiple Player Bans.
- .client ⇒ Object
-
.friends(steamid, relationship: :all) ⇒ Hash
Get User’s Friend List.
-
.groups(steamid) ⇒ Hash
Get User Groups.
-
.summaries(steamids) ⇒ Hash
Get Player Summaries.
-
.summary(steamid) ⇒ Hash
Get Player Summaries.
-
.vanity_to_steamid(vanityurl) ⇒ Hash
Resolve Vanity URL.
Class Method Details
.bans(steamids) ⇒ Hash
Get Multiple Player Bans
28 29 30 31 32 33 |
# File 'lib/steam-api/steam/user.rb', line 28 def self.bans(steamids) steamids = [steamids] unless steamids.is_a?(Array) response = client.get 'GetPlayerBans/v1/', params: { steamids: steamids.join(',') } response end |
.client ⇒ Object
84 85 86 |
# File 'lib/steam-api/steam/user.rb', line 84 def self.client build_client 'ISteamUser' end |
.friends(steamid, relationship: :all) ⇒ Hash
Get User’s Friend List
15 16 17 18 19 20 21 22 |
# File 'lib/steam-api/steam/user.rb', line 15 def self.friends(steamid, relationship: :all) response = client.get 'GetFriendList/v1/', params: { steamid: steamid, relationship: relationship } response = response.parse_key('friendslist') .parse_key('friends') response end |
.groups(steamid) ⇒ Hash
Get User Groups
64 65 66 67 68 69 |
# File 'lib/steam-api/steam/user.rb', line 64 def self.groups(steamid) response = client.get 'GetUserGroupList/v1', params: { steamid: steamid } response = response.parse_key('response') response.check_success response.parse_key('groups') end |
.summaries(steamids) ⇒ Hash
Get Player Summaries
53 54 55 56 57 58 |
# File 'lib/steam-api/steam/user.rb', line 53 def self.summaries(steamids) response = client.get 'GetPlayerSummaries/v2/', params: { steamids: steamids.join(',') } response.parse_key('response') .parse_key('players') end |
.summary(steamid) ⇒ Hash
Get Player Summaries
42 43 44 |
# File 'lib/steam-api/steam/user.rb', line 42 def self.summary(steamid) summaries([steamid]).first end |
.vanity_to_steamid(vanityurl) ⇒ Hash
Resolve Vanity URL
76 77 78 79 80 81 82 |
# File 'lib/steam-api/steam/user.rb', line 76 def self.vanity_to_steamid(vanityurl) response = client.get 'ResolveVanityURL/v1', params: { vanityurl: vanityurl } response = response.parse_key('response') response.check_success(success_condition: 1) response.parse_key('steamid') end |