Class: NBA::ScheduledGame

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

Overview

Represents a scheduled game

API:

  • public

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arena_cityString

Returns the arena city

Examples:

game.arena_city #=> "San Francisco"

Returns:

  • the arena city

API:

  • public



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:

  • the arena name

API:

  • public



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:

  • the arena state

API:

  • public



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:

  • the away team city

API:

  • public



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:

  • the away team ID

API:

  • public



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:

  • the away team losses

API:

  • public



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:

  • the away team name

API:

  • public



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:

  • the away team score

API:

  • public



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:

  • the away team tricode

API:

  • public



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:

  • the away team wins

API:

  • public



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:

  • the broadcasters

API:

  • public



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:

  • the game code

API:

  • public



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:

  • the game date

API:

  • public



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:

  • the game ID

API:

  • public



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:

  • the game status

API:

  • public



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:

  • the game status text

API:

  • public



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:

  • the home team city

API:

  • public



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:

  • the home team ID

API:

  • public



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:

  • the home team losses

API:

  • public



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:

  • the home team name

API:

  • public



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:

  • the home team score

API:

  • public



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:

  • the home team tricode

API:

  • public



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:

  • the home team wins

API:

  • public



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:

  • the away team object

API:

  • public



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:

  • true if final

API:

  • public



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:

  • the home team object

API:

  • public



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:

  • true if in progress

API:

  • public



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:

  • true if scheduled

API:

  • public



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

def scheduled?
  game_status.eql?(1)
end