Class: NBAPlayerAPI::Player
- Inherits:
-
Object
- Object
- NBAPlayerAPI::Player
- Defined in:
- lib/nba_player_api/player.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#current_team ⇒ Object
readonly
Returns the value of attribute current_team.
-
#drafted_year ⇒ Object
readonly
Returns the value of attribute drafted_year.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#nba_id ⇒ Object
readonly
Returns the value of attribute nba_id.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#stat_cards ⇒ Object
readonly
Returns the value of attribute stat_cards.
Instance Method Summary collapse
-
#initialize(player_data) ⇒ Player
constructor
basic initialization with attributes.
- #to_s ⇒ Object
Constructor Details
#initialize(player_data) ⇒ Player
basic initialization with attributes
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nba_player_api/player.rb', line 13 def initialize(player_data) @player_data_hash = create_player_data_hash(player_data) @nba_id = @player_data_hash['PERSON_ID'] @first_name = @player_data_hash['PLAYER_FIRST_NAME'] @last_name = @player_data_hash['PLAYER_LAST_NAME'] @slug = @player_data_hash['PLAYER_SLUG'] @current_team = @player_data_hash['TEAM_ABBREVIATION'] @active = @player_data_hash['ROSTER_STATUS'] @position = @player_data_hash['POSITION'] @drafted_year = @player_data_hash['DRAFT_YEAR'] @stat_cards = [] @stat_cards << create_stat_card end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def active @active end |
#current_team ⇒ Object (readonly)
Returns the value of attribute current_team.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def current_team @current_team end |
#drafted_year ⇒ Object (readonly)
Returns the value of attribute drafted_year.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def drafted_year @drafted_year end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def last_name @last_name end |
#nba_id ⇒ Object (readonly)
Returns the value of attribute nba_id.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def nba_id @nba_id end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def position @position end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def slug @slug end |
#stat_cards ⇒ Object (readonly)
Returns the value of attribute stat_cards.
7 8 9 |
# File 'lib/nba_player_api/player.rb', line 7 def stat_cards @stat_cards end |
Instance Method Details
#to_s ⇒ Object
27 28 29 |
# File 'lib/nba_player_api/player.rb', line 27 def to_s "Player: #{first_name} #{last_name} | Position: #{position} | Team: #{current_team}" end |