Module: NBA::LivePlayByPlay

Defined in:
lib/nba/live_play_by_play.rb

Overview

Provides methods to retrieve live play-by-play data

Class Method Summary collapse

Class Method Details

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

Retrieves live play-by-play for a game

Examples:

actions = NBA::LivePlayByPlay.find(game: "0022400001")
actions.each { |a| puts "#{a.clock}: #{a.description}" }

Parameters:

  • game (String, Game)

    the game ID or Game object

  • client (LiveConnection) (defaults to: LIVE_CLIENT)

    the API client to use

Returns:



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

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