Class: NBA::Stats::Leaders

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.all_time(leagueId = "00", perMode = "PerGame", season = "All Time", seasonType = "Regular Season", scope = "S", statCategory = "PTS") ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nba/stats/leaders.rb', line 20

def self.all_time(leagueId="00", perMode="PerGame", season="All Time", seasonType="Regular Season", scope="S", statCategory="PTS")
  res = HTTP.get(BASE_URI+'/leagueleaders', :params => {
    :LeagueID => leagueId,
    :PerMode => perMode,
    :Season => season,
    :SeasonType => seasonType,
    :Scope => scope,
    :StatCategory => statCategory
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end

.get_stats(leagueId = "00", perMode = "PerGame", season = "2015-16", seasonType = "Regular Season", scope = "S", statCategory = "PTS") ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/nba/stats/leaders.rb', line 5

def self.get_stats(leagueId="00", perMode="PerGame", season="2015-16", seasonType="Regular Season", scope="S", statCategory="PTS")
  res = HTTP.get(BASE_URI+'/leagueleaders', :params => {
    :LeagueID => leagueId,
    :PerMode => perMode,
    :Season => season,
    :SeasonType => seasonType,
    :Scope => scope,
    :StatCategory => statCategory
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end