Module: NBA::LeaguePlayerOnDetails

Defined in:
lib/nba/league_player_on_details.rb

Overview

Provides methods to retrieve league-wide player on court details

Constant Summary collapse

PLAYERS_ON_COURT =

Result set name for players on court stats

Returns:

  • (String)

    the result set name

"PlayersOnCourtLeaguePlayerDetails".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
PER_GAME =

Per game mode

Returns:

  • (String)

    the per mode

"PerGame".freeze
TOTALS =

Totals mode

Returns:

  • (String)

    the per mode

"Totals".freeze
BASE =

Base measure type

Returns:

  • (String)

    the measure type

"Base".freeze

Class Method Summary collapse

Class Method Details

.all(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, measure_type: BASE, client: CLIENT) ⇒ Collection

Retrieves league-wide player on court details for a team

Examples:

stats = NBA::LeaguePlayerOnDetails.all(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.vs_player_name}: #{s.pts} pts" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year (defaults to current season)

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type (Regular Season, Playoffs)

  • per_mode (String) (defaults to: PER_GAME)

    the per mode (PerGame, Totals)

  • measure_type (String) (defaults to: BASE)

    the measure type (Base)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of player on court stats



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

def self.all(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, measure_type: BASE, client: CLIENT)
  team_id = Utils.extract_id(team)
  path = build_path(team_id, season, season_type, per_mode, measure_type)
  response = client.get(path)
  parse_response(response)
end