Module: NBA::TeamGameLog

Defined in:
lib/nba/team_game_log.rb

Overview

Provides methods to retrieve team game logs

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

Class Method Summary collapse

Class Method Details

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

Retrieves game logs for a team

Examples:

logs = NBA::TeamGameLog.find(team: Team::GSW)
logs.each { |log| puts "#{log.game_date}: #{log.pts} points" }

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)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:



30
31
32
33
34
35
36
# File 'lib/nba/team_game_log.rb', line 30

def self.find(team:, season: Utils.current_season, season_type: REGULAR_SEASON, client: CLIENT)
  team_id = extract_team_id(team)
  season_str = Utils.format_season(season)
  path = build_path(team_id, season_str, season_type)
  response = client.get(path)
  parse_response(response)
end