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

"Regular Season".freeze
PLAYOFFS =

Playoffs season type

"Playoffs".freeze
PER_GAME =

Per game mode

"PerGame".freeze
TOTALS =

Totals mode

"Totals".freeze
RESULT_SET_NAME =

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" }


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