Module: NBA::BoxScoreFourFactors

Defined in:
lib/nba/box_score_four_factors.rb

Overview

Provides methods to retrieve four factors box score statistics

Constant Summary collapse

PLAYER_STATS =

Result set name for player stats

"PlayerStats".freeze
TEAM_STATS =

Result set name for team stats

"TeamStats".freeze

Class Method Summary collapse

Class Method Details

.player_stats(game:, client: CLIENT) ⇒ Collection

Retrieves player four factors box score stats for a game

Examples:

stats = NBA::BoxScoreFourFactors.player_stats(game: "0022400001")
stats.each { |s| puts "#{s.player_name}: #{s.efg_pct}% eFG" }


27
28
29
30
# File 'lib/nba/box_score_four_factors.rb', line 27

def self.player_stats(game:, client: CLIENT)
  path = "boxscorefourfactorsv2?GameID=#{Utils.extract_id(game)}"
  ResponseParser.parse(client.get(path), result_set: PLAYER_STATS) { |data| build_player_stat(data) }
end

.team_stats(game:, client: CLIENT) ⇒ Collection

Retrieves team four factors box score stats for a game

Examples:

stats = NBA::BoxScoreFourFactors.team_stats(game: "0022400001")
stats.each { |s| puts "#{s.team_name}: #{s.tov_pct}% TOV" }


41
42
43
44
# File 'lib/nba/box_score_four_factors.rb', line 41

def self.team_stats(game:, client: CLIENT)
  path = "boxscorefourfactorsv2?GameID=#{Utils.extract_id(game)}"
  ResponseParser.parse(client.get(path), result_set: TEAM_STATS) { |data| build_team_stat(data) }
end