Module: NBA::LeagueGameLog

Defined in:
lib/nba/league_game_log.rb

Overview

Provides methods to retrieve league-wide game logs

Constant Summary collapse

REGULAR_SEASON =

Season type constant for regular season

Returns:

  • (String)

    the season type

"Regular Season".freeze
PLAYOFFS =

Season type constant for playoffs

Returns:

  • (String)

    the season type

"Playoffs".freeze
PLAYER =

Player or team constant for player logs

Returns:

  • (String)

    the player/team type

"P".freeze
TEAM =

Player or team constant for team logs

Returns:

  • (String)

    the player/team type

"T".freeze
LEAGUE_GAME_LOG =

Result set name for league game log

Returns:

  • (String)

    the result set name

"LeagueGameLog".freeze

Class Method Summary collapse

Class Method Details

.player_logs(season: Utils.current_season, season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection

Retrieves league-wide player game logs

Examples:

logs = NBA::LeagueGameLog.player_logs(season: 2024)
logs.each { |l| puts "#{l.game_date}: #{l.matchup} - #{l.pts} pts" }

Parameters:

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type (Regular Season or Playoffs)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:



41
42
43
44
45
# File 'lib/nba/league_game_log.rb', line 41

def self.player_logs(season: Utils.current_season, season_type: REGULAR_SEASON, client: CLIENT)
  path = build_path(season, season_type, PLAYER)
  response = client.get(path)
  parse_response(response)
end

.team_logs(season: Utils.current_season, season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection

Retrieves league-wide team game logs

Examples:

logs = NBA::LeagueGameLog.team_logs(season: 2024)
logs.each { |l| puts "#{l.game_date}: #{l.matchup} - #{l.pts} pts" }

Parameters:

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type (Regular Season or Playoffs)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:



57
58
59
60
61
# File 'lib/nba/league_game_log.rb', line 57

def self.team_logs(season: Utils.current_season, season_type: REGULAR_SEASON, client: CLIENT)
  path = build_path(season, season_type, TEAM)
  response = client.get(path)
  parse_team_response(response)
end