Module: NBA::TeamDashboard

Defined in:
lib/nba/team_dashboard.rb

Overview

Provides methods to retrieve team dashboard data with various splits

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
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
PER_100 =

Per mode constant for per 100 possessions

Returns:

  • (String)

    the per mode

"Per100Possessions".freeze

Class Method Summary collapse

Class Method Details

.clutch_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by clutch splits

Examples:

stats = NBA::TeamDashboard.clutch_splits(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



91
92
93
# File 'lib/nba/team_dashboard.rb', line 91

def self.clutch_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbyclutch", client: client)
end

.game_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by game splits

Examples:

stats = NBA::TeamDashboard.game_splits(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



107
108
109
# File 'lib/nba/team_dashboard.rb', line 107

def self.game_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbygamesplits", client: client)
end

.general_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by general splits

Examples:

stats = NBA::TeamDashboard.general_splits(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



43
44
45
# File 'lib/nba/team_dashboard.rb', line 43

def self.general_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbygeneralsplits", client: client)
end

.last_n_games(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by last N games

Examples:

stats = NBA::TeamDashboard.last_n_games(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



123
124
125
# File 'lib/nba/team_dashboard.rb', line 123

def self.last_n_games(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbylastngames", client: client)
end

.lineups(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team lineup data

Examples:

stats = NBA::TeamDashboard.lineups(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



75
76
77
# File 'lib/nba/team_dashboard.rb', line 75

def self.lineups(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashlineups", client: client)
end

.shooting_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by shooting splits

Examples:

stats = NBA::TeamDashboard.shooting_splits(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.fg_pct}" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



59
60
61
# File 'lib/nba/team_dashboard.rb', line 59

def self.shooting_splits(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbyshootingsplits", client: client)
end

.team_performance(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by team performance

Examples:

stats = NBA::TeamDashboard.team_performance(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



139
140
141
# File 'lib/nba/team_dashboard.rb', line 139

def self.team_performance(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbyteamperformance", client: client)
end

.year_over_year(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves team dashboard by year over year

Examples:

stats = NBA::TeamDashboard.year_over_year(team: NBA::Team::GSW)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • team (Integer, Team)

    the team ID or Team object

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of dashboard stats



155
156
157
# File 'lib/nba/team_dashboard.rb', line 155

def self.year_over_year(team:, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  fetch_dashboard(team, season, season_type, per_mode, "teamdashboardbyyearoveryear", client: client)
end