Module: NBA::LiveBoxScore

Defined in:
lib/nba/live_box_score.rb

Overview

Provides methods to retrieve live box score data

API:

  • public

Class Method Summary collapse

Class Method Details

.find(game:, client: LIVE_CLIENT) ⇒ Collection

Retrieves live box score for a game

Examples:

stats = NBA::LiveBoxScore.find(game: "0022400001")
stats.each { |s| puts "#{s.name}: #{s.points} pts" }

Parameters:

  • the game ID or Game object

  • (defaults to: LIVE_CLIENT)

    the API client to use

Returns:

  • a collection of player stats

API:

  • public



20
21
22
23
24
25
# File 'lib/nba/live_box_score.rb', line 20

def self.find(game:, client: LIVE_CLIENT)
  game_id = Utils.extract_id(game)
  path = "boxscore/boxscore_#{game_id}.json"
  response = client.get(path)
  parse_response(response, game_id)
end