class NbaRb::Player::Career

Attributes

endpoint[R]
data[RW]
league_id[RW]
per_mode[RW]
player_id[RW]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Initializable::new
# File lib/nba_rb/player/career.rb, line 21
def initialize(*args)
  super(*args)

  @per_mode ||= NbaRb::PerMode.per_game
  @league_id ||= NbaRb::League.NBA

  res = stats_request('playercareerstats', 'PlayerID' => player_id,
                                           'LeagueID' => league_id,
                                           'PerMode' => per_mode)

  @data = res['resultSets']
end

Public Instance Methods

all_star_season_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 62
def all_star_season_totals
  create_stats_hash(@data[4])
end
all_star_season_totals_by_year(year) click to toggle source
# File lib/nba_rb/player/career.rb, line 66
def all_star_season_totals_by_year(year)
  all_star_season_totals.each do |hash|
    return hash if hash['SEASON_ID'].include? year
  end
end
career_all_star_season_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 72
def career_all_star_season_totals
  create_stats_hash(@data[5])
end
career_college_season_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 86
def career_college_season_totals
  create_stats_hash(@data[7])
end
college_season_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 76
def college_season_totals
  create_stats_hash(@data[6])
end
college_season_totals_by_year(year) click to toggle source
# File lib/nba_rb/player/career.rb, line 80
def college_season_totals_by_year(year)
  college_season_totals.each do |hash|
    return hash if hash['SEASON_ID'].include? year
  end
end
endpoint() click to toggle source
# File lib/nba_rb/player/career.rb, line 12
def endpoint
  self.class.endpoint
end
post_season_career_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 58
def post_season_career_totals
  create_stats_hash(@data[3])
end
post_season_rankings() click to toggle source
# File lib/nba_rb/player/career.rb, line 100
def post_season_rankings
  create_stats_hash(@data[9])
end
post_season_rankings_by_year(year) click to toggle source
# File lib/nba_rb/player/career.rb, line 104
def post_season_rankings_by_year(year)
  post_season_rankings.each do |hash|
    return hash if hash['SEASON_ID'].include? year
  end
end
post_season_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 48
def post_season_totals
  create_stats_hash(@data[2])
end
post_season_totals_by_year(year) click to toggle source
# File lib/nba_rb/player/career.rb, line 52
def post_season_totals_by_year(year)
  post_season_totals.each do |hash|
    return hash if hash['SEASON_ID'].include? year
  end
end
regular_season_career_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 44
def regular_season_career_totals
  create_stats_hash(@data[1])
end
regular_season_rankings() click to toggle source
# File lib/nba_rb/player/career.rb, line 90
def regular_season_rankings
  create_stats_hash(@data[8])
end
regular_season_rankings_by_year(year) click to toggle source
# File lib/nba_rb/player/career.rb, line 94
def regular_season_rankings_by_year(year)
  regular_season_rankings.each do |hash|
    return hash if hash['SEASON_ID'].include? year
  end
end
regular_season_totals() click to toggle source
# File lib/nba_rb/player/career.rb, line 34
def regular_season_totals
  create_stats_hash(@data[0])
end
season_totals_by_year(year) click to toggle source
# File lib/nba_rb/player/career.rb, line 38
def season_totals_by_year(year)
  regular_season_totals.each do |hash|
    return hash if hash['SEASON_ID'].include? year
  end
end