Class: NBA::Tracking::Stats

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.get_player_defense(perMode = "PerGame", leagueID = "00", season = "2015-16", seasonType = "Regular Season", pORound = 0, playerID = nil, teamID = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, conference = nil, division = nil, gameSegment = nil, period = 0, lastNGames = 0, draftYear = nil, draftPick = nil, college = nil, country = nil, height = nil, weight = nil, playerExperience = nil, playerPosition = nil, starterBench = nil, defenseCategory = "Overall") ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/nba/tracking/tracking_stats.rb', line 49

def self.get_player_defense(perMode="PerGame",leagueID="00",season="2015-16",seasonType="Regular Season",pORound=0,playerID=nil,teamID=0,outcome=nil,location=nil,month=0,seasonSegment=nil,dateFrom=nil,dateTo=nil,opponentTeamID=0,vsConference=nil,vsDivision=nil,conference=nil,division=nil,gameSegment=nil,period=0,lastNGames=0,draftYear=nil,draftPick=nil,college=nil,country=nil,height=nil,weight=nil,playerExperience=nil,playerPosition=nil,starterBench=nil,defenseCategory="Overall")
  res = HTTP.get(BASE_URI+'/leaguedashptdefend', :params => {
      :PerMode => perMode,
      :LeagueID => leagueID,
      :Season => season,
      :SeasonType => seasonType,
      :PORound => pORound,
      :PlayerID => playerID,
      :TeamID => teamID,
      :Outcome => outcome,
      :Location => location,
      :Month => month,
      :SeasonSegment => seasonSegment,
      :DateFrom => dateFrom,
      :DateTo => dateTo,
      :OpponentTeamID => opponentTeamID,
      :VsConference => vsConference,
      :VsDivision => vsDivision,
      :Conference => conference,
      :Division => division,
      :GameSegment => gameSegment,
      :Period => period,
      :LastNGames => lastNGames,
      :DraftYear => draftYear,
      :DraftPick => draftPick,
      :College => college,
      :Country => country,
      :Height => height,
      :Weight => weight,
      :PlayerExperience => playerExperience,
      :PlayerPosition => playerPosition,
      :StarterBench => starterBench,
      :DefenseCategory => defenseCategory
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end

.get_player_shots(perMode = "PerGame", leagueID = "00", season = "2015-16", seasonType = "Regular Season", pORound = 0, closeDefDistRange = nil, shotClockRange = nil, shotDistRange = nil, touchTimeRange = nil, dribbleRange = nil, generalRange = "Overall", teamID = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, conference = nil, division = nil, gameSegment = nil, period = 0, lastNGames = 0, draftYear = nil, draftPick = nil, college = nil, country = nil, height = nil, weight = nil, playerExperience = nil, playerPosition = nil, starterBench = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/nba/tracking/tracking_stats.rb', line 5

def self.get_player_shots(perMode="PerGame",leagueID="00",season="2015-16",seasonType="Regular Season",pORound=0,closeDefDistRange=nil,shotClockRange=nil,shotDistRange=nil,touchTimeRange=nil,dribbleRange=nil,generalRange="Overall",teamID=0,outcome=nil,location=nil,month=0,seasonSegment=nil,dateFrom=nil,dateTo=nil,opponentTeamID=0,vsConference=nil,vsDivision=nil,conference=nil,division=nil,gameSegment=nil,period=0,lastNGames=0,draftYear=nil,draftPick=nil,college=nil,country=nil,height=nil,weight=nil,playerExperience=nil,playerPosition=nil,starterBench=nil)
  res = HTTP.get(BASE_URI+'/leaguedashplayerptshot', :params => {
      :PerMode => perMode,
      :LeagueID => leagueID,
      :Season => season,
      :SeasonType => seasonType,
      :PORound => pORound,
      :CloseDefDistRange => closeDefDistRange,
      :ShotClockRange => shotClockRange,
      :ShotDistRange => shotDistRange,
      :TouchTimeRange => touchTimeRange,
      :DribbleRange => dribbleRange,
      :GeneralRange => generalRange,
      :TeamID => teamID,
      :Outcome => outcome,
      :Location => location,
      :Month => month,
      :SeasonSegment => seasonSegment,
      :DateFrom => dateFrom,
      :DateTo => dateTo,
      :OpponentTeamID => opponentTeamID,
      :VsConference => vsConference,
      :VsDivision => vsDivision,
      :Conference => conference,
      :Division => division,
      :GameSegment => gameSegment,
      :Period => period,
      :LastNGames => lastNGames,
      :DraftYear => draftYear,
      :DraftPick => draftPick,
      :College => college,
      :Country => country,
      :Height => height,
      :Weight => weight,
      :PlayerExperience => playerExperience,
      :PlayerPosition => playerPosition,
      :StarterBench => starterBench
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end

.get_team_defense(perMode = "PerGame", leagueID = "00", season = "2015-16", seasonType = "Regular Season", pORound = 0, teamID = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, conference = nil, division = nil, gameSegment = nil, period = 0, lastNGames = 0, defenseCategory = "Overall") ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/nba/tracking/tracking_stats.rb', line 125

def self.get_team_defense(perMode="PerGame",leagueID="00",season="2015-16",seasonType="Regular Season",pORound=0,teamID=0,outcome=nil,location=nil,month=0,seasonSegment=nil,dateFrom=nil,dateTo=nil,opponentTeamID=0,vsConference=nil,vsDivision=nil,conference=nil,division=nil,gameSegment=nil,period=0,lastNGames=0,defenseCategory="Overall")
  res = HTTP.get(BASE_URI+'/leaguedashptteamdefend', :params => {
      :PerMode => perMode,
      :LeagueID => leagueID,
      :Season => season,
      :SeasonType => seasonType,
      :PORound => pORound,
      :TeamID => teamID,
      :Outcome => outcome,
      :Location => location,
      :Month => month,
      :SeasonSegment => seasonSegment,
      :DateFrom => dateFrom,
      :DateTo => dateTo,
      :OpponentTeamID => opponentTeamID,
      :VsConference => vsConference,
      :VsDivision => vsDivision,
      :Conference => conference,
      :Division => division,
      :GameSegment => gameSegment,
      :Period => period,
      :LastNGames => lastNGames,
      :DefenseCategory => defenseCategory
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end

.get_team_shots(perMode = "PerGame", leagueID = "00", season = "2015-16", seasonType = "Regular Season", pORound = 0, closeDefDistRange = nil, shotClockRange = nil, shotDistRange = nil, touchTimeRange = nil, dribbleRange = nil, generalRange = "Overall", teamID = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, conference = nil, division = nil, gameSegment = nil, period = 0, lastNGames = 0) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/nba/tracking/tracking_stats.rb', line 90

def self.get_team_shots(perMode="PerGame",leagueID="00",season="2015-16",seasonType="Regular Season",pORound=0,closeDefDistRange=nil,shotClockRange=nil,shotDistRange=nil,touchTimeRange=nil,dribbleRange=nil,generalRange="Overall",teamID=0,outcome=nil,location=nil,month=0,seasonSegment=nil,dateFrom=nil,dateTo=nil,opponentTeamID=0,vsConference=nil,vsDivision=nil,conference=nil,division=nil,gameSegment=nil,period=0,lastNGames=0)
  res = HTTP.get(BASE_URI+'/leaguedashteamptshot', :params => {
      :PerMode => perMode,
      :LeagueID => leagueID,
      :Season => season,
      :SeasonType => seasonType,
      :PORound => pORound,
      :CloseDefDistRange => closeDefDistRange,
      :ShotClockRange => shotClockRange,
      :ShotDistRange => shotDistRange,
      :TouchTimeRange => touchTimeRange,
      :DribbleRange => dribbleRange,
      :GeneralRange => generalRange,
      :TeamID => teamID,
      :Outcome => outcome,
      :Location => location,
      :Month => month,
      :SeasonSegment => seasonSegment,
      :DateFrom => dateFrom,
      :DateTo => dateTo,
      :OpponentTeamID => opponentTeamID,
      :VsConference => vsConference,
      :VsDivision => vsDivision,
      :Conference => conference,
      :Division => division,
      :GameSegment => gameSegment,
      :Period => period,
      :LastNGames => lastNGames
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end