Module: NBA::ShotChartLeagueWide

Defined in:
lib/nba/shot_chart_league_wide.rb

Overview

Provides methods to retrieve league-wide shot chart data

Constant Summary collapse

LEAGUE_WIDE =

Result set name for league-wide shot data

Returns:

  • (String)

    the result set name

"LeagueWide".freeze
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

Class Method Summary collapse

Class Method Details

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

Retrieves league-wide shot statistics

Examples:

stats = NBA::ShotChartLeagueWide.all(season: 2024)
stats.each { |s| puts "#{s.shot_zone_basic}: #{(s.fg_pct * 100).round(1)}%" }

Parameters:

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of league-wide shot stats



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

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