Class: NBA::PlayByPlay

Inherits:
Object
  • Object
show all
Defined in:
lib/nba/play_by_play.rb

Constant Summary collapse

BASE_URI =
'http://stats.nba.com/stats'

Class Method Summary collapse

Class Method Details

.get_plays_for_game(game_id, start_period = 1, end_period = 10) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/nba/play_by_play.rb', line 4

def self.get_plays_for_game(game_id, start_period=1, end_period=10)
  res = HTTP.get(BASE_URI+'/playbyplayv2', :params => {
    :GameID => game_id,
    :EndPeriod => end_period,
    :StartPeriod => start_period
  })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end