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

"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}" }


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