Class: ESPNNBAFantasy::Player
- Inherits:
-
Object
- Object
- ESPNNBAFantasy::Player
- Includes:
- CalculateStats
- Defined in:
- lib/espn_nba_fantasy/player.rb
Instance Attribute Summary collapse
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#player_id ⇒ Object
readonly
Returns the value of attribute player_id.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
Instance Method Summary collapse
-
#initialize(player, team) ⇒ Player
constructor
basic initialization with attributes.
- #to_s ⇒ Object
Methods included from CalculateStats
Constructor Details
#initialize(player, team) ⇒ Player
basic initialization with attributes
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/espn_nba_fantasy/player.rb', line 15 def initialize(player, team) @first_name = player['firstName'] @last_name = player['lastName'] @full_name = player['fullName'] @player_id = player['id'] @position = ESPNNBAFantasy::POSITION_MAP[player['defaultPositionId']-1] @stats = stat_card_maker(player) @team = team @slug = @full_name.scan(/\w+|\s/).join.downcase.split(' ').join('-') end |
Instance Attribute Details
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def first_name @first_name end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def full_name @full_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def last_name @last_name end |
#player_id ⇒ Object (readonly)
Returns the value of attribute player_id.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def player_id @player_id end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def position @position end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def slug @slug end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def stats @stats end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
9 10 11 |
# File 'lib/espn_nba_fantasy/player.rb', line 9 def team @team end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/espn_nba_fantasy/player.rb', line 26 def to_s "Player: #{name} | Position: #{position} | Stats: #{stats}" end |