Class: NBA::PlayerInfo

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/nba/player_info.rb

Overview

Represents detailed player biographical information

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#birthdate ⇒ String

Returns the player's birthdate

Examples:

info.birthdate #=> "1988-03-14"

Returns:

  • (String) —

    the player's birthdate



47
# File 'lib/nba/player_info.rb', line 47

attribute :birthdate, Shale::Type::String

#country ⇒ String

Returns the player's country

Examples:

info.country #=> "USA"

Returns:

  • (String) —

    the player's country



63
# File 'lib/nba/player_info.rb', line 63

attribute :country, Shale::Type::String

#display_name ⇒ String

Returns the player's display name

Examples:

info.display_name #=> "Stephen Curry"

Returns:

  • (String) —

    the player's display name



39
# File 'lib/nba/player_info.rb', line 39

attribute :display_name, Shale::Type::String

#draft_number ⇒ Integer

Returns the pick number

Examples:

info.draft_number #=> 7

Returns:

  • (Integer) —

    the draft number



159
# File 'lib/nba/player_info.rb', line 159

attribute :draft_number, Shale::Type::Integer

#draft_round ⇒ Integer

Returns the round the player was drafted

Examples:

info.draft_round #=> 1

Returns:

  • (Integer) —

    the draft round



151
# File 'lib/nba/player_info.rb', line 151

attribute :draft_round, Shale::Type::Integer

#draft_year ⇒ Integer

Returns the year the player was drafted

Examples:

info.draft_year #=> 2009

Returns:

  • (Integer) —

    the draft year



143
# File 'lib/nba/player_info.rb', line 143

attribute :draft_year, Shale::Type::Integer

#first_name ⇒ String

Returns the player's first name

Examples:

info.first_name #=> "Stephen"

Returns:

  • (String) —

    the player's first name



23
# File 'lib/nba/player_info.rb', line 23

attribute :first_name, Shale::Type::String

#from_year ⇒ Integer

Returns the player's first NBA year

Examples:

info.from_year #=> 2009

Returns:

  • (Integer) —

    the first year



167
# File 'lib/nba/player_info.rb', line 167

attribute :from_year, Shale::Type::Integer

#greatest_75_flag ⇒ String

Returns whether the player is in the NBA 75 greatest

Examples:

info.greatest_75_flag #=> "Y"

Returns:

  • (String) —

    Y or N



183
# File 'lib/nba/player_info.rb', line 183

attribute :greatest_75_flag, Shale::Type::String

#height ⇒ String

Returns the player's height

Examples:

info.height #=> "6-2"

Returns:

  • (String) —

    the player's height



71
# File 'lib/nba/player_info.rb', line 71

attribute :height, Shale::Type::String

#jersey ⇒ String

Returns the player's jersey number

Examples:

info.jersey #=> "30"

Returns:

  • (String) —

    the jersey number



95
# File 'lib/nba/player_info.rb', line 95

attribute :jersey, Shale::Type::String

#last_name ⇒ String

Returns the player's last name

Examples:

info.last_name #=> "Curry"

Returns:

  • (String) —

    the player's last name



31
# File 'lib/nba/player_info.rb', line 31

attribute :last_name, Shale::Type::String

#player_id ⇒ Integer

Returns the player ID

Examples:

info.player_id #=> 201939

Returns:

  • (Integer) —

    the player ID



15
# File 'lib/nba/player_info.rb', line 15

attribute :player_id, Shale::Type::Integer

#position ⇒ String

Returns the player's position

Examples:

info.position #=> "Guard"

Returns:

  • (String) —

    the player's position



103
# File 'lib/nba/player_info.rb', line 103

attribute :position, Shale::Type::String

#school ⇒ String

Returns the player's school

Examples:

info.school #=> "Davidson"

Returns:

  • (String) —

    the player's school



55
# File 'lib/nba/player_info.rb', line 55

attribute :school, Shale::Type::String

#season_exp ⇒ Integer

Returns the player's years of experience

Examples:

info.season_exp #=> 15

Returns:

  • (Integer) —

    years of experience



87
# File 'lib/nba/player_info.rb', line 87

attribute :season_exp, Shale::Type::Integer

#team_abbreviation ⇒ String

Returns the player's team abbreviation

Examples:

info.team_abbreviation #=> "GSW"

Returns:

  • (String) —

    the team abbreviation



127
# File 'lib/nba/player_info.rb', line 127

attribute :team_abbreviation, Shale::Type::String

#team_city ⇒ String

Returns the player's team city

Examples:

info.team_city #=> "Golden State"

Returns:

  • (String) —

    the team city



135
# File 'lib/nba/player_info.rb', line 135

attribute :team_city, Shale::Type::String

#team_id ⇒ Integer

Returns the player's team ID

Examples:

info.team_id #=> 1610612744

Returns:

  • (Integer) —

    the team ID



111
# File 'lib/nba/player_info.rb', line 111

attribute :team_id, Shale::Type::Integer

#team_name ⇒ String

Returns the player's team name

Examples:

info.team_name #=> "Warriors"

Returns:

  • (String) —

    the team name



119
# File 'lib/nba/player_info.rb', line 119

attribute :team_name, Shale::Type::String

#to_year ⇒ Integer

Returns the player's most recent NBA year

Examples:

info.to_year #=> 2024

Returns:

  • (Integer) —

    the most recent year



175
# File 'lib/nba/player_info.rb', line 175

attribute :to_year, Shale::Type::Integer

#weight ⇒ Integer

Returns the player's weight in pounds

Examples:

info.weight #=> 185

Returns:

  • (Integer) —

    the player's weight



79
# File 'lib/nba/player_info.rb', line 79

attribute :weight, Shale::Type::Integer

Instance Method Details

#full_name ⇒ String

Returns the player's full name

Examples:

info.full_name #=> "Stephen Curry"

Returns:

  • (String) —

    the full name



211
212
213
# File 'lib/nba/player_info.rb', line 211

def full_name
  display_name || "#{first_name} #{last_name}".strip
end

#greatest_75? ⇒ Boolean

Returns whether the player is in the NBA 75 greatest

Examples:

info.greatest_75? #=> true

Returns:

  • (Boolean) —

    true if in NBA 75



221
222
223
# File 'lib/nba/player_info.rb', line 221

def greatest_75?
  greatest_75_flag.eql?("Y")
end

#player ⇒ Player?

Returns the player object

Examples:

info.player #=> #<NBA::Player>

Returns:

  • (Player, nil) —

    the player object



191
192
193
# File 'lib/nba/player_info.rb', line 191

def player
  Players.find(player_id)
end

#team ⇒ Team?

Returns the team object

Examples:

info.team #=> #<NBA::Team>

Returns:

  • (Team, nil) —

    the team object



201
202
203
# File 'lib/nba/player_info.rb', line 201

def team
  Teams.find(team_id)
end