Module: NBA::BoxScoreHustle

Defined in:
lib/nba/box_score_hustle.rb

Overview

Provides methods to retrieve hustle statistics for a game

Constant Summary collapse

PLAYER_STATS =

Result set name for player stats

Returns:

  • (String)

    the result set name

"PlayerStats".freeze
TEAM_STATS =

Result set name for team stats

Returns:

  • (String)

    the result set name

"TeamStats".freeze

Class Method Summary collapse

Class Method Details

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

Retrieves hustle statistics for players in a game

Examples:

stats = NBA::BoxScoreHustle.player_stats(game: "0022400001")
stats.each { |s| puts "#{s.player_name}: #{s.deflections} deflections" }

Parameters:

  • game (String, Game)

    the game ID or Game object

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of player hustle stats



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

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

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

Retrieves hustle statistics for teams in a game

Examples:

stats = NBA::BoxScoreHustle.team_stats(game: "0022400001")
stats.each { |s| puts "#{s.team_name}: #{s.deflections} deflections" }

Parameters:

  • game (String, Game)

    the game ID or Game object

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of team hustle stats



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

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