Class: NbaRb::Player::BaseClass

Inherits:
Object
  • Object
show all
Includes:
Initializable, StatsHash, StatsRequest
Defined in:
lib/nba_rb/player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StatsHash

#create_stats_hash

Methods included from StatsRequest

#stats_request

Constructor Details

#initialize(*args) ⇒ BaseClass

Returns a new instance of BaseClass.



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/nba_rb/player.rb', line 36

def initialize(*args)
  super(*args)
  last_formatted = last_name.downcase.capitalize
  first_formatted = first_name.downcase.capitalize

  name = "#{last_formatted}, #{first_formatted}"
  list = PlayerList.new.info

  list['rowSet'].each do |player|
    @data = player if player[1] == name
  end
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



31
32
33
# File 'lib/nba_rb/player.rb', line 31

def data
  @data
end

#first_nameObject

Returns the value of attribute first_name.



31
32
33
# File 'lib/nba_rb/player.rb', line 31

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



31
32
33
# File 'lib/nba_rb/player.rb', line 31

def last_name
  @last_name
end

#only_currentObject

Returns the value of attribute only_current.



31
32
33
# File 'lib/nba_rb/player.rb', line 31

def only_current
  @only_current
end

Instance Method Details

#idObject



49
50
51
# File 'lib/nba_rb/player.rb', line 49

def id
  @data[0]
end

#player_codeObject



53
54
55
# File 'lib/nba_rb/player.rb', line 53

def player_code
  @data[5]
end

#rostered?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/nba_rb/player.rb', line 57

def rostered?
  @data[2].zero?
end

#team_abbreviationObject



69
70
71
# File 'lib/nba_rb/player.rb', line 69

def team_abbreviation
  @data[9]
end

#team_codeObject



73
74
75
# File 'lib/nba_rb/player.rb', line 73

def team_code
  @data[10]
end

#team_idObject



61
62
63
# File 'lib/nba_rb/player.rb', line 61

def team_id
  @data[6]
end

#team_nameObject



65
66
67
# File 'lib/nba_rb/player.rb', line 65

def team_name
  @data[7] + ' ' + @data[8]
end