Module: NBA::HustleStatsBoxScore
- Defined in:
- lib/nba/hustle_stats_box_score.rb
Overview
Provides methods to retrieve hustle statistics for a game via hustlestatsboxscore endpoint
Constant Summary collapse
- HUSTLE_STATS_AVAILABLE =
Result set name for availability status
"HustleStatsAvailable".freeze
- PLAYER_STATS =
Result set name for player stats
"PlayerStats".freeze
- TEAM_STATS =
Result set name for team stats
"TeamStats".freeze
- ENDPOINT =
API endpoint path
"hustlestatsboxscore".freeze
Class Method Summary collapse
-
.available?(game:, client: CLIENT) ⇒ Boolean
Checks if hustle stats are available for a game.
-
.player_stats(game:, client: CLIENT) ⇒ Collection
Retrieves hustle statistics for players in a game.
-
.team_stats(game:, client: CLIENT) ⇒ Collection
Retrieves hustle statistics for teams in a game.
Class Method Details
.available?(game:, client: CLIENT) ⇒ Boolean
Checks if hustle stats are available for a game
61 62 63 64 |
# File 'lib/nba/hustle_stats_box_score.rb', line 61 def self.available?(game:, client: CLIENT) game_id = Utils.extract_id(game) stats_available?(client.get("#{ENDPOINT}?GameID=#{game_id}")) end |
.player_stats(game:, client: CLIENT) ⇒ Collection
Retrieves hustle statistics for players in a game
35 36 37 38 |
# File 'lib/nba/hustle_stats_box_score.rb', line 35 def self.player_stats(game:, client: CLIENT) game_id = Utils.extract_id(game) parse_stats(client.get("#{ENDPOINT}?GameID=#{game_id}"), game_id, PLAYER_STATS, :build_player_stat) end |
.team_stats(game:, client: CLIENT) ⇒ Collection
Retrieves hustle statistics for teams in a game
48 49 50 51 |
# File 'lib/nba/hustle_stats_box_score.rb', line 48 def self.team_stats(game:, client: CLIENT) game_id = Utils.extract_id(game) parse_stats(client.get("#{ENDPOINT}?GameID=#{game_id}"), game_id, TEAM_STATS, :build_team_stat) end |