Module: NBA::PlayerCareerByCollege

Defined in:
lib/nba/player_career_by_college.rb

Overview

Provides methods to retrieve player career stats by college

Constant Summary collapse

PER_GAME =

Per mode constant for per game stats

Returns:

  • (String)

    the per mode

"PerGame".freeze
TOTALS =

Per mode constant for totals

Returns:

  • (String)

    the per mode

"Totals".freeze

Class Method Summary collapse

Class Method Details

.find(college:, per_mode: TOTALS, season: nil, client: CLIENT) ⇒ Collection

Retrieves career statistics for all players from a specific college

Examples:

# Get all players from Duke
stats = NBA::PlayerCareerByCollege.find(college: "Duke")
stats.each { |s| puts "#{s.player_name}: #{s.pts} career points" }
# Get per-game averages
stats = NBA::PlayerCareerByCollege.find(college: "Kentucky", per_mode: NBA::PlayerCareerByCollege::PER_GAME)

Parameters:

  • college (String)

    the college name (required)

  • per_mode (String) (defaults to: TOTALS)

    the per mode (Totals or PerGame)

  • season (String, nil) (defaults to: nil)

    optional season filter

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of college player stats



34
35
36
37
# File 'lib/nba/player_career_by_college.rb', line 34

def self.find(college:, per_mode: TOTALS, season: nil, client: CLIENT)
  path = build_path(college, per_mode, season)
  ResponseParser.parse(client.get(path)) { |data| build_stat(data) }
end