Module: NBA::BoxScoreTraditionalV3

Defined in:
lib/nba/box_score_traditional_v3.rb

Overview

Provides methods to retrieve traditional box score statistics using V3 API

Constant Summary collapse

BOX_SCORE_KEY =

Returns JSON key for traditional box score data.

"boxScoreTraditional".freeze
PLAYER_STATS =

Returns JSON key for player statistics.

"PlayerStats".freeze
TEAM_STATS =

Returns JSON key for team statistics.

"TeamStats".freeze
STARTER_BENCH_STATS =

Returns JSON key for starter/bench statistics.

"TeamStarterBenchStats".freeze

Class Method Summary collapse

Class Method Details

.player_stats(game:, start_period: 0, end_period: 0, client: CLIENT) ⇒ Collection

Retrieves player box score stats for a game

Examples:

stats = NBA::BoxScoreTraditionalV3.player_stats(game: "0022400001")
stats.each { |stat| puts "#{stat.player_name}: #{stat.pts} pts" }


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

def self.player_stats(game:, start_period: 0, end_period: 0, client: CLIENT)
  game_id = Utils.extract_id(game)
  response = client.get(build_path(game_id, start_period, end_period))
  parse_player_response(response, game_id)
end

.starter_bench_stats(game:, start_period: 0, end_period: 0, client: CLIENT) ⇒ Collection

Retrieves starter vs bench breakdown stats for a game

Examples:

stats = NBA::BoxScoreTraditionalV3.starter_bench_stats(game: "0022400001")
stats.each { |stat| puts "#{stat.team_abbreviation} #{stat.starters_bench}: #{stat.pts} pts" }


67
68
69
70
71
# File 'lib/nba/box_score_traditional_v3.rb', line 67

def self.starter_bench_stats(game:, start_period: 0, end_period: 0, client: CLIENT)
  game_id = Utils.extract_id(game)
  response = client.get(build_path(game_id, start_period, end_period))
  parse_starter_bench_response(response, game_id)
end

.team_stats(game:, start_period: 0, end_period: 0, client: CLIENT) ⇒ Collection

Retrieves team box score stats for a game

Examples:

stats = NBA::BoxScoreTraditionalV3.team_stats(game: "0022400001")
stats.each { |stat| puts "#{stat.team_abbreviation}: #{stat.pts} pts" }


50
51
52
53
54
# File 'lib/nba/box_score_traditional_v3.rb', line 50

def self.team_stats(game:, start_period: 0, end_period: 0, client: CLIENT)
  game_id = Utils.extract_id(game)
  response = client.get(build_path(game_id, start_period, end_period))
  parse_team_response(response, game_id)
end