nba_rb 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,197 @@
1
+ class Boxscore
2
+ include Initializable
3
+ include StatsRequest
4
+ include StatsHash
5
+
6
+ @endpoint = 'boxscore'
7
+
8
+ class << self
9
+ attr_reader :endpoint
10
+ end
11
+
12
+ def endpoint
13
+ self.class.endpoint
14
+ end
15
+
16
+ attr_accessor :game_id,
17
+ :range_type,
18
+ :start_period,
19
+ :end_period,
20
+ :start_range,
21
+ :end_range,
22
+ :data
23
+
24
+ def initialize(*args)
25
+ super(*args)
26
+
27
+ @range_type ||= RangeType.default
28
+ @start_period ||= Period.default
29
+ @end_period ||= Period.default
30
+ @start_range ||= StartRange.default
31
+ @end_range ||= EndRange.default
32
+
33
+ res = stats_request(endpoint, 'GameID' => game_id,
34
+ 'RangeType' => range_type,
35
+ 'StartPeriod' => start_period,
36
+ 'EndPeriod' => end_period,
37
+ 'StartRange' => start_range,
38
+ 'EndRange' => end_range)
39
+
40
+ @data = res['resultSets']
41
+ end
42
+
43
+ def game_summary
44
+ create_stats_hash(@data[0])
45
+ end
46
+
47
+ def line_score
48
+ create_stats_hash(@data[1])
49
+ end
50
+
51
+ def season_series
52
+ create_stats_hash(@data[2])
53
+ end
54
+
55
+ def last_meeting
56
+ create_stats_hash(@data[3])
57
+ end
58
+
59
+ def player_stats
60
+ create_stats_hash(@data[4])
61
+ end
62
+
63
+ def team_stats
64
+ create_stats_hash(@data[5])
65
+ end
66
+
67
+ def other_stats
68
+ create_stats_hash(@data[6])
69
+ end
70
+
71
+ def officials
72
+ create_stats_hash(@data[7])
73
+ end
74
+
75
+ def game_info
76
+ create_stats_hash(@data[8])
77
+ end
78
+
79
+ def inactive_players
80
+ create_stats_hash(@data[9])
81
+ end
82
+
83
+ def available_video
84
+ create_stats_hash(@data[10])
85
+ end
86
+
87
+ def player_track
88
+ create_stats_hash(@data[11])
89
+ end
90
+
91
+ def player_track_team
92
+ create_stats_hash(@data[12])
93
+ end
94
+ end
95
+
96
+ class BoxscoreScoring < Boxscore
97
+ @endpoint = 'boxscorescoring'
98
+
99
+ def endpoint
100
+ self.class.endpoint
101
+ end
102
+
103
+ def sql_players_scoring
104
+ create_stats_hash(@data[13])
105
+ end
106
+
107
+ def sql_team_scoring
108
+ create_stats_hash(@data[14])
109
+ end
110
+ end
111
+
112
+ class BoxscoreUsage < Boxscore
113
+ @endpoint = 'boxscoreusage'
114
+
115
+ def endpoint
116
+ self.class.endpoint
117
+ end
118
+
119
+ def sql_players_usage
120
+ create_stats_hash(@data[13])
121
+ end
122
+
123
+ def sql_team_usage
124
+ create_stats_hash(@data[14])
125
+ end
126
+ end
127
+
128
+ class BoxscoreMisc < Boxscore
129
+ @endpoint = 'boxscoremisc'
130
+
131
+ def endpoint
132
+ self.class.endpoint
133
+ end
134
+
135
+ def sql_players_misc
136
+ create_stats_hash(@data[13])
137
+ end
138
+
139
+ def sql_team_misc
140
+ create_stats_hash(@data[14])
141
+ end
142
+ end
143
+
144
+ class BoxscoreAdvanced < Boxscore
145
+ @endpoint = 'boxscoreadvanced'
146
+
147
+ def sql_players_advanced
148
+ create_stats_hash(@data[13])
149
+ end
150
+
151
+ def sql_team_advanced
152
+ create_stats_hash(@data[14])
153
+ end
154
+ end
155
+
156
+ class BoxscoreFourFactors < Boxscore
157
+ @endpoint = 'boxscorefourfactors'
158
+
159
+ def endpoint
160
+ self.class.endpoint
161
+ end
162
+
163
+ def sql_players_four_factors
164
+ create_stats_hash(@data[13])
165
+ end
166
+
167
+ def sql_team_four_factors
168
+ create_stats_hash(@data[14])
169
+ end
170
+ end
171
+
172
+ class PlayByPlay
173
+ include Initializable
174
+ include StatsRequest
175
+ include StatsHash
176
+
177
+ def initialize(*args)
178
+ super(*args)
179
+
180
+ @start_period ||= Period.default
181
+ @end_period ||= Period.default
182
+
183
+ res = stats_request('playbyplay', 'GameID' => @game_id,
184
+ 'StartPeriod' => start_period,
185
+ 'EndPeriod' => end_period)
186
+
187
+ @data = res['resultSets']
188
+ end
189
+
190
+ def info
191
+ create_stats_hash(@data[0])
192
+ end
193
+
194
+ def available_video
195
+ create_stats_hash(@data[1])
196
+ end
197
+ end
@@ -0,0 +1,924 @@
1
+ class Player
2
+ include Initializable
3
+ include StatsRequest
4
+ include StatsHash
5
+
6
+ attr_accessor :first_name,
7
+ :last_name,
8
+ :only_current,
9
+ :data
10
+
11
+ def initialize(*args)
12
+ super(*args)
13
+ last_formatted = last_name.downcase.capitalize
14
+ first_formatted = first_name.downcase.capitalize
15
+
16
+ name = "#{last_formatted}, #{first_formatted}"
17
+ list = PlayerList.new.info
18
+
19
+ list['rowSet'].each do |player|
20
+ @data = player if player[1] == name
21
+ end
22
+ end
23
+
24
+ def id
25
+ @data[0]
26
+ end
27
+
28
+ def player_code
29
+ @data[5]
30
+ end
31
+
32
+ def rostered?
33
+ @data[2].zero?
34
+ end
35
+
36
+ def team_id
37
+ @data[6]
38
+ end
39
+
40
+ def team_name
41
+ @data[7] + ' ' + @data[8]
42
+ end
43
+
44
+ def team_abbreviation
45
+ @data[9]
46
+ end
47
+
48
+ def team_code
49
+ @data[10]
50
+ end
51
+ end
52
+
53
+ class PlayerList
54
+ include Initializable
55
+ include StatsRequest
56
+ include StatsHash
57
+
58
+ attr_accessor :league_id,
59
+ :season,
60
+ :only_current,
61
+ :data
62
+
63
+ def initialize(*args)
64
+ super(*args)
65
+
66
+ @league_id ||= League.NBA
67
+ @season ||= NbaRb::CURRENT_SEASON
68
+ @only_current ||= 1
69
+
70
+ res = stats_request('commonallplayers', 'LeagueID' => league_id,
71
+ 'Season' => season,
72
+ 'IsOnlyCurrentSeason' => only_current)
73
+
74
+ @data = res['resultSets']
75
+ end
76
+
77
+ def info
78
+ @data[0]
79
+ end
80
+ end
81
+
82
+ class PlayerSummary
83
+ include Initializable
84
+ include StatsRequest
85
+ include StatsHash
86
+
87
+ attr_accessor :player_id,
88
+ :data
89
+
90
+ def initialize(*args)
91
+ super(*args)
92
+ @player_id ||= player_id
93
+
94
+ res = stats_request('commonplayerinfo', 'PlayerID' => player_id)
95
+
96
+ @data = res['resultSets']
97
+ end
98
+
99
+ def info
100
+ create_stats_hash(@data[0])
101
+ end
102
+
103
+ def headline_stats
104
+ create_stats_hash(@data[1])
105
+ end
106
+ end
107
+
108
+ class PlayerDashboard
109
+ include Initializable
110
+ include StatsRequest
111
+ include StatsHash
112
+
113
+ class << self
114
+ attr_reader :endpoint
115
+ end
116
+
117
+ def endpoint
118
+ self.class.endpoint
119
+ end
120
+
121
+ attr_accessor :player_id,
122
+ :team_id,
123
+ :measure_type,
124
+ :per_mode,
125
+ :plus_minus,
126
+ :pace_adjust,
127
+ :rank,
128
+ :league_id,
129
+ :season,
130
+ :season_type,
131
+ :po_round,
132
+ :outcome,
133
+ :location,
134
+ :month,
135
+ :season_segment,
136
+ :date_from,
137
+ :date_to,
138
+ :opponent_team_id,
139
+ :vs_conference,
140
+ :vs_division,
141
+ :game_segment,
142
+ :period,
143
+ :shot_clock_range,
144
+ :last_n_games,
145
+ :data
146
+
147
+ @endpoint = ''
148
+
149
+ def initialize(*args)
150
+ super(*args)
151
+
152
+ @team_id ||= 0
153
+ @measure_type ||= MeasureType.default
154
+ @per_mode ||= PerMode.default
155
+ @plus_minus ||= PlusMinus.default
156
+ @pace_adjust ||= PaceAdjust.default
157
+ @rank ||= PaceAdjust.default
158
+ @league_id ||= League.default
159
+ @season ||= NbaRb::CURRENT_SEASON
160
+ @season_type ||= SeasonType.default
161
+ @po_round ||= PlayoffRound.default
162
+ @outcome ||= Outcome.default
163
+ @location ||= Location.default
164
+ @month ||= Month.default
165
+ @season_segment ||= SeasonSegment.default
166
+ @date_from ||= DateFrom.default
167
+ @date_to ||= DateTo.default
168
+ @opponent_team_id ||= OpponentTeamID.default
169
+ @vs_conference ||= VsConference.default
170
+ @vs_division ||= VsDivision.default
171
+ @game_segment ||= GameSegment.default
172
+ @period ||= Period.default
173
+ @shot_clock_range ||= ShotClockRange.default
174
+ @last_n_games ||= LastNGames.default
175
+
176
+ res = stats_request(endpoint, 'PlayerID' => player_id,
177
+ 'TeamID' => team_id,
178
+ 'MeasureType' => measure_type,
179
+ 'PerMode' => per_mode,
180
+ 'PlusMinus' => plus_minus,
181
+ 'PaceAdjust' => pace_adjust,
182
+ 'Rank' => rank,
183
+ 'LeagueID' => league_id,
184
+ 'Season' => season,
185
+ 'SeasonType' => season_type,
186
+ 'PORound' => po_round,
187
+ 'Outcome' => outcome,
188
+ 'Location' => location,
189
+ 'Month' => month,
190
+ 'SeasonSegment' => season_segment,
191
+ 'DateFrom' => date_from,
192
+ 'DateTo' => date_to,
193
+ 'OpponentTeamID' => opponent_team_id,
194
+ 'VsConference' => vs_conference,
195
+ 'VsDivision' => vs_division,
196
+ 'GameSegment' => game_segment,
197
+ 'Period' => period,
198
+ 'ShotClockRange' => shot_clock_range,
199
+ 'LastNGames' => last_n_games)
200
+
201
+ @data = res['resultSets']
202
+ end
203
+
204
+ def overall
205
+ create_stats_hash(@data[0])
206
+ end
207
+ end
208
+
209
+ class PlayerGeneralSplits < PlayerDashboard
210
+ @endpoint = 'playerdashboardbygeneralsplits'
211
+
212
+ def location
213
+ create_stats_hash(@data[1])
214
+ end
215
+
216
+ def home
217
+ location[0]
218
+ end
219
+
220
+ def away
221
+ location[1]
222
+ end
223
+
224
+ def win_losses
225
+ create_stats_hash(@data[2])
226
+ end
227
+
228
+ def in_wins
229
+ win_losses[0]
230
+ end
231
+
232
+ def in_losses
233
+ win_losses[1]
234
+ end
235
+
236
+ def by_month
237
+ create_stats_hash(@data[3])
238
+ end
239
+
240
+ def in_october
241
+ by_month[0]
242
+ end
243
+
244
+ def in_november
245
+ by_month[1]
246
+ end
247
+
248
+ def in_december
249
+ by_month[2]
250
+ end
251
+
252
+ def in_january
253
+ by_month[3]
254
+ end
255
+
256
+ def in_february
257
+ by_month[4]
258
+ end
259
+
260
+ def in_march
261
+ by_month[5]
262
+ end
263
+
264
+ def in_april
265
+ by_month[6]
266
+ end
267
+
268
+ def in_may
269
+ by_month[7]
270
+ end
271
+
272
+ def in_june
273
+ by_month[8]
274
+ end
275
+
276
+ def pre_post_all_star
277
+ create_stats_hash(@data[4])
278
+ end
279
+
280
+ def pre_all_star
281
+ pre_post_all_star[0]
282
+ end
283
+
284
+ def post_all_star
285
+ pre_post_all_star[1]
286
+ end
287
+
288
+ def starting_position
289
+ create_stats_hash(@data[5])
290
+ end
291
+
292
+ def as_starter
293
+ starting_position[0]
294
+ end
295
+
296
+ def as_bench
297
+ starting_position[1]
298
+ end
299
+
300
+ def days_rest
301
+ create_stats_hash(@data[6])
302
+ end
303
+
304
+ def zero_rest_days
305
+ days_rest[0]
306
+ end
307
+
308
+ def one_rest_day
309
+ days_rest[1]
310
+ end
311
+
312
+ def two_rest_days
313
+ days_rest[2]
314
+ end
315
+
316
+ def three_rest_days
317
+ days_rest[3]
318
+ end
319
+
320
+ def four_rest_days
321
+ days_rest[4]
322
+ end
323
+
324
+ def six_plus_rest_days
325
+ days_rest[5]
326
+ end
327
+ end
328
+
329
+ class PlayerOpponentSplits < PlayerDashboard
330
+ @endpoint = 'playerdashboardbyopponent'
331
+
332
+ def by_conference
333
+ create_stats_hash(@data[1])
334
+ end
335
+
336
+ def vs_east
337
+ by_conference[0]
338
+ end
339
+
340
+ def vs_west
341
+ by_conference[1]
342
+ end
343
+
344
+ def by_division
345
+ create_stats_hash(@data[2])
346
+ end
347
+
348
+ def vs_division(division)
349
+ by_division.each do |hash|
350
+ return hash if hash['GROUP_VALUE'].downcase.include? division.downcase
351
+ end
352
+ end
353
+
354
+ def by_opponent
355
+ create_stats_hash(@data[3])
356
+ end
357
+
358
+ def vs_team(team)
359
+ by_opponent.each do |hash|
360
+ return hash if hash['GROUP_VALUE'].downcase.include? team.downcase
361
+ end
362
+ end
363
+ end
364
+
365
+ class PlayerLastNGamesSplits < PlayerDashboard
366
+ @endpoint = 'playerdashboardbylastngames'
367
+
368
+ def last5
369
+ create_stats_hash(@data[1])
370
+ end
371
+
372
+ def last10
373
+ create_stats_hash(@data[2])
374
+ end
375
+
376
+ def last15
377
+ create_stats_hash(@data[3])
378
+ end
379
+
380
+ def last20
381
+ create_stats_hash(@data[4])
382
+ end
383
+
384
+ def gamenumber
385
+ create_stats_hash(@data[5])
386
+ end
387
+ end
388
+
389
+ class PlayerInGameSplits < PlayerDashboard
390
+ @endpoint = 'playerdashboardbygamesplits'
391
+
392
+ def by_half
393
+ create_stats_hash(@data[1])
394
+ end
395
+
396
+ def first_half
397
+ by_half[0]
398
+ end
399
+
400
+ def second_half
401
+ by_half[1]
402
+ end
403
+
404
+ def by_period
405
+ create_stats_hash(@data[2])
406
+ end
407
+
408
+ def first_quarter
409
+ by_period[0]
410
+ end
411
+
412
+ def second_quarter
413
+ by_period[1]
414
+ end
415
+
416
+ def third_quarter
417
+ by_period[2]
418
+ end
419
+
420
+ def fourth_quarter
421
+ by_period[3]
422
+ end
423
+
424
+ def by_score_margin
425
+ create_stats_hash(@data[3])
426
+ end
427
+
428
+ def tied_games
429
+ by_score_margin[0]
430
+ end
431
+
432
+ def close_games
433
+ by_score_margin[1]
434
+ end
435
+
436
+ def by_actual_margin
437
+ create_stats_hash(@data[4])
438
+ end
439
+ end
440
+
441
+ class PlayerClutchSplits < PlayerDashboard
442
+ @endpoint = 'playerdashboardbyclutch'
443
+
444
+ def last5min_deficit_5point
445
+ ''"
446
+ Results in last 5 minutes <= 5 points
447
+ "''
448
+ create_stats_hash(@data[1])
449
+ end
450
+
451
+ def last3min_deficit_5point
452
+ ''"
453
+ Results in last 5 minutes <= 5 points
454
+ "''
455
+ create_stats_hash(@data[2])
456
+ end
457
+
458
+ def last1min_deficit_5point
459
+ ''"
460
+ Results in last 5 minutes <= 5 points
461
+ "''
462
+ create_stats_hash(@data[3])
463
+ end
464
+
465
+ def last30sec_deficit_3point
466
+ ''"
467
+ Results in last 5 minutes <= 5 points
468
+ "''
469
+ create_stats_hash(@data[4])
470
+ end
471
+
472
+ def last10sec_deficit_3point
473
+ ''"
474
+ Results in last 5 minutes <= 5 points
475
+ "''
476
+ create_stats_hash(@data[5])
477
+ end
478
+
479
+ def last5min_plusminus_5point
480
+ ''"
481
+ Last 5 minutes +/= 5 points
482
+ "''
483
+ create_stats_hash(@data[6])
484
+ end
485
+
486
+ def last3min_plusminus_5point
487
+ ''"
488
+ Last 3 minutes +/= 5 points
489
+ "''
490
+ create_stats_hash(@data[7])
491
+ end
492
+
493
+ def last1min_plusminus_5point
494
+ ''"
495
+ Last 1 minutes +/= 5 points
496
+ "''
497
+ create_stats_hash(@data[8])
498
+ end
499
+
500
+ def last30sec_plusminus_5point
501
+ ''"
502
+ Last 30 seconds +/= 3 points
503
+ "''
504
+ create_stats_hash(@data[9])
505
+ end
506
+ end
507
+
508
+ class PlayerShootingSplits < PlayerDashboard
509
+ @endpoint = 'playerdashboardbyshootingsplits'
510
+
511
+ def shot_5ft
512
+ create_stats_hash(@data[1])
513
+ end
514
+
515
+ def shot_8ft
516
+ create_stats_hash(@data[2])
517
+ end
518
+
519
+ def shot_areas
520
+ create_stats_hash(@data[3])
521
+ end
522
+
523
+ def assisted_shots
524
+ create_stats_hash(@data[4])
525
+ end
526
+
527
+ def shot_types_summary
528
+ create_stats_hash(@data[5])
529
+ end
530
+
531
+ def shot_types_detail
532
+ create_stats_hash(@data[6])
533
+ end
534
+
535
+ def assissted_by
536
+ create_stats_hash(@data[7])
537
+ end
538
+ end
539
+
540
+ class PlayerPerformanceSplits < PlayerDashboard
541
+ @endpoint = 'playerdashboardbyteamperformance'
542
+
543
+ def score_differential
544
+ create_stats_hash(@data[1])
545
+ end
546
+
547
+ def points_scored
548
+ create_stats_hash(@data[2])
549
+ end
550
+
551
+ def points_against
552
+ create_stats_hash(@data[3])
553
+ end
554
+ end
555
+
556
+ class PlayerYearOverYearSplits < PlayerDashboard
557
+ @endpoint = 'playerdashboardbyyearoveryear'
558
+
559
+ def splits_by_year
560
+ create_stats_hash(@data[1])
561
+ end
562
+
563
+ def by_year(year)
564
+ splits_by_year.each do |hash|
565
+ return hash if hash['GROUP_VALUE'].include? year
566
+ end
567
+ end
568
+ end
569
+
570
+ class PlayerCareer
571
+ include Initializable
572
+ include StatsRequest
573
+ include StatsHash
574
+
575
+ class << self
576
+ attr_reader :endpoint
577
+ end
578
+
579
+ def endpoint
580
+ self.class.endpoint
581
+ end
582
+
583
+ attr_accessor :player_id,
584
+ :league_id,
585
+ :per_mode,
586
+ :data
587
+
588
+ def initialize(*args)
589
+ super(*args)
590
+
591
+ @per_mode ||= PerMode.per_game
592
+ @league_id ||= League.NBA
593
+
594
+ res = stats_request('playercareerstats', 'PlayerID' => player_id,
595
+ 'LeagueID' => league_id,
596
+ 'PerMode' => per_mode)
597
+
598
+ @data = res['resultSets']
599
+ end
600
+
601
+ def regular_season_totals
602
+ create_stats_hash(@data[0])
603
+ end
604
+
605
+ def season_totals_by_year(year)
606
+ regular_season_totals.each do |hash|
607
+ return hash if hash['SEASON_ID'].include? year
608
+ end
609
+ end
610
+
611
+ def regular_season_career_totals
612
+ create_stats_hash(@data[1])
613
+ end
614
+
615
+ def post_season_totals
616
+ create_stats_hash(@data[2])
617
+ end
618
+
619
+ def post_season_totals_by_year(year)
620
+ post_season_totals.each do |hash|
621
+ return hash if hash['SEASON_ID'].include? year
622
+ end
623
+ end
624
+
625
+ def post_season_career_totals
626
+ create_stats_hash(@data[3])
627
+ end
628
+
629
+ def all_star_season_totals
630
+ create_stats_hash(@data[4])
631
+ end
632
+
633
+ def all_star_season_totals_by_year(year)
634
+ all_star_season_totals.each do |hash|
635
+ return hash if hash['SEASON_ID'].include? year
636
+ end
637
+ end
638
+
639
+ def career_all_star_season_totals
640
+ create_stats_hash(@data[5])
641
+ end
642
+
643
+ def college_season_totals
644
+ create_stats_hash(@data[6])
645
+ end
646
+
647
+ def college_season_totals_by_year(year)
648
+ college_season_totals.each do |hash|
649
+ return hash if hash['SEASON_ID'].include? year
650
+ end
651
+ end
652
+
653
+ def career_college_season_totals
654
+ create_stats_hash(@data[7])
655
+ end
656
+
657
+ def regular_season_rankings
658
+ create_stats_hash(@data[8])
659
+ end
660
+
661
+ def regular_season_rankings_by_year(year)
662
+ regular_season_rankings.each do |hash|
663
+ return hash if hash['SEASON_ID'].include? year
664
+ end
665
+ end
666
+
667
+ def post_season_rankings
668
+ create_stats_hash(@data[9])
669
+ end
670
+
671
+ def post_season_rankings_by_year(year)
672
+ post_season_rankings.each do |hash|
673
+ return hash if hash['SEASON_ID'].include? year
674
+ end
675
+ end
676
+ end
677
+
678
+ class PlayerProfile < PlayerCareer
679
+ @endpoint = 'playerprofilev2'
680
+
681
+ def season_highs
682
+ create_stats_hash(@data[10])
683
+ end
684
+
685
+ def career_highs
686
+ create_stats_hash(@data[11])
687
+ end
688
+
689
+ def next_game
690
+ create_stats_hash(@data[12])
691
+ end
692
+ end
693
+
694
+ class PlayerGameLogs
695
+ include Initializable
696
+ include StatsRequest
697
+ include StatsHash
698
+
699
+ attr_accessor :player_id,
700
+ :league_id,
701
+ :season,
702
+ :season_type,
703
+ :data
704
+
705
+ def initialize(*args)
706
+ super(*args)
707
+
708
+ @league_id ||= League.NBA
709
+ @season ||= NbaRb::CURRENT_SEASON
710
+ @season_type ||= SeasonType.regular
711
+
712
+ res = stats_request('playergamelog', 'PlayerID' => player_id,
713
+ 'LeagueID' => league_id,
714
+ 'Season' => season,
715
+ 'SeasonType' => season_type)
716
+
717
+ @data = res['resultSets']
718
+ end
719
+
720
+ def info
721
+ create_stats_hash(@data[0])
722
+ end
723
+ end
724
+
725
+ class PlayerShotTracking < PlayerDashboard
726
+ @endpoint = 'playerdashptshots'
727
+
728
+ def general_shooting
729
+ create_stats_hash(@data[1])
730
+ end
731
+
732
+ def shot_clock_shooting
733
+ create_stats_hash(@data[2])
734
+ end
735
+
736
+ def dribble_shooting
737
+ create_stats_hash(@data[3])
738
+ end
739
+
740
+ def closest_defender_shooting
741
+ create_stats_hash(@data[4])
742
+ end
743
+
744
+ def closest_defender_shooting_long
745
+ create_stats_hash(@data[5])
746
+ end
747
+
748
+ def touch_time_shooting
749
+ create_stats_hash(@data[6])
750
+ end
751
+ end
752
+
753
+ class PlayerReboundTracking < PlayerDashboard
754
+ @endpoint = 'playerdashptreb'
755
+
756
+ def shot_type_rebounding
757
+ create_stats_hash(@data[1])
758
+ end
759
+
760
+ def num_contested_rebounding
761
+ create_stats_hash(@data[2])
762
+ end
763
+
764
+ def shot_distance_rebounding
765
+ create_stats_hash(@data[3])
766
+ end
767
+
768
+ def rebound_distance_rebounding
769
+ create_stats_hash(@data[4])
770
+ end
771
+ end
772
+
773
+ class PlayerPassTracking < PlayerDashboard
774
+ @endpoint = 'playerdashptpass'
775
+
776
+ def passes_made
777
+ create_stats_hash(@data[0])
778
+ end
779
+
780
+ def passes_recieved
781
+ create_stats_hash(@data[1])
782
+ end
783
+ end
784
+
785
+ class PlayerDefenseTracking < PlayerDashboard
786
+ @endpoint = 'playerdashptshotdefend'
787
+ end
788
+
789
+ class PlayerShotLogTracking < PlayerDashboard
790
+ @endpoint = 'playerdashptshotlog'
791
+ end
792
+
793
+ class PlayerReboundLogTracking < PlayerDashboard
794
+ @endpoint = 'playerdashptreboundlogs'
795
+ end
796
+
797
+ class PlayerVsPlayer
798
+ include Initializable
799
+ include StatsRequest
800
+ include StatsHash
801
+
802
+ attr_accessor :player_id,
803
+ :vs_player_id,
804
+ :team_id,
805
+ :measure_type,
806
+ :per_mode,
807
+ :plus_minus,
808
+ :pace_adjust,
809
+ :rank,
810
+ :league_id,
811
+ :season,
812
+ :season_type,
813
+ :po_round,
814
+ :outcome,
815
+ :location,
816
+ :month,
817
+ :season_segment,
818
+ :date_from,
819
+ :date_to,
820
+ :opponent_team_id,
821
+ :vs_conference,
822
+ :vs_division,
823
+ :game_segment,
824
+ :period,
825
+ :shot_clock_range,
826
+ :last_n_games,
827
+ :data
828
+
829
+ def initialize(*args)
830
+ super(*args)
831
+
832
+ @team_id ||= 0
833
+ @measure_type ||= MeasureType.default
834
+ @per_mode ||= PerMode.default
835
+ @plus_minus ||= PlusMinus.default
836
+ @pace_adjust ||= PaceAdjust.default
837
+ @rank ||= PaceAdjust.default
838
+ @league_id ||= League.default
839
+ @season ||= NbaRb::CURRENT_SEASON
840
+ @season_type ||= SeasonType.default
841
+ @po_round ||= PlayoffRound.default
842
+ @outcome ||= Outcome.default
843
+ @location ||= Location.default
844
+ @month ||= Month.default
845
+ @season_segment ||= SeasonSegment.default
846
+ @date_from ||= DateFrom.default
847
+ @date_to ||= DateTo.default
848
+ @opponent_team_id ||= OpponentTeamID.default
849
+ @vs_conference ||= VsConference.default
850
+ @vs_division ||= VsDivision.default
851
+ @game_segment ||= GameSegment.default
852
+ @period ||= Period.default
853
+ @shot_clock_range ||= ShotClockRange.default
854
+ @last_n_games ||= LastNGames.default
855
+
856
+ res = stats_request('playervsplayer', 'PlayerID' => player_id,
857
+ 'VsPlayerID' => vs_player_id,
858
+ 'TeamID' => team_id,
859
+ 'MeasureType' => measure_type,
860
+ 'PerMode' => per_mode,
861
+ 'PlusMinus' => plus_minus,
862
+ 'PaceAdjust' => pace_adjust,
863
+ 'Rank' => rank,
864
+ 'LeagueID' => league_id,
865
+ 'Season' => season,
866
+ 'SeasonType' => season_type,
867
+ 'PORound' => po_round,
868
+ 'Outcome' => outcome,
869
+ 'Location' => location,
870
+ 'Month' => month,
871
+ 'SeasonSegment' => season_segment,
872
+ 'DateFrom' => date_from,
873
+ 'DateTo' => date_to,
874
+ 'OpponentTeamID' => opponent_team_id,
875
+ 'VsConference' => vs_conference,
876
+ 'VsDivision' => vs_division,
877
+ 'GameSegment' => game_segment,
878
+ 'Period' => period,
879
+ 'ShotClockRange' => shot_clock_range,
880
+ 'LastNGames' => last_n_games)
881
+
882
+ @data = res['resultSets']
883
+ end
884
+
885
+ def overall
886
+ create_stats_hash(@data[0])
887
+ end
888
+
889
+ def on_off_court
890
+ create_stats_hash(@data[1])
891
+ end
892
+
893
+ def shot_distance_overall
894
+ create_stats_hash(@data[2])
895
+ end
896
+
897
+ def shot_distance_on_court
898
+ create_stats_hash(@data[3])
899
+ end
900
+
901
+ def shot_distance_off_court
902
+ create_stats_hash(@data[4])
903
+ end
904
+
905
+ def shot_area_overall
906
+ create_stats_hash(@data[5])
907
+ end
908
+
909
+ def shot_area_on_court
910
+ create_stats_hash(@data[6])
911
+ end
912
+
913
+ def shot_area_off_court
914
+ create_stats_hash(@data[7])
915
+ end
916
+
917
+ def player_info
918
+ create_stats_hash(@data[8])
919
+ end
920
+
921
+ def vs_player_info
922
+ create_stats_hash(@data[9])
923
+ end
924
+ end