Module: NBA::PlayByPlayV3

Defined in:
lib/nba/play_by_play_v3.rb

Overview

Provides methods to retrieve play-by-play V3 data for games

Constant Summary collapse

RESULT_SET_NAME =

Result set name for play-by-play data

Returns:

  • (String)

    the result set name

"PlayByPlay".freeze

Class Method Summary collapse

Class Method Details

.find(game:, start_period: 0, end_period: 14, client: CLIENT) ⇒ Collection

Retrieves play-by-play V3 data for a game

Examples:

plays = NBA::PlayByPlayV3.find(game: "0022400001")
plays.each { |p| puts "#{p.pc_time_string}: #{p.description}" }

Parameters:

  • game (String, Game)

    the game ID or Game object

  • start_period (Integer) (defaults to: 0)

    the starting period (default 0)

  • end_period (Integer) (defaults to: 14)

    the ending period (default 14)

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:



24
25
26
27
# File 'lib/nba/play_by_play_v3.rb', line 24

def self.find(game:, start_period: 0, end_period: 14, client: CLIENT)
  path = "playbyplayv3?GameID=#{Utils.extract_id(game)}&StartPeriod=#{start_period}&EndPeriod=#{end_period}"
  ResponseParser.parse(client.get(path), result_set: RESULT_SET_NAME) { |data| build_play(data) }
end