Module: NBA::BoxScorePlayerTrack

Defined in:
lib/nba/box_score_player_track.rb

Overview

Provides methods to retrieve player tracking statistics for a game

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 tracking statistics for players in a game

Examples:

stats = NBA::BoxScorePlayerTrack.player_stats(game: "0022400001")
stats.each { |s| puts "#{s.player_name}: #{s.distance} miles, #{s.touches} touches" }


28
29
30
31
32
33
# File 'lib/nba/box_score_player_track.rb', line 28

def self.player_stats(game:, client: CLIENT)
  game_id = Utils.extract_id(game)
  path = "boxscoreplayertrackv3?GameID=#{game_id}"
  response = client.get(path)
  parse_player_response(response, game_id)
end

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

Retrieves player tracking statistics for teams in a game

Examples:

stats = NBA::BoxScorePlayerTrack.team_stats(game: "0022400001")
stats.each { |s| puts "#{s.team_name}: #{s.distance} miles, #{s.touches} touches" }


44
45
46
47
48
49
# File 'lib/nba/box_score_player_track.rb', line 44

def self.team_stats(game:, client: CLIENT)
  game_id = Utils.extract_id(game)
  path = "boxscoreplayertrackv3?GameID=#{game_id}"
  response = client.get(path)
  parse_team_response(response, game_id)
end