Class: NBA::TeamInfo

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

Overview

Represents team information from the TeamInfoCommon endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#conf_rankInteger?

Returns conference rank

Examples:

info.conf_rank #=> 4

Returns:

  • (Integer, nil)

    conference rank



114
# File 'lib/nba/team_info.rb', line 114

attribute :conf_rank, Shale::Type::Integer

#div_rankInteger?

Returns division rank

Examples:

info.div_rank #=> 2

Returns:

  • (Integer, nil)

    division rank



122
# File 'lib/nba/team_info.rb', line 122

attribute :div_rank, Shale::Type::Integer

#lInteger?

Returns losses

Examples:

info.l #=> 36

Returns:

  • (Integer, nil)

    losses



98
# File 'lib/nba/team_info.rb', line 98

attribute :l, Shale::Type::Integer

#max_yearString?

Returns the maximum year

Examples:

info.max_year #=> "2024"

Returns:

  • (String, nil)

    the maximum year



138
# File 'lib/nba/team_info.rb', line 138

attribute :max_year, Shale::Type::String

#min_yearString?

Returns the minimum year (franchise founding year)

Examples:

info.min_year #=> "1946"

Returns:

  • (String, nil)

    the minimum year



130
# File 'lib/nba/team_info.rb', line 130

attribute :min_year, Shale::Type::String

#pctFloat?

Returns win percentage

Examples:

info.pct #=> 0.561

Returns:

  • (Float, nil)

    win percentage



106
# File 'lib/nba/team_info.rb', line 106

attribute :pct, Shale::Type::Float

#season_yearString?

Returns the season year

Examples:

info.season_year #=> "2024-25"

Returns:

  • (String, nil)

    the season year



26
# File 'lib/nba/team_info.rb', line 26

attribute :season_year, Shale::Type::String

#team_abbreviationString?

Returns the team abbreviation

Examples:

info.team_abbreviation #=> "GSW"

Returns:

  • (String, nil)

    the team’s abbreviation



50
# File 'lib/nba/team_info.rb', line 50

attribute :team_abbreviation, Shale::Type::String

#team_cityString?

Returns the team city

Examples:

info.team_city #=> "Golden State"

Returns:

  • (String, nil)

    the team’s city



34
# File 'lib/nba/team_info.rb', line 34

attribute :team_city, Shale::Type::String

#team_codeString?

Returns the team code

Examples:

info.team_code #=> "warriors"

Returns:

  • (String, nil)

    the team’s code



74
# File 'lib/nba/team_info.rb', line 74

attribute :team_code, Shale::Type::String

#team_conferenceString?

Returns the team conference

Examples:

info.team_conference #=> "West"

Returns:

  • (String, nil)

    the team’s conference



58
# File 'lib/nba/team_info.rb', line 58

attribute :team_conference, Shale::Type::String

#team_divisionString?

Returns the team division

Examples:

info.team_division #=> "Pacific"

Returns:

  • (String, nil)

    the team’s division



66
# File 'lib/nba/team_info.rb', line 66

attribute :team_division, Shale::Type::String

#team_idInteger?

Returns the team ID

Examples:

info.team_id #=> 1610612744

Returns:

  • (Integer, nil)

    the team’s ID



18
# File 'lib/nba/team_info.rb', line 18

attribute :team_id, Shale::Type::Integer

#team_nameString?

Returns the team name

Examples:

info.team_name #=> "Warriors"

Returns:

  • (String, nil)

    the team’s name



42
# File 'lib/nba/team_info.rb', line 42

attribute :team_name, Shale::Type::String

#team_slugString?

Returns the team slug

Examples:

info.team_slug #=> "warriors"

Returns:

  • (String, nil)

    the team’s slug



82
# File 'lib/nba/team_info.rb', line 82

attribute :team_slug, Shale::Type::String

#wInteger?

Returns wins

Examples:

info.w #=> 46

Returns:

  • (Integer, nil)

    wins



90
# File 'lib/nba/team_info.rb', line 90

attribute :w, Shale::Type::Integer

Instance Method Details

#teamTeam?

Returns the team associated with this info

Examples:

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

Returns:

  • (Team, nil)

    the Team object



146
147
148
# File 'lib/nba/team_info.rb', line 146

def team
  Teams.find(team_id)
end