Class: NbaRb::Player::Career
- Inherits:
-
Object
- Object
- NbaRb::Player::Career
- Includes:
- Initializable, StatsHash, StatsRequest
- Defined in:
- lib/nba_rb/player/career.rb
Class Attribute Summary collapse
-
.endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#league_id ⇒ Object
Returns the value of attribute league_id.
-
#per_mode ⇒ Object
Returns the value of attribute per_mode.
-
#player_id ⇒ Object
Returns the value of attribute player_id.
Instance Method Summary collapse
- #all_star_season_totals ⇒ Object
- #all_star_season_totals_by_year(year) ⇒ Object
- #career_all_star_season_totals ⇒ Object
- #career_college_season_totals ⇒ Object
- #college_season_totals ⇒ Object
- #college_season_totals_by_year(year) ⇒ Object
- #endpoint ⇒ Object
-
#initialize(*args) ⇒ Career
constructor
A new instance of Career.
- #post_season_career_totals ⇒ Object
- #post_season_rankings ⇒ Object
- #post_season_rankings_by_year(year) ⇒ Object
- #post_season_totals ⇒ Object
- #post_season_totals_by_year(year) ⇒ Object
- #regular_season_career_totals ⇒ Object
- #regular_season_rankings ⇒ Object
- #regular_season_rankings_by_year(year) ⇒ Object
- #regular_season_totals ⇒ Object
- #season_totals_by_year(year) ⇒ Object
Methods included from StatsHash
Methods included from StatsRequest
Constructor Details
#initialize(*args) ⇒ Career
Returns a new instance of Career.
21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |
Class Attribute Details
.endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
9 10 11 |
# File 'lib/nba_rb/player/career.rb', line 9 def endpoint @endpoint end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
16 17 18 |
# File 'lib/nba_rb/player/career.rb', line 16 def data @data end |
#league_id ⇒ Object
Returns the value of attribute league_id.
16 17 18 |
# File 'lib/nba_rb/player/career.rb', line 16 def league_id @league_id end |
#per_mode ⇒ Object
Returns the value of attribute per_mode.
16 17 18 |
# File 'lib/nba_rb/player/career.rb', line 16 def per_mode @per_mode end |
#player_id ⇒ Object
Returns the value of attribute player_id.
16 17 18 |
# File 'lib/nba_rb/player/career.rb', line 16 def player_id @player_id end |
Instance Method Details
#all_star_season_totals ⇒ Object
62 63 64 |
# 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) ⇒ Object
66 67 68 69 70 |
# 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 ⇒ Object
72 73 74 |
# 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 ⇒ Object
86 87 88 |
# File 'lib/nba_rb/player/career.rb', line 86 def career_college_season_totals create_stats_hash(@data[7]) end |
#college_season_totals ⇒ Object
76 77 78 |
# 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) ⇒ Object
80 81 82 83 84 |
# 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 ⇒ Object
12 13 14 |
# File 'lib/nba_rb/player/career.rb', line 12 def endpoint self.class.endpoint end |
#post_season_career_totals ⇒ Object
58 59 60 |
# File 'lib/nba_rb/player/career.rb', line 58 def post_season_career_totals create_stats_hash(@data[3]) end |
#post_season_rankings ⇒ Object
100 101 102 |
# 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) ⇒ Object
104 105 106 107 108 |
# 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 ⇒ Object
48 49 50 |
# 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) ⇒ Object
52 53 54 55 56 |
# 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 ⇒ Object
44 45 46 |
# File 'lib/nba_rb/player/career.rb', line 44 def regular_season_career_totals create_stats_hash(@data[1]) end |
#regular_season_rankings ⇒ Object
90 91 92 |
# 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) ⇒ Object
94 95 96 97 98 |
# 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 ⇒ Object
34 35 36 |
# File 'lib/nba_rb/player/career.rb', line 34 def regular_season_totals create_stats_hash(@data[0]) end |
#season_totals_by_year(year) ⇒ Object
38 39 40 41 42 |
# 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 |