Module: NBA::PlayerDashboard

Defined in:
lib/nba/player_dashboard.rb

Overview

Provides methods to retrieve player 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_36 =

Per mode constant for per 36 minutes

Returns:

  • (String)

    the per mode

"Per36".freeze

Class Method Summary collapse

Class Method Details

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

Retrieves player dashboard by clutch splits

Examples:

stats = NBA::PlayerDashboard.clutch_splits(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 59

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

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

Retrieves player dashboard by game splits

Examples:

stats = NBA::PlayerDashboard.game_splits(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 91

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

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

Retrieves player dashboard by general splits

Examples:

stats = NBA::PlayerDashboard.general_splits(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 43

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

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

Retrieves player dashboard by last N games

Examples:

stats = NBA::PlayerDashboard.last_n_games(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 107

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

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

Retrieves player dashboard by shooting splits

Examples:

stats = NBA::PlayerDashboard.shooting_splits(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.fg_pct}" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 75

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

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

Retrieves player dashboard by team performance

Examples:

stats = NBA::PlayerDashboard.team_performance(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 139

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

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

Retrieves player dashboard by year over year

Examples:

stats = NBA::PlayerDashboard.year_over_year(player: 201939)
stats.each { |s| puts "#{s.group_value}: #{s.pts} ppg" }

Parameters:

  • player (Integer, Player)

    the player ID or Player 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/player_dashboard.rb', line 123

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