nba_stats 0.9.0
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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +21 -0
- data/.idea/modules.xml +9 -0
- data/.idea/nba_stats.iml +43 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +782 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +68 -0
- data/Rakefile +45 -0
- data/lib/nba_stats/client.rb +135 -0
- data/lib/nba_stats/configuration.rb +37 -0
- data/lib/nba_stats/constants.rb +96 -0
- data/lib/nba_stats/discovery/discovery.rb +193 -0
- data/lib/nba_stats/errors.rb +9 -0
- data/lib/nba_stats/helper.rb +10 -0
- data/lib/nba_stats/resources/box_score.rb +35 -0
- data/lib/nba_stats/resources/box_score_advanced.rb +38 -0
- data/lib/nba_stats/resources/box_score_four_factors.rb +38 -0
- data/lib/nba_stats/resources/box_score_misc.rb +38 -0
- data/lib/nba_stats/resources/box_score_scoring.rb +38 -0
- data/lib/nba_stats/resources/box_score_usage.rb +38 -0
- data/lib/nba_stats/resources/common_all_players.rb +23 -0
- data/lib/nba_stats/resources/common_player_info.rb +24 -0
- data/lib/nba_stats/resources/common_team_roster.rb +24 -0
- data/lib/nba_stats/resources/common_team_years.rb +24 -0
- data/lib/nba_stats/resources/draft_combine_drill_results.rb +24 -0
- data/lib/nba_stats/resources/draft_combine_non_stationary_shooting.rb +24 -0
- data/lib/nba_stats/resources/draft_combine_player_anthro.rb +24 -0
- data/lib/nba_stats/resources/draft_combine_spot_shooting.rb +24 -0
- data/lib/nba_stats/resources/draft_combine_stats.rb +24 -0
- data/lib/nba_stats/resources/franchise_history.rb +25 -0
- data/lib/nba_stats/resources/home_page_leaders.rb +26 -0
- data/lib/nba_stats/resources/league_dash_lineups.rb +24 -0
- data/lib/nba_stats/resources/league_dash_player_stats.rb +24 -0
- data/lib/nba_stats/resources/play_by_play.rb +25 -0
- data/lib/nba_stats/resources/player_career_stats.rb +29 -0
- data/lib/nba_stats/resources/player_profile.rb +31 -0
- data/lib/nba_stats/resources/resource_base.rb +86 -0
- data/lib/nba_stats/resources/scoreboard.rb +29 -0
- data/lib/nba_stats/resources/shot_chart_detail.rb +25 -0
- data/lib/nba_stats/resources/team_game_log.rb +23 -0
- data/lib/nba_stats/resources/team_info_common.rb +24 -0
- data/lib/nba_stats/resources/team_year_by_year_stats.rb +24 -0
- data/lib/nba_stats/stats/box_score.rb +42 -0
- data/lib/nba_stats/stats/box_score_advanced.rb +41 -0
- data/lib/nba_stats/stats/box_score_four_factors.rb +41 -0
- data/lib/nba_stats/stats/box_score_misc.rb +41 -0
- data/lib/nba_stats/stats/box_score_scoring.rb +41 -0
- data/lib/nba_stats/stats/box_score_usage.rb +41 -0
- data/lib/nba_stats/stats/common_all_players.rb +33 -0
- data/lib/nba_stats/stats/common_player_info.rb +33 -0
- data/lib/nba_stats/stats/common_team_roster.rb +33 -0
- data/lib/nba_stats/stats/common_team_years.rb +26 -0
- data/lib/nba_stats/stats/draft_combine_drill_results.rb +29 -0
- data/lib/nba_stats/stats/draft_combine_non_stationary_shooting.rb +29 -0
- data/lib/nba_stats/stats/draft_combine_player_anthro.rb +29 -0
- data/lib/nba_stats/stats/draft_combine_spot_shooting.rb +29 -0
- data/lib/nba_stats/stats/draft_combine_stats.rb +29 -0
- data/lib/nba_stats/stats/franchise_history.rb +26 -0
- data/lib/nba_stats/stats/home_page_leaders.rb +44 -0
- data/lib/nba_stats/stats/league_dash_lineups.rb +107 -0
- data/lib/nba_stats/stats/league_dash_player_stats.rb +104 -0
- data/lib/nba_stats/stats/play_by_play.rb +32 -0
- data/lib/nba_stats/stats/player_career_stats.rb +32 -0
- data/lib/nba_stats/stats/player_profile.rb +45 -0
- data/lib/nba_stats/stats/scoreboard.rb +33 -0
- data/lib/nba_stats/stats/shot_chart_detail.rb +95 -0
- data/lib/nba_stats/stats/team_game_log.rb +36 -0
- data/lib/nba_stats/stats/team_info_common.rb +36 -0
- data/lib/nba_stats/stats/team_year_by_year_stats.rb +38 -0
- data/lib/nba_stats/version.rb +3 -0
- data/lib/nba_stats.rb +8 -0
- data/nba_stats.gemspec +28 -0
- data/spec/client/box_score_advanced_spec.rb +30 -0
- data/spec/client/box_score_four_factors_spec.rb +30 -0
- data/spec/client/box_score_misc_spec.rb +30 -0
- data/spec/client/box_score_scoring_spec.rb +30 -0
- data/spec/client/box_score_spec.rb +30 -0
- data/spec/client/box_score_usage_spec.rb +30 -0
- data/spec/client/common_all_players_spec.rb +27 -0
- data/spec/client/common_player_info_spec.rb +33 -0
- data/spec/client/common_team_roster_spec.rb +27 -0
- data/spec/client/common_team_years_spec.rb +27 -0
- data/spec/client/draft_combine_drill_results_spec.rb +27 -0
- data/spec/client/draft_combine_non_stationary_shooting_spec.rb +27 -0
- data/spec/client/draft_combine_player_anthro_spec.rb +27 -0
- data/spec/client/draft_combine_spot_shooting_spec.rb +27 -0
- data/spec/client/draft_combine_stats_spec.rb +27 -0
- data/spec/client/franchise_history_spec.rb +30 -0
- data/spec/client/home_page_leaders_spec.rb +27 -0
- data/spec/client/league_dash_lineups_spec.rb +27 -0
- data/spec/client/league_dash_player_stats_spec.rb +27 -0
- data/spec/client/play_by_play_spec.rb +30 -0
- data/spec/client/player_career_stats_spec.rb +30 -0
- data/spec/client/player_profile_spec.rb +30 -0
- data/spec/client/scoreboard_spec.rb +30 -0
- data/spec/client/shot_chart_detail_spec.rb +27 -0
- data/spec/client/team_game_log_spec.rb +27 -0
- data/spec/client/team_info_common_spec.rb +30 -0
- data/spec/client/team_year_by_year_stats_spec.rb +30 -0
- data/spec/client_spec.rb +17 -0
- data/spec/configuration_spec.rb +38 -0
- data/spec/nba_stats_spec.rb +13 -0
- data/spec/spec_helper.rb +21 -0
- metadata +268 -0
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 TODO: Write your name
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# NbaStats
|
|
2
|
+
|
|
3
|
+
A ruby interface for the NBA.com stats JSON API.
|
|
4
|
+
|
|
5
|
+
## Author
|
|
6
|
+
|
|
7
|
+
https://twitter.com/dagrz
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
gem 'nba_stats'
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
To get started, create a new client:
|
|
18
|
+
|
|
19
|
+
require 'nba_stats'
|
|
20
|
+
|
|
21
|
+
client = NbaStats::Client.new
|
|
22
|
+
|
|
23
|
+
Use the client to call a function, which returns a resource:
|
|
24
|
+
|
|
25
|
+
my_resource = client.an_nba_stats_function
|
|
26
|
+
|
|
27
|
+
Get the result set array you want to use:
|
|
28
|
+
|
|
29
|
+
my_result_set = my_resource.a_resource_result_set
|
|
30
|
+
|
|
31
|
+
Get a row from the result set:
|
|
32
|
+
|
|
33
|
+
my_row = my_result_set[0]
|
|
34
|
+
|
|
35
|
+
Get an item value from the row:
|
|
36
|
+
|
|
37
|
+
my_item = my_row[:an_item_name]
|
|
38
|
+
|
|
39
|
+
List of available functions:
|
|
40
|
+
|
|
41
|
+
# client.
|
|
42
|
+
scoreboard
|
|
43
|
+
box_score
|
|
44
|
+
box_score_four_factors
|
|
45
|
+
box_score_usage
|
|
46
|
+
box_score_scoring
|
|
47
|
+
box_score_misc
|
|
48
|
+
box_score_advanced
|
|
49
|
+
common_all_players
|
|
50
|
+
common_player_info
|
|
51
|
+
player_profile
|
|
52
|
+
player_career_stats
|
|
53
|
+
team_info_common
|
|
54
|
+
common_team_roster
|
|
55
|
+
team_game_log
|
|
56
|
+
team_year_by_year_stats
|
|
57
|
+
common_team_years
|
|
58
|
+
franchise_history
|
|
59
|
+
shot_chart_detail
|
|
60
|
+
play_by_play
|
|
61
|
+
league_dash_lineups
|
|
62
|
+
league_dash_player_stats
|
|
63
|
+
home_page_leaders
|
|
64
|
+
draft_combine_player_anthro
|
|
65
|
+
draft_combine_drill_results
|
|
66
|
+
draft_combine_non_stationary_shooting
|
|
67
|
+
draft_combine_spot_shooting
|
|
68
|
+
draft_combine_stats
|
data/Rakefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
2
|
+
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
5
|
+
|
|
6
|
+
require 'nba_stats'
|
|
7
|
+
require 'nba_stats/discovery/discovery'
|
|
8
|
+
desc 'Discover an NBA.com stats API endpoint'
|
|
9
|
+
task :discover do
|
|
10
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/scoreboard?LeagueID=00&gameDate=03%2F05%2F2014&DayOffset=0&date=Wed+Mar+05+2014+00%3A00%3A00+GMT%2B1100+(EST)')
|
|
11
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/boxscore?GameID=0021300904&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0')
|
|
12
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/commonallplayers?LeagueID=00&Season=2013-14&IsOnlyCurrentSeason=0')
|
|
13
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/commonplayerinfo?PlayerID=201567&SeasonType=Regular+Season&LeagueID=00')
|
|
14
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/playerprofile?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&PlayerID=201567&GraphStartSeason=2008-09&GraphEndSeason=2014-15&GraphStat=PTS')
|
|
15
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/teaminfocommon?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&TeamID=1610612746')
|
|
16
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/commonteamroster?Season=2013-14&LeagueID=00&TeamID=1610612746')
|
|
17
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/teamgamelog?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&TeamID=1610612746')
|
|
18
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/teamyearbyyearstats?LeagueID=00&PerMode=Totals&SeasonType=Regular+Season&TeamID=1610612755&Season=2013-14')
|
|
19
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/commonteamyears?LeagueID=00')
|
|
20
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/shotchartdetail?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&TeamID=1610612755&PlayerID=0&GameID=&Outcome=&Location=&Month=0&SeasonSegment=&DateFrom=&DateTo=&OpponentTeamID=0&VsConference=&VsDivision=&Position=&RookieYear=&GameSegment=&Period=0&LastNGames=0&ContextFilter=&ContextMeasure=FG_PCT')
|
|
21
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/playbyplay?GameID=0021300901&StartPeriod=0&EndPeriod=0')
|
|
22
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/boxscorefourfactors?GameID=0021300901&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0')
|
|
23
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/boxscoreusage?GameID=0021300901&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0')
|
|
24
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/boxscorescoring?GameID=0021300901&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0')
|
|
25
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/boxscoremisc?GameID=0021300901&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0')
|
|
26
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/boxscoreadvanced?GameID=0021300901&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0')
|
|
27
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/leaguedashlineups?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&TeamID=&MeasureType=Base&PerMode=PerGame&PlusMinus=N&PaceAdjust=N&Rank=N&Outcome=&Location=&Month=0&SeasonSegment=&DateFrom=&DateTo=&OpponentTeamID=0&VsConference=&VsDivision=&GameSegment=&Period=0&LastNGames=0&GroupQuantity=5&GameScope=&PlayerExperience=&PlayerPosition=&StarterBench=')
|
|
28
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/leaguedashplayerstats?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&MeasureType=Base&PerMode=PerGame&PlusMinus=N&PaceAdjust=N&Rank=N&Outcome=&Location=&Month=0&SeasonSegment=&DateFrom=&DateTo=&OpponentTeamID=0&VsConference=&VsDivision=&GameSegment=&Period=0&LastNGames=0&GameScope=&PlayerExperience=&PlayerPosition=&StarterBench=&Conf=Both')
|
|
29
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/playercareerstats?PlayerID=201609&LeagueID=00&PerMode=Totals')
|
|
30
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/homepageleaders?Season=2013-14&SeasonType=Playoffs&LeagueID=00&GameScope=Season&StatCategory=Points&PlayerScope=All+Players&PlayerOrTeam=Team')
|
|
31
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/franchisehistory?LeagueID=00')
|
|
32
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/draftcombineplayeranthro?LeagueID=00&SeasonYear=2014-15')
|
|
33
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/draftcombinedrillresults?LeagueID=00&SeasonYear=2014-15')
|
|
34
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/draftcombinenonstationaryshooting?LeagueID=00&SeasonYear=2014-15')
|
|
35
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/draftcombinespotshooting?LeagueID=00&SeasonYear=2014-15')
|
|
36
|
+
puts NbaStats::Discovery.discover('http://stats.nba.com/stats/draftcombinestats?LeagueID=00&SeasonYear=2014-15')
|
|
37
|
+
|
|
38
|
+
# These are non standard in some way
|
|
39
|
+
# puts NbaStats::Discovery.discover('http://stats.nba.com/stats/videoevents?LeagueID=00&Season=2012-13&SeasonType=Regular+Season&TeamID=0&PlayerID=0&GameID=0021300901&Outcome=&Location=&Month=0&SeasonSegment=&DateFrom=&DateTo=&OpponentTeamID=0&VsConference=&VsDivision=&Position=&RookieYear=&GameSegment=&Period=0&LastNGames=0&ClutchTime=&AheadBehind=&PointDiff=&RangeType=1&StartPeriod=1&EndPeriod=10&StartRange=0&EndRange=0&ContextFilter=&ContextMeasure=FG_PCT&GameEventID=4')
|
|
40
|
+
# puts NbaStats::Discovery.discover('http://stats.nba.com/stats/leaguedashteamstats?Season=2013-14&AllStarSeason=2013-14&SeasonType=All+Star&LeagueID=00&MeasureType=Base&PerMode=Totals&PlusMinus=N&PaceAdjust=N&Rank=N&Outcome=&Location=&Month=0&SeasonSegment=&DateFrom=&DateTo=&OpponentTeamID=0&VsConference=&VsDivision=&GameSegment=&Period=0&LastNGames=0&GameScope=&PlayerExperience=&PlayerPosition=&StarterBench=')
|
|
41
|
+
# puts NbaStats::Discovery.discover('http://stats.nba.com/stats/leaderstiles?Season=2013-14&SeasonType=Regular+Season&LeagueID=00&Stat=REB&PlayerOrTeam=Player&GameScope=Season&PlayerScope=All+Players')
|
|
42
|
+
# puts NbaStats::Discovery.discover('http://stats.nba.com/stats/leagueleaders?LeagueID=00&PerMode=PerGame&StatCategory=PTS&Season=All+Time&SeasonType=Regular+Season&Scope=S')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
require 'rest_client'
|
|
2
|
+
require 'addressable/uri'
|
|
3
|
+
require 'nba_stats/configuration'
|
|
4
|
+
require 'nba_stats/stats/scoreboard'
|
|
5
|
+
require 'nba_stats/stats/box_score'
|
|
6
|
+
require 'nba_stats/stats/common_all_players'
|
|
7
|
+
require 'nba_stats/stats/common_player_info'
|
|
8
|
+
require 'nba_stats/stats/player_profile'
|
|
9
|
+
require 'nba_stats/stats/team_info_common'
|
|
10
|
+
require 'nba_stats/stats/common_team_roster'
|
|
11
|
+
require 'nba_stats/stats/team_game_log'
|
|
12
|
+
require 'nba_stats/stats/team_year_by_year_stats'
|
|
13
|
+
require 'nba_stats/stats/common_team_years'
|
|
14
|
+
require 'nba_stats/stats/shot_chart_detail'
|
|
15
|
+
require 'nba_stats/stats/play_by_play'
|
|
16
|
+
require 'nba_stats/stats/box_score_four_factors'
|
|
17
|
+
require 'nba_stats/stats/box_score_usage'
|
|
18
|
+
require 'nba_stats/stats/box_score_scoring'
|
|
19
|
+
require 'nba_stats/stats/box_score_misc'
|
|
20
|
+
require 'nba_stats/stats/box_score_advanced'
|
|
21
|
+
require 'nba_stats/stats/league_dash_lineups'
|
|
22
|
+
require 'nba_stats/stats/league_dash_player_stats'
|
|
23
|
+
require 'nba_stats/stats/player_career_stats'
|
|
24
|
+
require 'nba_stats/stats/home_page_leaders'
|
|
25
|
+
require 'nba_stats/stats/franchise_history'
|
|
26
|
+
require 'nba_stats/stats/draft_combine_player_anthro'
|
|
27
|
+
require 'nba_stats/stats/draft_combine_drill_results'
|
|
28
|
+
require 'nba_stats/stats/draft_combine_non_stationary_shooting'
|
|
29
|
+
require 'nba_stats/stats/draft_combine_spot_shooting'
|
|
30
|
+
require 'nba_stats/stats/draft_combine_stats'
|
|
31
|
+
require 'nba_stats/errors'
|
|
32
|
+
|
|
33
|
+
module NbaStats
|
|
34
|
+
|
|
35
|
+
class Client
|
|
36
|
+
|
|
37
|
+
include NbaStats::Scoreboard
|
|
38
|
+
include NbaStats::BoxScore
|
|
39
|
+
include NbaStats::CommonAllPlayers
|
|
40
|
+
include NbaStats::CommonPlayerInfo
|
|
41
|
+
include NbaStats::PlayerProfile
|
|
42
|
+
include NbaStats::TeamInfoCommon
|
|
43
|
+
include NbaStats::CommonTeamRoster
|
|
44
|
+
include NbaStats::TeamGameLog
|
|
45
|
+
include NbaStats::TeamYearByYearStats
|
|
46
|
+
include NbaStats::CommonTeamYears
|
|
47
|
+
include NbaStats::ShotChartDetail
|
|
48
|
+
include NbaStats::PlayByPlay
|
|
49
|
+
include NbaStats::BoxScoreFourFactors
|
|
50
|
+
include NbaStats::BoxScoreUsage
|
|
51
|
+
include NbaStats::BoxScoreScoring
|
|
52
|
+
include NbaStats::BoxScoreMisc
|
|
53
|
+
include NbaStats::BoxScoreAdvanced
|
|
54
|
+
include NbaStats::LeagueDashLineups
|
|
55
|
+
include NbaStats::LeagueDashPlayerStats
|
|
56
|
+
include NbaStats::PlayerCareerStats
|
|
57
|
+
include NbaStats::HomePageLeaders
|
|
58
|
+
include NbaStats::FranchiseHistory
|
|
59
|
+
include NbaStats::DraftCombinePlayerAnthro
|
|
60
|
+
include NbaStats::DraftCombineDrillResults
|
|
61
|
+
include NbaStats::DraftCombineNonStationaryShooting
|
|
62
|
+
include NbaStats::DraftCombineSpotShooting
|
|
63
|
+
include NbaStats::DraftCombineStats
|
|
64
|
+
|
|
65
|
+
# Define the same set of accessors as the Awesome module
|
|
66
|
+
attr_accessor *Configuration::VALID_CONFIG_KEYS
|
|
67
|
+
|
|
68
|
+
# Initialize a new Client object
|
|
69
|
+
#
|
|
70
|
+
# @param options [Hash]
|
|
71
|
+
# @return [NbaStats::Client]
|
|
72
|
+
def initialize(options={})
|
|
73
|
+
# Merge the config values from the module and those passed
|
|
74
|
+
# to the client.
|
|
75
|
+
merged_options = NbaStats.options.merge(options)
|
|
76
|
+
|
|
77
|
+
# Copy the merged values to this client and ignore those
|
|
78
|
+
# not part of our configuration
|
|
79
|
+
Configuration::VALID_CONFIG_KEYS.each do |key|
|
|
80
|
+
send("#{key}=", merged_options[key])
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# @return [Hash]
|
|
85
|
+
def request_headers
|
|
86
|
+
@request_headers ||= {
|
|
87
|
+
:accept => accept,
|
|
88
|
+
:user_agent => user_agent
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Perform a HTTP GET request
|
|
93
|
+
#
|
|
94
|
+
# @param path [String]
|
|
95
|
+
# @param params [Hash]
|
|
96
|
+
# @return [Hash]
|
|
97
|
+
def get(path='/', params={})
|
|
98
|
+
uri = Addressable::URI.new
|
|
99
|
+
uri.query_values = params
|
|
100
|
+
full_path = "#{path}?#{uri.query}"
|
|
101
|
+
request(:get, full_path)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
# @return [RestClient::Resource]
|
|
107
|
+
def resource
|
|
108
|
+
@resource ||= RestClient::Resource.new(endpoint)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Send the HTTP request
|
|
112
|
+
#
|
|
113
|
+
# @param method [String]
|
|
114
|
+
# @param path [String]
|
|
115
|
+
# @return [RestClient::Response]
|
|
116
|
+
def request(method, path)
|
|
117
|
+
resource[path].send(method.to_sym, request_headers) { |response, request, result, &block|
|
|
118
|
+
case response.code
|
|
119
|
+
when 200
|
|
120
|
+
response
|
|
121
|
+
when 400
|
|
122
|
+
if response.include? ' is required'
|
|
123
|
+
raise ArgumentError.new(response)
|
|
124
|
+
else
|
|
125
|
+
raise BadRequestError.new(response)
|
|
126
|
+
end
|
|
127
|
+
else
|
|
128
|
+
response.return!(request, result, &block)
|
|
129
|
+
end
|
|
130
|
+
}
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end # Client
|
|
134
|
+
|
|
135
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module NbaStats
|
|
2
|
+
|
|
3
|
+
module Configuration
|
|
4
|
+
VALID_CONNECTION_KEYS = [:endpoint].freeze
|
|
5
|
+
VALID_OPTIONS_KEYS = [:user_agent, :accept].freeze
|
|
6
|
+
VALID_CONFIG_KEYS = VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
|
|
7
|
+
|
|
8
|
+
DEFAULT_ENDPOINT = 'http://stats.nba.com'
|
|
9
|
+
DEFAULT_USER_AGENT = "nba_stats/#{NbaStats::VERSION} ruby gem (https://github.com/dagrz/nba_stats)"
|
|
10
|
+
DEFAULT_ACCEPT = 'application/json'
|
|
11
|
+
|
|
12
|
+
# Build accessor methods for every config options so we can do this
|
|
13
|
+
attr_accessor *VALID_CONFIG_KEYS
|
|
14
|
+
|
|
15
|
+
# Make sure we have the default values set when we get 'extended'
|
|
16
|
+
def self.extended(base)
|
|
17
|
+
base.reset
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Reset all options to default values
|
|
21
|
+
def reset
|
|
22
|
+
self.endpoint = DEFAULT_ENDPOINT
|
|
23
|
+
self.user_agent = DEFAULT_USER_AGENT
|
|
24
|
+
self.accept = DEFAULT_ACCEPT
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def configure
|
|
28
|
+
yield self
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def options
|
|
32
|
+
Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end # Configuration
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module NbaStats
|
|
2
|
+
|
|
3
|
+
module Constants
|
|
4
|
+
LEAGUE_ID_NBA = '00'
|
|
5
|
+
LEAGUE_ID_WNBA = '10'
|
|
6
|
+
LEAGUE_ID_DLEAGUE = '20'
|
|
7
|
+
SEASON_TYPE_REGULAR = 'Regular Season'
|
|
8
|
+
SEASON_TYPE_PLAYOFFS = 'Playoffs'
|
|
9
|
+
SEASON_TYPE_ALL_STAR = 'All Star'
|
|
10
|
+
SEASON_SEGMENT_PRE_ALL_STAR = 'Pre All-Star'
|
|
11
|
+
SEASON_SEGMENT_POST_ALL_STAR = 'Post All-Star'
|
|
12
|
+
GRAPH_STAT_POINTS = 'PTS'
|
|
13
|
+
SEASON_FIRST = '1946-47'
|
|
14
|
+
PER_MODE_TOTALS = 'Totals'
|
|
15
|
+
PER_MODE_GAME = 'PerGame'
|
|
16
|
+
PER_MODE_MINUTES_PER = 'MinutesPer'
|
|
17
|
+
PER_MODE_48_MINUTES = 'Per48'
|
|
18
|
+
PER_MODE_40_MINUTES = 'Per40'
|
|
19
|
+
PER_MODE_36_MINUTES = 'Per36'
|
|
20
|
+
PER_MODE_MINUTE = 'PerMinute'
|
|
21
|
+
PER_MODE_POSSESSION = 'PerPossession'
|
|
22
|
+
PER_MODE_PLAY = 'PerPlay'
|
|
23
|
+
PER_MODE_100_POSSESSIONS = 'Per100Possessions'
|
|
24
|
+
PER_MODE_100_PLAYS = 'Per100Plays'
|
|
25
|
+
CONTEXT_MEASURE_FGM = 'FGM'
|
|
26
|
+
CONTEXT_MEASURE_FGA = 'FGA'
|
|
27
|
+
CONTEXT_MEASURE_FG_PCT = 'FG_PCT'
|
|
28
|
+
CONTEXT_MEASURE_FG3M = 'FG3M'
|
|
29
|
+
CONTEXT_MEASURE_FG3A = 'FG3A'
|
|
30
|
+
CONTEXT_MEASURE_FG3_PCT = 'FG3_PCT'
|
|
31
|
+
CONTEXT_MEASURE_PF = 'PF'
|
|
32
|
+
CONTEXT_MEASURE_EFG_PCT = 'EFG_PCT'
|
|
33
|
+
CONTEXT_MEASURE_TS_PCT = 'TS_PCT'
|
|
34
|
+
CONTEXT_MEASURE_PTS_FB = 'PTS_FB'
|
|
35
|
+
CONTEXT_MEASURE_PTS_OFF_TOV = 'PTS_OFF_TOV'
|
|
36
|
+
CONTEXT_MEASURE_PTS_2ND_CHANCE = 'PTS_2ND_CHANCE'
|
|
37
|
+
LOCATION_HOME = 'Home'
|
|
38
|
+
LOCATION_ROAD = 'Road'
|
|
39
|
+
OUTCOME_WIN = 'W'
|
|
40
|
+
OUTCOME_LOSS = 'L'
|
|
41
|
+
VS_CONFERENCE_EAST = 'East'
|
|
42
|
+
VS_CONFERENCE_WEST = 'West'
|
|
43
|
+
VS_DIVISION_ATLANTIC = 'Atlantic'
|
|
44
|
+
VS_DIVISION_CENTRAL = 'Central'
|
|
45
|
+
VS_DIVISION_NORTH_WEST = 'Northwest'
|
|
46
|
+
VS_DIVISION_PACIFIC = 'Pacific'
|
|
47
|
+
VS_DIVISION_SOUTH_EAST = 'Southeast'
|
|
48
|
+
VS_DIVISION_SOUTH_WEST = 'Southwest'
|
|
49
|
+
VS_DIVISION_EAST = 'East'
|
|
50
|
+
VS_DIVISION_WEST = 'West'
|
|
51
|
+
POSITION_GUARD = 'Guard'
|
|
52
|
+
POSITION_CENTER = 'Center'
|
|
53
|
+
POSITION_FORWARD = 'Forward'
|
|
54
|
+
GAME_SEGMENT_FIRST_HALF = 'First Half'
|
|
55
|
+
GAME_SEGMENT_SECOND_HALF = 'Overtime'
|
|
56
|
+
GAME_SEGMENT_OVERTIME = 'Second Half'
|
|
57
|
+
MEASURE_TYPE_BASE = 'Base'
|
|
58
|
+
MEASURE_TYPE_ADVANCED = 'Advanced'
|
|
59
|
+
MEASURE_TYPE_MISC = 'Misc'
|
|
60
|
+
MEASURE_TYPE_FOUR_FACTORS = 'Four Factors'
|
|
61
|
+
MEASURE_TYPE_SCORING = 'Scoring'
|
|
62
|
+
MEASURE_TYPE_OPPONENT = 'Opponent'
|
|
63
|
+
YES = 'Y'
|
|
64
|
+
NO = 'N'
|
|
65
|
+
GAME_SCOPE_SEASON = 'Season'
|
|
66
|
+
GAME_SCOPE_YESTERDAY = 'Yesterday'
|
|
67
|
+
GAME_SCOPE_LAST_10 = 'Last 10'
|
|
68
|
+
PLAYER_EXPERIENCE_ROOKIE = 'Rookie'
|
|
69
|
+
PLAYER_EXPERIENCE_SOPHOMORE = 'Sophomore'
|
|
70
|
+
PLAYER_EXPERIENCE_VETERAN = 'Veteran'
|
|
71
|
+
STARTER_BENCH_STARTERS = 'Starters'
|
|
72
|
+
STARTER_BENCH_BENCH = 'Bench'
|
|
73
|
+
PLAYER_POSITION_FORWARD = 'F'
|
|
74
|
+
PLAYER_POSITION_CENTER = 'C'
|
|
75
|
+
PLAYER_POSITION_GUARD = 'G'
|
|
76
|
+
PLAYER_POSITION_CENTER_FORWARD = 'C-F'
|
|
77
|
+
PLAYER_POSITION_FORWARD_CENTER = 'F-C'
|
|
78
|
+
PLAYER_POSITION_FORWARD_GUARD = 'F-G'
|
|
79
|
+
PLAYER_POSITION_GUARD_FORWARD = 'G-F'
|
|
80
|
+
CONF_BOTH = 'Both'
|
|
81
|
+
PLAYER_OR_TEAM_PLAYER = 'Player'
|
|
82
|
+
PLAYER_OR_TEAM_TEAM = 'Team'
|
|
83
|
+
PLAYER_SCOPE_ALL_PLAYERS = 'All Players'
|
|
84
|
+
PLAYER_SCOPE_ROOKIES = 'Rookies'
|
|
85
|
+
STAT_CATEGORY_POINTS = 'Points'
|
|
86
|
+
STAT_CATEGORY_REBOUNDS = 'Rebounds'
|
|
87
|
+
STAT_CATEGORY_ASSISTS = 'Assists'
|
|
88
|
+
STAT_CATEGORY_DEFENSE = 'Defense'
|
|
89
|
+
STAT_CATEGORY_CLUTCH = 'Clutch'
|
|
90
|
+
STAT_CATEGORY_PLAYMAKING = 'Playmaking'
|
|
91
|
+
STAT_CATEGORY_EFFICIENCY = 'Efficiency'
|
|
92
|
+
STAT_CATEGORY_FAST_BREAK = 'Fast Break'
|
|
93
|
+
STAT_CATEGORY_SCORING_BREAKDOWN = 'Scoring Breakdown'
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
require 'addressable/uri'
|
|
2
|
+
require 'nba_stats/client'
|
|
3
|
+
|
|
4
|
+
module NbaStats
|
|
5
|
+
|
|
6
|
+
module Discovery
|
|
7
|
+
|
|
8
|
+
# Given a full API call URI, generates template resource and stats classes
|
|
9
|
+
#
|
|
10
|
+
# @param discovery_uri [String]
|
|
11
|
+
# @return [String]
|
|
12
|
+
def self.discover(discovery_uri)
|
|
13
|
+
uri = Addressable::URI.parse(discovery_uri)
|
|
14
|
+
client = NbaStats::Client.new
|
|
15
|
+
|
|
16
|
+
output = ''
|
|
17
|
+
output += "Discovering #{class_name(uri.path).upcase}\n"
|
|
18
|
+
output += "------------------------------------------------\n"
|
|
19
|
+
output += "Path: #{uri.path}\n"
|
|
20
|
+
begin
|
|
21
|
+
client.get(uri.path, {})
|
|
22
|
+
rescue Exception => e
|
|
23
|
+
output += "Required parameters: #{e.message}\n"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
uri.query_values.each do |key, value|
|
|
27
|
+
output += "#{key.underscore}=#{value}, "
|
|
28
|
+
end
|
|
29
|
+
output += "\n"
|
|
30
|
+
|
|
31
|
+
json = JSON.parse(client.get(uri.path, uri.query_values))
|
|
32
|
+
result_sets = json['resultSets']
|
|
33
|
+
|
|
34
|
+
output += stats(uri)
|
|
35
|
+
output += "\n"
|
|
36
|
+
output += resources(uri, result_sets)
|
|
37
|
+
output += "\n"
|
|
38
|
+
output += spec(uri)
|
|
39
|
+
output += "\n"
|
|
40
|
+
output
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Returns a best guess at the potential api name given a path
|
|
44
|
+
#
|
|
45
|
+
# @param path [String]
|
|
46
|
+
# @return [String]
|
|
47
|
+
def self.class_name(path)
|
|
48
|
+
path.split('/').last
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Generates a rough stats ruby file for the api call
|
|
52
|
+
#
|
|
53
|
+
# @param uri [String]
|
|
54
|
+
# @return [String]
|
|
55
|
+
def self.stats(uri)
|
|
56
|
+
output = "------------------------------------------------\n"
|
|
57
|
+
output += "/nba_stats/stats/#{class_name(uri.path)}.rb\n"
|
|
58
|
+
output += "------------------------------------------------\n"
|
|
59
|
+
output += "require 'nba_stats/resources/#{class_name(uri.path)}'
|
|
60
|
+
|
|
61
|
+
module NbaStats
|
|
62
|
+
|
|
63
|
+
module #{class_name(uri.path)}
|
|
64
|
+
|
|
65
|
+
# The path of the #{class_name(uri.path)} API
|
|
66
|
+
#{class_name(uri.path).upcase}_PATH = '#{uri.path}'
|
|
67
|
+
|
|
68
|
+
# Calls the #{class_name(uri.path)} API and returns a #{class_name(uri.path)} resource.
|
|
69
|
+
#
|
|
70
|
+
"
|
|
71
|
+
uri.query_values.each do |key, value|
|
|
72
|
+
output += " # @param #{key.underscore} [xxxxxxxxxx]\n"
|
|
73
|
+
end
|
|
74
|
+
output+=" # @return [NbaStats::Resources::#{class_name(uri.path)}]
|
|
75
|
+
def #{class_name(uri.path)}(\n"
|
|
76
|
+
uri.query_values.each do |key, value|
|
|
77
|
+
output += " #{key.underscore}=#{value},\n"
|
|
78
|
+
end
|
|
79
|
+
output += " )
|
|
80
|
+
NbaStats::Resources::#{class_name(uri.path)}.new(
|
|
81
|
+
get(#{class_name(uri.path).upcase}_PATH, {
|
|
82
|
+
"
|
|
83
|
+
uri.query_values.each do |key, value|
|
|
84
|
+
output += " :#{key} => #{key.underscore},\n"
|
|
85
|
+
end
|
|
86
|
+
output += " })
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end # #{class_name(uri.path)}
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
"
|
|
94
|
+
output += '------------------------------------------------'
|
|
95
|
+
output
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Generates a rough resource ruby file for the api call
|
|
99
|
+
#
|
|
100
|
+
# @param uri [String]
|
|
101
|
+
# @param result_sets [Array]
|
|
102
|
+
# @return [String]
|
|
103
|
+
def self.resources(uri, result_sets)
|
|
104
|
+
output = "------------------------------------------------\n"
|
|
105
|
+
output += "/nba_stats/resources/#{class_name(uri.path)}.rb\n"
|
|
106
|
+
output += "------------------------------------------------\n"
|
|
107
|
+
|
|
108
|
+
output += "require 'nba_stats/resources/resource_base'
|
|
109
|
+
require 'nba_stats/constants'
|
|
110
|
+
|
|
111
|
+
module NbaStats
|
|
112
|
+
|
|
113
|
+
module Resources
|
|
114
|
+
|
|
115
|
+
class #{class_name(uri.path)} < ResourceBase
|
|
116
|
+
|
|
117
|
+
# Array of valid result set names for this resource
|
|
118
|
+
VALID_RESULT_SETS = [\n"
|
|
119
|
+
|
|
120
|
+
result_sets.each do |result_set|
|
|
121
|
+
output += " :#{result_set['name'].underscore},"
|
|
122
|
+
output += " #"
|
|
123
|
+
result_set['headers'].each do |h|
|
|
124
|
+
output += ":#{h.underscore}, "
|
|
125
|
+
end
|
|
126
|
+
output += "\n"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
output +=" ].freeze
|
|
130
|
+
|
|
131
|
+
# @return [Array]
|
|
132
|
+
def valid_result_sets
|
|
133
|
+
VALID_RESULT_SETS
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
end # #{class_name(uri.path)}
|
|
137
|
+
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
end\n"
|
|
141
|
+
output += '------------------------------------------------'
|
|
142
|
+
output
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Generates a rough spec ruby file for the api call
|
|
146
|
+
#
|
|
147
|
+
# @param uri [String]
|
|
148
|
+
# @return [String]
|
|
149
|
+
def self.spec(uri)
|
|
150
|
+
output = "------------------------------------------------\n"
|
|
151
|
+
output += "/spec/client/#{class_name(uri.path)}_spec.rb\n"
|
|
152
|
+
output += "------------------------------------------------\n"
|
|
153
|
+
|
|
154
|
+
output += "require 'spec_helper'
|
|
155
|
+
|
|
156
|
+
describe 'NbaStats' do
|
|
157
|
+
|
|
158
|
+
describe 'client' do
|
|
159
|
+
client = NbaStats::Client.new
|
|
160
|
+
|
|
161
|
+
describe '.#{class_name(uri.path)}' do
|
|
162
|
+
#{class_name(uri.path)} = client.#{class_name(uri.path)}("
|
|
163
|
+
|
|
164
|
+
uri.query_values.each do |key, value|
|
|
165
|
+
output += "#{value}, "
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
output += ")
|
|
169
|
+
it 'should return a #{class_name(uri.path)} resource' do
|
|
170
|
+
expect(#{class_name(uri.path)}).to be_a NbaStats::Resources::#{class_name(uri.path)}
|
|
171
|
+
end
|
|
172
|
+
it 'should be named #{class_name(uri.path)}' do
|
|
173
|
+
expect(#{class_name(uri.path)}.name).to eq '#{class_name(uri.path)}'
|
|
174
|
+
end
|
|
175
|
+
NbaStats::Resources::#{class_name(uri.path)}::VALID_RESULT_SETS.each do |valid_result_set|
|
|
176
|
+
describe \".\#{valid_result_set}\" do
|
|
177
|
+
it 'should return an Array' do
|
|
178
|
+
expect(#{class_name(uri.path)}.send(valid_result_set)).to be_a Array
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end # .#{class_name(uri.path)}
|
|
183
|
+
|
|
184
|
+
end # client
|
|
185
|
+
|
|
186
|
+
end\n"
|
|
187
|
+
output += '------------------------------------------------'
|
|
188
|
+
output
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
end # Discovery
|
|
192
|
+
|
|
193
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'nba_stats/resources/resource_base'
|
|
2
|
+
|
|
3
|
+
module NbaStats
|
|
4
|
+
|
|
5
|
+
module Resources
|
|
6
|
+
|
|
7
|
+
class BoxScore < ResourceBase
|
|
8
|
+
|
|
9
|
+
# Array of valid result set names for this resource
|
|
10
|
+
VALID_RESULT_SETS = [
|
|
11
|
+
:game_summary, # :game_date_est, :game_sequence, :game_id, :game_status_id, :game_status_text, :gamecode, :home_team_id, :visitor_team_id, :season, :live_period, :live_pc_time, :natl_tv_broadcaster_abbreviation, :live_period_time_bcast, :wh_status
|
|
12
|
+
:line_score, # :game_date_est, :game_sequence, :game_id, :team_id, :team_abbreviation, :team_city_name, :team_wins_losses, :pts_qtr1, :pts_qtr2, :pts_qtr3, :pts_qtr4, :pts_ot1, :pts_ot2, :pts_ot3, :pts_ot4, :pts_ot5, :pts_ot6, :pts_ot7, :pts_ot8, :pts_ot9, :pts_ot10, :pts
|
|
13
|
+
:season_series, # :game_id, :home_team_id, :visitor_team_id, :game_date_est, :home_team_wins, :home_team_losses, :series_leader
|
|
14
|
+
:last_meeting, # :game_id, :last_game_id, :last_game_date_est, :last_game_home_team_id, :last_game_home_team_city, :last_game_home_team_name, :last_game_home_team_abbreviation, :last_game_home_team_points, :last_game_visitor_team_id, :last_game_visitor_team_city, :last_game_visitor_team_name, :last_game_visitor_team_city1, :last_game_visitor_team_points
|
|
15
|
+
:player_stats, # :game_id, :team_id, :team_abbreviation, :team_city, :player_id, :player_name, :start_position, :comment, :min, :fgm, :fga, :fg_pct, :fg3_m, :fg3_a, :fg3_pct, :ftm, :fta, :ft_pct, :oreb, :dreb, :reb, :ast, :stl, :blk, :to, :pf, :pts, :plus_minus
|
|
16
|
+
:team_stats, # :game_id, :team_id, :team_name, :team_abbreviation, :team_city, :min, :fgm, :fga, :fg_pct, :fg3_m, :fg3_a, :fg3_pct, :ftm, :fta, :ft_pct, :oreb, :dreb, :reb, :ast, :stl, :blk, :to, :pf, :pts, :plus_minus
|
|
17
|
+
:other_stats, # :league_id, :season_id, :team_id, :team_abbreviation, :team_city, :pts_paint, :pts_2_nd_chance, :pts_fb, :largest_lead, :lead_changes, :times_tied
|
|
18
|
+
:officials, # :official_id, :first_name, :last_name, :jersey_num
|
|
19
|
+
:game_info, # :game_date, :attendance, :game_time
|
|
20
|
+
:inactive_players, # :player_id, :first_name, :last_name, :jersey_num, :team_id, :team_city, :team_name, :team_abbreviation
|
|
21
|
+
:available_video, # :game_id, :video_available_flag, :pt_available
|
|
22
|
+
:player_track, # :game_id, :team_id, :team_abbreviation, :team_city, :player_id, :player_name, :start_position, :comment, :min, :spd, :dist, :orbc, :drbc, :rbc, :tchs, :sast, :ftast, :pass, :ast, :cfgm, :cfga, :cfg_pct, :ufgm, :ufga, :ufg_pct, :fg_pct, :dfgm, :dfga, :dfg_pct
|
|
23
|
+
:player_track_team # :game_id, :team_id, :team_nickname, :team_abbreviation, :team_city, :min, :dist, :orbc, :drbc, :rbc, :tchs, :sast, :ftast, :pass, :ast, :cfgm, :cfga, :cfg_pct, :ufgm, :ufga, :ufg_pct, :fg_pct, :dfgm, :dfga, :dfg_pct
|
|
24
|
+
].freeze
|
|
25
|
+
|
|
26
|
+
# @return [Array]
|
|
27
|
+
def valid_result_sets
|
|
28
|
+
VALID_RESULT_SETS
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end # BoxScore
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|