class RLS::Client
- RLS::Client
- Reference
- Object
Overview
The client is the main utility for interacting with the RLS API. It
abstracts your API key and caches certain hot API routes. See the
REST
module for a full description of the API.
client = RLS::Client.new("API_KEY")
puts client.player("76561198034606292") # => RLS::Player
By default, caching is enabled and is handled in memory with a collection of hashes. Cached objects have set expiry rules, and once objects expire the client will perform an HTTP request to update the cache.
If you want to disable caching:
client.player_cache = nil
client.leaderboard_cache = nil
Included Modules
Defined in:
rls/client.crConstructors
Instance Method Summary
-
#leaderboard(playlist : REST::RankedPlaylist)
Retrieves an array of 100 players sorted by their current season rating
-
#leaderboard(type : REST::StatType)
Retrieves an array of 100 players sorted by their specified stat amount
-
#leaderboard_cache : Memory::Leaderboard | Nil
Cache for leaderboards, which are arrays of
Player
objects -
#leaderboard_cache=(leaderboard_cache : Memory::Leaderboard | Nil)
Cache for leaderboards, which are arrays of
Player
objects -
#player(id : String, platform : Platform = Platform::Steam)
Retrieves a single player by ID and
Platform
. -
#player_cache : Memory::Player | Nil
Cache for
Player
objects -
#player_cache=(player_cache : Memory::Player | Nil)
Cache for
Player
objects -
#players(query : Array(REST::BatchPlayersPayload))
Fetch up to 10 players with one request.
Instance methods inherited from module RLS::REST
leaderboard(playlist : RankedPlaylist)leaderboard(type : StatType) leaderboard, platforms platforms, player(id : String, platform : Platform = Platform::Steam) player, players(query : Array(BatchPlayersPayload))
players(*query) players, playlists playlists, request(method : String, path : String, headers : HTTP::Headers = HTTP::Headers.new, body : String | Nil = nil) request, search(display_name : String, page : UInt32 = 0_u32) search, seasons seasons, tiers tiers
Constructor Detail
Instance Method Detail
Retrieves an array of 100 players sorted by their current season rating
If the #leaderboard_cache
is present, it will be used to immediately return
a leaderboard, or perform an API request on a cache miss
Retrieves an array of 100 players sorted by their specified stat amount
If the #leaderboard_cache
is present, it will be used to immediately return
a leaderboard, or perform an API request on a cache miss
Cache for leaderboards, which are arrays of Player
objects
Cache for leaderboards, which are arrays of Player
objects
Retrieves a single player by ID and Platform
. ID is a Steam ID, PSN
username, Xbox Gamertag, or Xbox XUID.
If the #player_cache
is present, it will be used to return cached
players immediately, or perform an API request on a cache miss.
Fetch up to 10 players with one request. See BatchPlayersPayload
If the #player_cache
is present, it will be used to return cached
players immediately, or perform an API request on a cache miss.