Module: NBA::AllTimeLeaders

Defined in:
lib/nba/all_time_leaders.rb

Overview

Provides methods to retrieve all-time NBA statistical leaders

Constant Summary collapse

PTS =

Points category

Returns:

  • (String)

    the category code

"PTS".freeze
REB =

Rebounds category

Returns:

  • (String)

    the category code

"REB".freeze
AST =

Assists category

Returns:

  • (String)

    the category code

"AST".freeze
STL =

Steals category

Returns:

  • (String)

    the category code

"STL".freeze
BLK =

Blocks category

Returns:

  • (String)

    the category code

"BLK".freeze
FGM =

Field goals made category

Returns:

  • (String)

    the category code

"FGM".freeze
FGA =

Field goals attempted category

Returns:

  • (String)

    the category code

"FGA".freeze
FG3M =

Three pointers made category

Returns:

  • (String)

    the category code

"FG3M".freeze
FG3A =

Three pointers attempted category

Returns:

  • (String)

    the category code

"FG3A".freeze
FTM =

Free throws made category

Returns:

  • (String)

    the category code

"FTM".freeze
FTA =

Free throws attempted category

Returns:

  • (String)

    the category code

"FTA".freeze
GP =

Games played category

Returns:

  • (String)

    the category code

"GP".freeze
TOV =

Turnovers category

Returns:

  • (String)

    the category code

"TOV".freeze
PF =

Personal fouls category

Returns:

  • (String)

    the category code

"PF".freeze
OREB =

Offensive rebounds category

Returns:

  • (String)

    the category code

"OREB".freeze
DREB =

Defensive rebounds category

Returns:

  • (String)

    the category code

"DREB".freeze
REGULAR_SEASON =

Regular season type

Returns:

  • (String)

    the season type

"Regular Season".freeze
PLAYOFFS =

Playoffs season type

Returns:

  • (String)

    the season type

"Playoffs".freeze
TOTALS =

Totals per mode

Returns:

  • (String)

    the per mode

"Totals".freeze
PER_GAME =

Per game per mode

Returns:

  • (String)

    the per mode

"PerGame".freeze

Class Method Summary collapse

Class Method Details

.find(category:, season_type: REGULAR_SEASON, per_mode: TOTALS, limit: 10, client: CLIENT) ⇒ Collection

Retrieves all-time leaders for a statistical category

Examples:

leaders = NBA::AllTimeLeaders.find(category: NBA::AllTimeLeaders::PTS)
leaders.each { |l| puts "#{l.rank}. #{l.player_name}: #{l.value.to_i}" }

Parameters:

  • category (String)

    the statistical category (PTS, REB, AST, etc.)

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type (Regular Season, Playoffs)

  • per_mode (String) (defaults to: TOTALS)

    the per mode (Totals, PerGame)

  • limit (Integer) (defaults to: 10)

    number of results to return (default 10)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of all-time leaders



95
96
97
98
99
# File 'lib/nba/all_time_leaders.rb', line 95

def self.find(category:, season_type: REGULAR_SEASON, per_mode: TOTALS, limit: 10, client: CLIENT)
  path = build_path(season_type, per_mode, limit)
  response = client.get(path)
  parse_response(response, category, limit)
end