Class: EspnScrape

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

Overview

EspnScrape main class

Constant Summary

Constants included from Version

Version::VERSION

Instance Method Summary collapse

Constructor Details

#initializeEspnScrape

Create EspnScrape object



27
28
29
30
31
32
# File 'lib/espnscrape.rb', line 27

def initialize
  @boxscore = getBoxscore()
  @roster = getRoster()
  @team_list = getTeamList()
  # @schedule = getSchedule()
end

Instance Method Details

#getBoxscore(game_id = 0) ⇒ NbaBoxScore

get/set method for boxscore

Examples:

getBoxscore() #=> getter
getBoxscore(493848273) #=> setter

Parameters:

  • game_id (Integer) (defaults to: 0)

Returns:



40
41
42
43
44
45
46
47
48
49
# File 'lib/espnscrape.rb', line 40

def getBoxscore(game_id=0)
  if game_id == 0 && !@boxscore.nil?
    return @boxscore
  elsif game_id != 0
    @boxscore = NbaBoxScore.new(game_id)
    return @boxscore
  else
    return nil
  end
end

#getRoster(team_id = '') ⇒ NbaRoster

get/set method for roster

Examples:

getRoster() #=> getter
getRoster('UTA') #=> setter

Parameters:

  • team_id (String) (defaults to: '')

Returns:



58
59
60
61
62
63
64
65
66
67
# File 'lib/espnscrape.rb', line 58

def getRoster(team_id='')
  if team_id == '' && !@roster.nil?
    return @roster
  elsif team_id != ''
    @roster = NbaRoster.new(team_id)
    return @roster
  else
    return nil
  end
end

#getSchedule(team_id = '') ⇒ NbaSchedule

get/set method for schedule

Examples:

getSchedule() #=> getter
getSchedule('UTA') #=> setter

Parameters:

  • team_id (String) (defaults to: '')

Returns:



85
86
87
88
89
90
91
92
93
94
# File 'lib/espnscrape.rb', line 85

def getSchedule(team_id='')
  if team_id == '' && !@schedule.nil?
    return @schedule
  elsif team_id != ''
    @schedule = NbaSchedule.new(team_id)
    return @schedule
  else
    return nil
  end
end

#getTeamListNbaTeamList

Return list of NBA teams

Returns:



71
72
73
74
75
76
# File 'lib/espnscrape.rb', line 71

def getTeamList()
  if @team_list.nil?
    @team_list = NbaTeamList.new()
  end
  return @team_list
end