Class: NBA::Stats::Player

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.get_clutch_stats(measureType = "Base", perMode = "PerGame", plusMinus = "N", paceAdjust = "N", rank = "N", leagueID = "00", season = "2015-16", seasonType = "Regular Season", pORound = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, teamID = 0, conference = nil, division = nil, gameSegment = nil, period = 0, shotClockRange = nil, lastNGames = 0, clutchTime = "Last 5 Minutes", aheadBehind = "Ahead or Behind", pointDiff = 5, gameScope = nil, playerExperience = nil, playerPosition = nil, starterBench = nil, draftYear = nil, draftPick = nil, college = nil, country = nil, height = nil, weight = nil) ⇒ 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
88
89
90
91
92
93
94
# File 'lib/nba/stats/player_stats.rb', line 49

def self.get_clutch_stats(measureType="Base",perMode="PerGame",plusMinus="N",paceAdjust="N",rank="N",leagueID="00",season="2015-16",seasonType="Regular Season",pORound=0,outcome=nil,location=nil,month=0,seasonSegment=nil,dateFrom=nil,dateTo=nil,opponentTeamID=0,vsConference=nil,vsDivision=nil,teamID=0,conference=nil,division=nil,gameSegment=nil,period=0,shotClockRange=nil,lastNGames=0,clutchTime="Last 5 Minutes",aheadBehind="Ahead or Behind",pointDiff=5,gameScope=nil,playerExperience=nil,playerPosition=nil,starterBench=nil,draftYear=nil,draftPick=nil,college=nil,country=nil,height=nil,weight=nil)
  res = HTTP.get(BASE_URI+'/leaguedashplayerclutch', :params => {
    :MeasureType => measureType,
    :PerMode => perMode,
    :PlusMinus => plusMinus,
    :PaceAdjust => paceAdjust,
    :Rank => rank,
    :LeagueID => leagueID,
    :Season => season,
    :SeasonType => seasonType,
    :PORound => pORound,
    :Outcome => outcome,
    :Location => location,
    :Month => month,
    :SeasonSegment => seasonSegment,
    :DateFrom => dateFrom,
    :DateTo => dateTo,
    :OpponentTeamID => opponentTeamID,
    :VsConference => vsConference,
    :VsDivision => vsDivision,
    :TeamID => teamID,
    :Conference => conference,
    :Division => division,
    :GameSegment => gameSegment,
    :Period => period,
    :ShotClockRange => shotClockRange,
    :LastNGames => lastNGames,
    :ClutchTime => clutchTime,
    :AheadBehind => aheadBehind,
    :PointDiff => pointDiff,
    :GameScope => gameScope,
    :PlayerExperience => playerExperience,
    :PlayerPosition => playerPosition,
    :StarterBench => starterBench,
    :DraftYear => draftYear,
    :DraftPick => draftPick,
    :College => college,
    :Country => country,
    :Height => height,
    :Weight => weight
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end

.get_dashboard_general(measureType = "Base", perMode = "PerGame", plusMinus = "N", paceAdjust = "N", rank = "N", season = "2015-16", seasonType = "Regular Season", playerId = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, gameSegment = nil, period = 0, lastNGames = 0) ⇒ Object



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/stats/player_stats.rb', line 96

def self.get_dashboard_general(measureType="Base",perMode="PerGame",plusMinus="N",paceAdjust="N",rank="N",season="2015-16",seasonType="Regular Season",playerId=0,outcome=nil,location=nil,month=0,seasonSegment=nil,dateFrom=nil,dateTo=nil,opponentTeamID=0,vsConference=nil,vsDivision=nil,gameSegment=nil,period=0,lastNGames=0)
   res = HTTP.headers(:referer => "http://stats.nba.com").get(BASE_URI+'/playerdashboardbygeneralsplits', :params => {
     :MeasureType => measureType,
     :PerMode  => perMode,
     :PlusMinus => plusMinus,
     :PaceAdjust => paceAdjust,
     :Rank => rank,
     :Season => season,
     :SeasonType => seasonType,
     :PlayerID => playerId,
     :Outcome => outcome,
     :Location => location,
     :Month => month,
     :SeasonSegment => seasonSegment,
     :DateFrom => dateFrom,
     :DateTo => dateTo,
     :OpponentTeamID => opponentTeamID,
     :VsConference => vsConference,
     :VsDivision => vsDivision,
     :GameSegment => gameSegment,
     :Period => period,
     :LastNGames => lastNGames
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return JSON.parse(res.body)
end

.get_stats(measureType = "Base", perMode = "PerGame", plusMinus = "N", paceAdjust = "N", rank = "N", leagueID = "00", season = "2015-16", seasonType = "Regular Season", pORound = 0, outcome = nil, location = nil, month = 0, seasonSegment = nil, dateFrom = nil, dateTo = nil, opponentTeamID = 0, vsConference = nil, vsDivision = nil, teamID = 0, conference = nil, division = nil, gameSegment = nil, period = 0, shotClockRange = nil, lastNGames = 0, gameScope = nil, playerExperience = nil, playerPosition = nil, starterBench = nil, draftYear = nil, draftPick = nil, college = nil, country = nil, height = nil, weight = 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/stats/player_stats.rb', line 5

def self.get_stats(measureType="Base", perMode="PerGame", plusMinus="N", paceAdjust="N", rank="N", leagueID="00", season="2015-16", seasonType="Regular Season", pORound=0, outcome=nil, location=nil, month=0, seasonSegment=nil, dateFrom=nil, dateTo=nil, opponentTeamID=0, vsConference=nil, vsDivision=nil, teamID=0, conference=nil, division=nil, gameSegment=nil, period=0, shotClockRange=nil, lastNGames=0, gameScope=nil, playerExperience=nil, playerPosition=nil, starterBench=nil, draftYear=nil, draftPick=nil, college=nil, country=nil, height=nil, weight=nil)
  res = HTTP.headers(:referer => "http://stats.nba.com").get(BASE_URI+'/leaguedashplayerstats', :params => {
    :MeasureType => measureType,
    :PerMode => perMode,
    :PlusMinus => plusMinus,
    :PaceAdjust => paceAdjust,
    :Rank => rank,
    :LeagueID => leagueID,
    :Season => season,
    :SeasonType => seasonType,
    :PORound => pORound,
    :Outcome => outcome,
    :Location => location,
    :Month => month,
    :SeasonSegment => seasonSegment,
    :DateFrom => dateFrom,
    :DateTo => dateTo,
    :OpponentTeamID => opponentTeamID,
    :VsConference => vsConference,
    :VsDivision => vsDivision,
    :TeamID => teamID,
    :Conference => conference,
    :Division => division,
    :GameSegment => gameSegment,
    :Period => period,
    :ShotClockRange => shotClockRange,
    :LastNGames => lastNGames,
    :GameScope => gameScope,
    :PlayerExperience => playerExperience,
    :PlayerPosition => playerPosition,
    :StarterBench => starterBench,
    :DraftYear => draftYear,
    :DraftPick => draftPick,
    :College => college,
    :Country => country,
    :Height => height,
    :Weight => weight
    })
  if res.code == 200
    return JSON.parse(res.body)
  end
  return res.code
end