Module: NBA::ShotChartLineupDetail

Defined in:
lib/nba/shot_chart_lineup_detail.rb

Overview

Provides methods to retrieve NBA shot chart lineup detail

Constant Summary collapse

DETAIL_SET =

Result set name for shot chart lineup detail

Returns:

  • (String)

    the result set name

"ShotChartLineupDetail".freeze
AVERAGE_SET =

Result set name for league averages

Returns:

  • (String)

    the result set name

"ShotChartLineupLeagueAverage".freeze

Class Method Summary collapse

Class Method Details

.all(group_id:, season: Utils.current_season, season_type: "Regular Season", context_measure: "FGA", period: 0, league: League::NBA, client: CLIENT) ⇒ Collection

Retrieves shot chart lineup detail for a lineup group

Examples:

shots = NBA::ShotChartLineupDetail.all(group_id: 12345, season: 2023)
shots.each { |s| puts "#{s.player_name}: #{s.made? ? 'Made' : 'Missed'}" }

Parameters:

  • group_id (Integer)

    the lineup group ID

  • 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, etc.)

  • context_measure (String) (defaults to: "FGA")

    the context measure (FGA, FG3A, etc.)

  • period (Integer) (defaults to: 0)

    the period (0 for all periods)

  • league (String, League) (defaults to: League::NBA)

    the league ID or League object

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:



34
35
36
37
38
39
40
41
42
# File 'lib/nba/shot_chart_lineup_detail.rb', line 34

def self.all(group_id:, season: Utils.current_season, season_type: "Regular Season",
  context_measure: "FGA", period: 0, league: League::NBA, client: CLIENT)
  league_id = Utils.extract_league_id(league)
  opts = {group_id: group_id, season: season, season_type: season_type,
          context_measure: context_measure, period: period, league_id: league_id}
  ResponseParser.parse(client.get(build_path(opts)), result_set: DETAIL_SET) do |data|
    build_shot(data)
  end
end