Class: NbaBoxScore
- Inherits:
-
Object
- Object
- NbaBoxScore
- Includes:
- NbaUrls
- Defined in:
- lib/espnscrape/NbaBoxScore.rb
Overview
Access NBA boxscore data
Instance Attribute Summary collapse
-
#awayName ⇒ String
readonly
Away Team Name.
-
#awayPlayers ⇒ Navigator
readonly
Away Team Stats Array.
-
#awayScore ⇒ Object
readonly
Returns the value of attribute awayScore.
-
#awayTotals ⇒ [String]
readonly
Away Team Combined Stats.
-
#gameDate ⇒ String
readonly
Game Date.
-
#homeName ⇒ String
readonly
Home Team Name.
-
#homePlayers ⇒ Navigator
readonly
Home Team Stats Array.
-
#homeScore ⇒ Object
readonly
Returns the value of attribute homeScore.
-
#homeTotals ⇒ [String]
readonly
Home Team Combined Stats.
-
#id ⇒ Object
readonly
Boxscore ID.
Instance Method Summary collapse
-
#initialize(args) ⇒ NbaBoxScore
constructor
Scrape Box Score Data.
Methods included from NbaUrls
#boxScoreUrl, #checkSpecial, #formatTeamUrl, #getTid, #playerUrl, #seasonYearEnd, #seasonYears, #teamListUrl, #teamRosterUrl, #teamScheduleUrl
Constructor Details
#initialize(args) ⇒ NbaBoxScore
Scrape Box Score Data
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
#awayName ⇒ String (readonly)
Returns Away Team Name.
12 13 14 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 12 def awayName @awayName end |
#awayPlayers ⇒ Navigator (readonly)
Returns Away Team Stats Array.
17 18 19 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 17 def awayPlayers @awayPlayers end |
#awayScore ⇒ Object (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.
22 23 24 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 22 def awayTotals @awayTotals end |
#gameDate ⇒ String (readonly)
Returns Game Date.
9 10 11 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 9 def gameDate @gameDate end |
#homeName ⇒ String (readonly)
Returns Home Team Name.
25 26 27 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 25 def homeName @homeName end |
#homePlayers ⇒ Navigator (readonly)
Returns Home Team Stats Array.
30 31 32 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 30 def homePlayers @homePlayers end |
#homeScore ⇒ Object (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.
35 36 37 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 35 def homeTotals @homeTotals end |
#id ⇒ Object (readonly)
Boxscore ID
38 39 40 |
# File 'lib/espnscrape/NbaBoxScore.rb', line 38 def id @id end |