Module: NBA::LeagueSeasonMatchups

Defined in:
lib/nba/league_season_matchups.rb

Overview

Provides methods to retrieve league-wide season matchup statistics

Constant Summary collapse

SEASON_MATCHUPS =

Result set name for season matchups

Returns:

  • (String)

    the result set name

"SeasonMatchups".freeze
REGULAR_SEASON =

Regular season type constant

Returns:

  • (String)

    the season type

"Regular Season".freeze
PLAYOFFS =

Playoffs season type constant

Returns:

  • (String)

    the season type

"Playoffs".freeze
PER_GAME =

Per game mode constant

Returns:

  • (String)

    the per mode

"PerGame".freeze
TOTALS =

Totals mode constant

Returns:

  • (String)

    the per mode

"Totals".freeze

Class Method Summary collapse

Class Method Details

.all(season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, off_player: nil, def_player: nil, off_team: nil, def_team: nil, client: CLIENT) ⇒ Collection

Retrieves all league-wide season matchup statistics

Examples:

matchups = NBA::LeagueSeasonMatchups.all(season: 2024)
matchups.first.off_player_name #=> "Stephen Curry"

Parameters:

  • season (Integer) (defaults to: Utils.current_season)

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • off_player (Integer, #id, nil) (defaults to: nil)

    offensive player ID or object

  • def_player (Integer, #id, nil) (defaults to: nil)

    defensive player ID or object

  • off_team (Integer, #id, nil) (defaults to: nil)

    offensive team ID or object

  • def_team (Integer, #id, nil) (defaults to: nil)

    defensive team ID or object

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of matchup statistics



47
48
49
50
51
52
53
# File 'lib/nba/league_season_matchups.rb', line 47

def self.all(season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME,
  off_player: nil, def_player: nil, off_team: nil, def_team: nil, client: CLIENT)
  path = build_path(season, season_type: season_type, per_mode: per_mode,
    off_player: off_player, def_player: def_player, off_team: off_team, def_team: def_team)
  response = client.get(path)
  parse_response(response)
end