Module: NBA::BoxScoreScoringV3

Defined in:
lib/nba/box_score_scoring_v3.rb

Overview

Provides methods to retrieve scoring box score statistics using V3 API

Constant Summary collapse

BOX_SCORE_KEY =

Returns JSON key for scoring box score data.

"boxScoreScoring".freeze
PLAYER_STATS =

Returns JSON key for player statistics.

"PlayerStats".freeze
TEAM_STATS =

Returns JSON key for team statistics.

"TeamStats".freeze

Class Method Summary collapse

Class Method Details

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

Retrieves scoring player box score stats for a game

Examples:

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


30
31
32
33
34
# File 'lib/nba/box_score_scoring_v3.rb', line 30

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

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

Retrieves scoring team box score stats for a game

Examples:

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


47
48
49
50
51
# File 'lib/nba/box_score_scoring_v3.rb', line 47

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