Class: NBA::ScheduledGame

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

Overview

Represents a scheduled game

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arena_cityString

Returns the arena city

Examples:

game.arena_city #=> "San Francisco"

Returns:

  • (String)

    the arena city



172
# File 'lib/nba/scheduled_game.rb', line 172

attribute :arena_city, Shale::Type::String

#arena_nameString

Returns the arena name

Examples:

game.arena_name #=> "Chase Center"

Returns:

  • (String)

    the arena name



164
# File 'lib/nba/scheduled_game.rb', line 164

attribute :arena_name, Shale::Type::String

#arena_stateString

Returns the arena state

Examples:

game.arena_state #=> "CA"

Returns:

  • (String)

    the arena state



180
# File 'lib/nba/scheduled_game.rb', line 180

attribute :arena_state, Shale::Type::String

#away_team_cityString

Returns the away team city

Examples:

game.away_team_city #=> "Los Angeles"

Returns:

  • (String)

    the away team city



124
# File 'lib/nba/scheduled_game.rb', line 124

attribute :away_team_city, Shale::Type::String

#away_team_idInteger

Returns the away team ID

Examples:

game.away_team_id #=> 1610612747

Returns:

  • (Integer)

    the away team ID



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

attribute :away_team_id, Shale::Type::Integer

#away_team_lossesInteger

Returns the away team losses

Examples:

game.away_team_losses #=> 39

Returns:

  • (Integer)

    the away team losses



148
# File 'lib/nba/scheduled_game.rb', line 148

attribute :away_team_losses, Shale::Type::Integer

#away_team_nameString

Returns the away team name

Examples:

game.away_team_name #=> "Lakers"

Returns:

  • (String)

    the away team name



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

attribute :away_team_name, Shale::Type::String

#away_team_scoreInteger

Returns the away team score

Examples:

game.away_team_score #=> 108

Returns:

  • (Integer)

    the away team score



156
# File 'lib/nba/scheduled_game.rb', line 156

attribute :away_team_score, Shale::Type::Integer

#away_team_tricodeString

Returns the away team tricode/abbreviation

Examples:

game.away_team_tricode #=> "LAL"

Returns:

  • (String)

    the away team tricode



132
# File 'lib/nba/scheduled_game.rb', line 132

attribute :away_team_tricode, Shale::Type::String

#away_team_winsInteger

Returns the away team wins

Examples:

game.away_team_wins #=> 43

Returns:

  • (Integer)

    the away team wins



140
# File 'lib/nba/scheduled_game.rb', line 140

attribute :away_team_wins, Shale::Type::Integer

#broadcastersString

Returns the broadcaster information

Examples:

game.broadcasters #=> "TNT"

Returns:

  • (String)

    the broadcasters



188
# File 'lib/nba/scheduled_game.rb', line 188

attribute :broadcasters, Shale::Type::String

#game_codeString

Returns the game code

Examples:

game.game_code #=> "20241022/LALGSW"

Returns:

  • (String)

    the game code



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

attribute :game_code, Shale::Type::String

#game_dateString

Returns the game date

Examples:

game.game_date #=> "2024-10-22T19:00:00Z"

Returns:

  • (String)

    the game date



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

attribute :game_date, Shale::Type::String

#game_idString

Returns the game ID

Examples:

game.game_id #=> "0022400001"

Returns:

  • (String)

    the game ID



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

attribute :game_id, Shale::Type::String

#game_statusInteger

Returns the game status (1=scheduled, 2=in progress, 3=final)

Examples:

game.game_status #=> 1

Returns:

  • (Integer)

    the game status



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

attribute :game_status, Shale::Type::Integer

#game_status_textString

Returns the game status text

Examples:

game.game_status_text #=> "7:00 pm ET"

Returns:

  • (String)

    the game status text



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

attribute :game_status_text, Shale::Type::String

#home_team_cityString

Returns the home team city

Examples:

game.home_team_city #=> "Golden State"

Returns:

  • (String)

    the home team city



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

attribute :home_team_city, Shale::Type::String

#home_team_idInteger

Returns the home team ID

Examples:

game.home_team_id #=> 1610612744

Returns:

  • (Integer)

    the home team ID



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

attribute :home_team_id, Shale::Type::Integer

#home_team_lossesInteger

Returns the home team losses

Examples:

game.home_team_losses #=> 36

Returns:

  • (Integer)

    the home team losses



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

attribute :home_team_losses, Shale::Type::Integer

#home_team_nameString

Returns the home team name

Examples:

game.home_team_name #=> "Warriors"

Returns:

  • (String)

    the home team name



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

attribute :home_team_name, Shale::Type::String

#home_team_scoreInteger

Returns the home team score

Examples:

game.home_team_score #=> 112

Returns:

  • (Integer)

    the home team score



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

attribute :home_team_score, Shale::Type::Integer

#home_team_tricodeString

Returns the home team tricode/abbreviation

Examples:

game.home_team_tricode #=> "GSW"

Returns:

  • (String)

    the home team tricode



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

attribute :home_team_tricode, Shale::Type::String

#home_team_winsInteger

Returns the home team wins

Examples:

game.home_team_wins #=> 46

Returns:

  • (Integer)

    the home team wins



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

attribute :home_team_wins, Shale::Type::Integer

Instance Method Details

#away_teamTeam?

Returns the away team object

Examples:

game.away_team #=> #<NBA::Team>

Returns:

  • (Team, nil)

    the away team object



206
207
208
# File 'lib/nba/scheduled_game.rb', line 206

def away_team
  Teams.find(away_team_id)
end

#final?Boolean

Returns whether the game is final

Examples:

game.final? #=> false

Returns:

  • (Boolean)

    true if final



236
237
238
# File 'lib/nba/scheduled_game.rb', line 236

def final?
  game_status.eql?(3)
end

#home_teamTeam?

Returns the home team object

Examples:

game.home_team #=> #<NBA::Team>

Returns:

  • (Team, nil)

    the home team object



196
197
198
# File 'lib/nba/scheduled_game.rb', line 196

def home_team
  Teams.find(home_team_id)
end

#in_progress?Boolean

Returns whether the game is in progress

Examples:

game.in_progress? #=> false

Returns:

  • (Boolean)

    true if in progress



226
227
228
# File 'lib/nba/scheduled_game.rb', line 226

def in_progress?
  game_status.eql?(2)
end

#scheduled?Boolean

Returns whether the game is scheduled

Examples:

game.scheduled? #=> true

Returns:

  • (Boolean)

    true if scheduled



216
217
218
# File 'lib/nba/scheduled_game.rb', line 216

def scheduled?
  game_status.eql?(1)
end