Module: NBA::PlayerEstimatedMetrics

Defined in:
lib/nba/player_estimated_metrics.rb

Overview

Provides methods to retrieve player estimated metrics

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

Result set name for player estimated metrics

Returns:

  • (String)

    the result set name

"PlayerEstimatedMetrics".freeze

Class Method Summary collapse

Class Method Details

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

Retrieves estimated metrics for all players

Examples:

stats = NBA::PlayerEstimatedMetrics.all
stats.each { |s| puts "#{s.player_name}: #{s.e_net_rating} net rating" }

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 estimated metrics stats



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

def self.all(season: Utils.current_season, season_type: REGULAR_SEASON, client: CLIENT)
  path = build_path(season, season_type)
  ResponseParser.parse(client.get(path), result_set: RESULT_SET_NAME) { |data| build_stat(data) }
end