Module: RelicLink::Coh3::Api::Endpoints::Leaderboards

Included in:
RelicLink::Coh3::Api::Endpoints
Defined in:
lib/relic_link/coh3/api/endpoints/leaderboards.rb,
lib/relic_link/coh3/api/endpoints/leaderboards/ids.rb,
lib/relic_link/coh3/api/endpoints/leaderboards/sort.rb

Overview

Endpoint definitions for the CoH3 leaderboards API.

Defined Under Namespace

Modules: Ids, Sort

Instance Method Summary collapse

Instance Method Details

#available_leaderboardsObject

List available leaderboards and associated metadata.

Raises:



16
17
18
# File 'lib/relic_link/coh3/api/endpoints/leaderboards.rb', line 16

def available_leaderboards
  get(stats, 'getAvailableLeaderboards')
end

#leaderboard(options = {}) ⇒ Object

Retrieve the leaderboard with the given ID. For your convenience a list of IDs is provided inside Ids, or you can retrieve a list of available IDs using #available_leaderboards.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :leaderboard_id (Ids, Integer)

    ID of the leaderboard to be retrieved (required).

  • :start (Integer) — default: 1

    Leaderboard position to start retrieval from. Passing a value of 1 will retrieve leaderboard information from the beginning. Must be an integer between 1 and 2147483647.

  • :count (Integer) — default: 200

    Number of leaderboard entries to retrieve in the given call. Must be an integer between 1 and 200.

  • :sort_by (Sort) — default: Sort::ELO

    Field to sort the leaderboard entries by.

Raises:



42
43
44
45
46
# File 'lib/relic_link/coh3/api/endpoints/leaderboards.rb', line 42

def leaderboard(options = {})
  raise ArgumentError, 'Required argument :leaderboard_id missing' if options[:leaderboard_id].nil?

  get(stats, 'getLeaderboard2', format_sort_key(options))
end