Class: NBA::Award

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

Overview

Represents a player’s award

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#all_nba_team_numberInteger

Returns the All-NBA team number (1st, 2nd, 3rd)

Examples:

award.all_nba_team_number #=> 1

Returns:

  • (Integer)

    the team number



52
# File 'lib/nba/award.rb', line 52

attribute :all_nba_team_number, Shale::Type::Integer

#award_typeString

Returns the award type

Examples:

award.award_type #=> "All-Star"

Returns:

  • (String)

    the award type



92
# File 'lib/nba/award.rb', line 92

attribute :award_type, Shale::Type::String

#conferenceString

Returns the conference

Examples:

award.conference #=> "West"

Returns:

  • (String)

    the conference



84
# File 'lib/nba/award.rb', line 84

attribute :conference, Shale::Type::String

#descriptionString

Returns the award description

Examples:

award.description #=> "All-NBA"

Returns:

  • (String)

    the award description



44
# File 'lib/nba/award.rb', line 44

attribute :description, Shale::Type::String

#first_nameString

Returns the player’s first name

Examples:

award.first_name #=> "Stephen"

Returns:

  • (String)

    the first name



20
# File 'lib/nba/award.rb', line 20

attribute :first_name, Shale::Type::String

#last_nameString

Returns the player’s last name

Examples:

award.last_name #=> "Curry"

Returns:

  • (String)

    the last name



28
# File 'lib/nba/award.rb', line 28

attribute :last_name, Shale::Type::String

#monthInteger

Returns the month (for monthly awards)

Examples:

award.month #=> 11

Returns:

  • (Integer)

    the month



68
# File 'lib/nba/award.rb', line 68

attribute :month, Shale::Type::Integer

#player_idInteger

Returns the player ID

Examples:

award.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



12
# File 'lib/nba/award.rb', line 12

attribute :player_id, Shale::Type::Integer

#seasonString

Returns the season

Examples:

award.season #=> "2023-24"

Returns:

  • (String)

    the season



60
# File 'lib/nba/award.rb', line 60

attribute :season, Shale::Type::String

#subtype1String

Returns the award subtype 1

Examples:

award.subtype1 #=> "Guard"

Returns:

  • (String)

    the subtype



100
# File 'lib/nba/award.rb', line 100

attribute :subtype1, Shale::Type::String

#subtype2String

Returns the award subtype 2

Examples:

award.subtype2 #=> "Starter"

Returns:

  • (String)

    the subtype



108
# File 'lib/nba/award.rb', line 108

attribute :subtype2, Shale::Type::String

#subtype3String

Returns the award subtype 3

Examples:

award.subtype3 #=> nil

Returns:

  • (String)

    the subtype



116
# File 'lib/nba/award.rb', line 116

attribute :subtype3, Shale::Type::String

#teamString

Returns the team name

Examples:

award.team #=> "Golden State Warriors"

Returns:

  • (String)

    the team name



36
# File 'lib/nba/award.rb', line 36

attribute :team, Shale::Type::String

#weekInteger

Returns the week (for weekly awards)

Examples:

award.week #=> 5

Returns:

  • (Integer)

    the week



76
# File 'lib/nba/award.rb', line 76

attribute :week, Shale::Type::Integer

Instance Method Details

#playerPlayer?

Returns the player object

Examples:

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

Returns:

  • (Player, nil)

    the player object



124
125
126
# File 'lib/nba/award.rb', line 124

def player
  Players.find(player_id)
end