Class: NbaBoxScore

Inherits:
Object
  • Object
show all
Includes:
NbaUrls
Defined in:
lib/espnscrape/NbaBoxScore.rb

Overview

Access NBA boxscore data

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NbaUrls

#boxScoreUrl, #checkSpecial, #formatTeamUrl, #getTid, #playerUrl, #seasonYearEnd, #seasonYears, #teamListUrl, #teamRosterUrl, #teamScheduleUrl

Constructor Details

#initialize(args) ⇒ NbaBoxScore

Scrape Box Score Data

Examples:

bs = NbaBoxScore.new(400828035)

Parameters:

  • game_id (Integer)

    Boxscore ID



46
47
48
49
50
51
52
53
54
55
# File 'lib/espnscrape/NbaBoxScore.rb', line 46

def initialize(args)
  doc = getNokoDoc(args[:game_id], args[:file])
  return if doc.nil?
  @id = args[:game_id].to_s
  @gameDate = readGameDate(doc)
  @awayName, @homeName = readTeamNames(doc)
  return unless @gameDate.index('00:00:00') # Only past games have stats
  @awayPlayers, @awayTotals, @awayScore = readTeamStats(doc, 'away', args[:format])
  @homePlayers, @homeTotals, @homeScore = readTeamStats(doc, 'home', args[:format])
end

Instance Attribute Details

#awayNameString (readonly)

Returns Away Team Name.

Returns:



12
13
14
# File 'lib/espnscrape/NbaBoxScore.rb', line 12

def awayName
  @awayName
end

#awayPlayersNavigator (readonly)

Returns Away Team Stats Array.

Returns:

See Also:

  • BOX_P


17
18
19
# File 'lib/espnscrape/NbaBoxScore.rb', line 17

def awayPlayers
  @awayPlayers
end

#awayScoreObject (readonly)

Returns the value of attribute awayScore.



39
40
41
# File 'lib/espnscrape/NbaBoxScore.rb', line 39

def awayScore
  @awayScore
end

#awayTotals[String] (readonly)

Returns Away Team Combined Stats.

Returns:

  • ([String])

    Away Team Combined Stats

See Also:

  • BOX_T


22
23
24
# File 'lib/espnscrape/NbaBoxScore.rb', line 22

def awayTotals
  @awayTotals
end

#gameDateString (readonly)

Returns Game Date.

Returns:



9
10
11
# File 'lib/espnscrape/NbaBoxScore.rb', line 9

def gameDate
  @gameDate
end

#homeNameString (readonly)

Returns Home Team Name.

Returns:



25
26
27
# File 'lib/espnscrape/NbaBoxScore.rb', line 25

def homeName
  @homeName
end

#homePlayersNavigator (readonly)

Returns Home Team Stats Array.

Returns:

See Also:

  • BOX_P


30
31
32
# File 'lib/espnscrape/NbaBoxScore.rb', line 30

def homePlayers
  @homePlayers
end

#homeScoreObject (readonly)

Returns the value of attribute homeScore.



40
41
42
# File 'lib/espnscrape/NbaBoxScore.rb', line 40

def homeScore
  @homeScore
end

#homeTotals[String] (readonly)

Returns Home Team Combined Stats.

Returns:

  • ([String])

    Home Team Combined Stats

See Also:

  • BOX_T


35
36
37
# File 'lib/espnscrape/NbaBoxScore.rb', line 35

def homeTotals
  @homeTotals
end

#idObject (readonly)

Boxscore ID



38
39
40
# File 'lib/espnscrape/NbaBoxScore.rb', line 38

def id
  @id
end