Module: NBA::PlayerGameLogs

Defined in:
lib/nba/player_game_logs.rb

Overview

Provides methods to retrieve player game logs in batch

Constant Summary collapse

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
RESULT_SET_NAME =

Result set name

Returns:

  • (String)

    the result set name

"PlayerGameLogs".freeze

Class Method Summary collapse

Class Method Details

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

Retrieves game logs for all players matching the criteria

Examples:

logs = NBA::PlayerGameLogs.all(season: 2024)
logs.each { |log| puts "#{log.game_date}: #{log.player_name} - #{log.pts} pts" }

Parameters:

  • 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)

  • player (Integer, Player, nil) (defaults to: nil)

    filter by player ID or Player object

  • team (Integer, Team, nil) (defaults to: nil)

    filter by team ID or Team object

  • per_mode (String) (defaults to: PER_GAME)

    the per mode (PerGame, Totals)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:



44
45
46
47
48
# File 'lib/nba/player_game_logs.rb', line 44

def self.all(season: Utils.current_season, season_type: REGULAR_SEASON, player: nil, team: nil,
  per_mode: PER_GAME, client: CLIENT)
  path = build_path(season, season_type, player, team, per_mode)
  ResponseParser.parse(client.get(path), result_set: RESULT_SET_NAME) { |data| build_game_log(data) }
end