Class: ESPNNBAFantasy::User

Inherits:
Object
  • Object
show all
Defined in:
lib/espn_nba_fantasy/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj, league) ⇒ User

basic initialization with the various attributes



9
10
11
12
13
14
15
16
# File 'lib/espn_nba_fantasy/user.rb', line 9

def initialize(obj, league)
  @display_name = obj['displayName']
  @first_name = obj['firstName']
  @last_name = obj['lastName']
  @fantasy_id = obj['id']
  @teams = []
  @league = league
end

Instance Attribute Details

#add_team(team) ⇒ Object

Returns the value of attribute add_team.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def add_team
  @add_team
end

#display_nameObject

Returns the value of attribute display_name.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def display_name
  @display_name
end

#fantasy_idObject

Returns the value of attribute fantasy_id.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def fantasy_id
  @fantasy_id
end

#first_nameObject

Returns the value of attribute first_name.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def last_name
  @last_name
end

#leagueObject

Returns the value of attribute league.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def league
  @league
end

#teamsObject

Returns the value of attribute teams.



4
5
6
# File 'lib/espn_nba_fantasy/user.rb', line 4

def teams
  @teams
end

Instance Method Details

#to_sObject

returns data including the players trading away and receiving, your stats before and after the trade, and your change in stats for each category



24
25
26
# File 'lib/espn_nba_fantasy/user.rb', line 24

def to_s
  "User Name: #{first_name} #{last_name} | Teams: #{teams.map(&:name)}"
end