Class: NbaStats::Client
- Inherits:
-
Object
- Object
- NbaStats::Client
- Includes:
- BoxScore, BoxScoreAdvanced, BoxScoreFourFactors, BoxScoreMisc, BoxScoreScoring, BoxScoreUsage, CommonAllPlayers, CommonPlayerInfo, CommonTeamRoster, CommonTeamYears, DraftCombineDrillResults, DraftCombineNonStationaryShooting, DraftCombinePlayerAnthro, DraftCombineSpotShooting, DraftCombineStats, FranchiseHistory, HomePageLeaders, LeagueDashLineups, LeagueDashPlayerStats, LeagueDashTeamStats, PlayByPlay, PlayerCareerStats, PlayerDashboardByGeneralSplits, PlayerGameLog, PlayerProfile, Scoreboard, ShotChartDetail, TeamGameLog, TeamInfoCommon, TeamYearByYearStats
- Defined in:
- lib/nba_stats/client.rb
Constant Summary
Constants included from LeagueDashTeamStats
LeagueDashTeamStats::LEAGUE_DASH_TEAM_STATS_PATH
Constants included from PlayerGameLog
PlayerGameLog::PLAYER_GAME_LOG_PATH
Constants included from DraftCombineStats
DraftCombineStats::DRAFT_COMBINE_STATS_PATH
Constants included from DraftCombineSpotShooting
DraftCombineSpotShooting::DRAFT_COMBINE_SPOT_SHOOTING_PATH
Constants included from DraftCombineNonStationaryShooting
DraftCombineNonStationaryShooting::DRAFT_COMBINE_NON_STATIONARY_SHOOTING_PATH
Constants included from DraftCombineDrillResults
DraftCombineDrillResults::DRAFT_COMBINE_DRILL_RESULTS_PATH
Constants included from DraftCombinePlayerAnthro
DraftCombinePlayerAnthro::DRAFT_COMBINE_PLAYER_ANTHRO_PATH
Constants included from FranchiseHistory
FranchiseHistory::FRANCHISE_HISTORY_PATH
Constants included from HomePageLeaders
HomePageLeaders::HOME_PAGE_LEADERS_PATH
Constants included from PlayerCareerStats
PlayerCareerStats::PLAYER_CAREER_STATS_PATH
Constants included from LeagueDashPlayerStats
LeagueDashPlayerStats::LEAGUE_DASH_PLAYER_STATS_PATH
Constants included from LeagueDashLineups
LeagueDashLineups::LEAGUE_DASH_LINEUPS_PATH
Constants included from BoxScoreAdvanced
BoxScoreAdvanced::BOX_SCORE_ADVANCED_PATH
Constants included from BoxScoreMisc
BoxScoreMisc::BOX_SCORE_MISC_PATH
Constants included from BoxScoreScoring
BoxScoreScoring::BOX_SCORE_SCORING_PATH
Constants included from BoxScoreUsage
BoxScoreUsage::BOX_SCORE_USAGE_PATH
Constants included from BoxScoreFourFactors
BoxScoreFourFactors::BOX_SCORE_FOUR_FACTORS_PATH
Constants included from PlayByPlay
Constants included from ShotChartDetail
ShotChartDetail::SHOT_CHART_DETAIL_PATH
Constants included from CommonTeamYears
NbaStats::CommonTeamYears::COMMON_TEAM_YEARS_PATH
Constants included from TeamYearByYearStats
TeamYearByYearStats::TEAM_YEAR_BY_YEAR_STATS_PATH
Constants included from TeamGameLog
TeamGameLog::TEAM_GAME_LOG_PATH
Constants included from CommonTeamRoster
NbaStats::CommonTeamRoster::COMMON_TEAM_ROSTER_PATH
Constants included from TeamInfoCommon
TeamInfoCommon::TEAM_INFO_COMMON_PATH
Constants included from PlayerDashboardByGeneralSplits
PlayerDashboardByGeneralSplits::PLAYER_DASHBOARD_BY_GENERAL_SPLITS_PATH
Constants included from PlayerProfile
PlayerProfile::PLAYER_PROFILE_PATH
Constants included from CommonPlayerInfo
NbaStats::CommonPlayerInfo::COMMON_PLAYER_INFO_PATH
Constants included from CommonAllPlayers
NbaStats::CommonAllPlayers::COMMON_ALL_PLAYERS_PATH
Constants included from BoxScore
Constants included from Scoreboard
Instance Method Summary collapse
-
#get(path = '/', params = {}) ⇒ Hash
Perform a HTTP GET request.
-
#initialize(options = {}) ⇒ NbaStats::Client
constructor
Initialize a new Client object.
- #request_headers ⇒ Hash
Methods included from LeagueDashTeamStats
Methods included from PlayerGameLog
Methods included from DraftCombineStats
Methods included from DraftCombineSpotShooting
Methods included from DraftCombineNonStationaryShooting
#draft_combine_non_stationary_shooting
Methods included from DraftCombineDrillResults
Methods included from DraftCombinePlayerAnthro
Methods included from FranchiseHistory
Methods included from HomePageLeaders
Methods included from PlayerCareerStats
Methods included from LeagueDashPlayerStats
Methods included from LeagueDashLineups
Methods included from BoxScoreAdvanced
Methods included from BoxScoreMisc
Methods included from BoxScoreScoring
Methods included from BoxScoreUsage
Methods included from BoxScoreFourFactors
Methods included from PlayByPlay
Methods included from ShotChartDetail
Methods included from CommonTeamYears
Methods included from TeamYearByYearStats
Methods included from TeamGameLog
Methods included from CommonTeamRoster
Methods included from TeamInfoCommon
Methods included from PlayerDashboardByGeneralSplits
#player_dashboard_by_general_splits
Methods included from PlayerProfile
Methods included from CommonPlayerInfo
Methods included from CommonAllPlayers
Methods included from BoxScore
Methods included from Scoreboard
Constructor Details
#initialize(options = {}) ⇒ NbaStats::Client
Initialize a new Client object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/nba_stats/client.rb', line 78 def initialize(={}) # Merge the config values from the module and those passed # to the client. = NbaStats..merge() # Copy the merged values to this client and ignore those # not part of our configuration Configuration::VALID_CONFIG_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#get(path = '/', params = {}) ⇒ Hash
Perform a HTTP GET request
103 104 105 106 107 108 109 |
# File 'lib/nba_stats/client.rb', line 103 def get(path='/', params={}) uri = Addressable::URI.new uri.query_values = params # Build the path with + instead of %20 because nba.com is flaky full_path = "#{path}?#{uri.query.gsub(/%20/,'+')}" request(:get, full_path) end |
#request_headers ⇒ Hash
91 92 93 94 95 96 |
# File 'lib/nba_stats/client.rb', line 91 def request_headers @request_headers ||= { :accept => accept, :user_agent => user_agent } end |