Module: NBA::Games

Defined in:
lib/nba/games.rb

Overview

Provides methods to retrieve NBA games

Class Method Summary collapse

Class Method Details

.find(game_id, client: CLIENT) ⇒ Game?

Finds a game by ID

Examples:

game = NBA::Games.find("0022400001")
puts "#{game.away_team.name} @ #{game.home_team.name}: #{game.away_score}-#{game.home_score}"


22
23
24
25
26
27
# File 'lib/nba/games.rb', line 22

def self.find(game_id, client: CLIENT)
  return unless game_id

  path = "boxscoresummaryv2?GameID=#{game_id}"
  ResponseParser.parse_single(client.get(path), result_set: "GameSummary") { |data| build_game(data) }
end