Class: EspnScrape
- Inherits:
-
Object
- Object
- EspnScrape
- Defined in:
- lib/espnscrape.rb
Overview
EspnScrape main class
Constant Summary collapse
- VERSION =
Gem Version
'0.6.0'.freeze
Class Method Summary collapse
-
.boxscore(game_id, f_mat = nil) ⇒ NbaBoxScore
Returns an NbaBoxScore object.
-
.player(espn_id) ⇒ NbaPlayer
Return new NbaPlayer object.
-
.roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object.
-
.schedule(team_id, options = {}) ⇒ NbaSchedule
Return an NbaSchedule object.
-
.teamList(f_mat = nil) ⇒ [[String]]
Return Array of Team Data.
Instance Method Summary collapse
-
#boxscore(game_id, f_mat = nil) ⇒ NbaBoxScore
Returns an NbaBoxScore object.
-
#initialize(config = {}) ⇒ EspnScrape
constructor
initialize.
-
#player(espn_id) ⇒ NbaPlayer
Return new NbaPlayer object.
-
#roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object.
-
#schedule(team_id, options = {}) ⇒ NbaSchedule
Return an NbaSchedule object.
-
#teamList(f_mat = nil) ⇒ [[String]]
Return Array of Team Data.
Constructor Details
#initialize(config = {}) ⇒ EspnScrape
initialize
35 36 37 |
# File 'lib/espnscrape.rb', line 35 def initialize(config = {}) @format = defaultFormat(config[:format]) end |
Class Method Details
.boxscore(game_id, f_mat = nil) ⇒ NbaBoxScore
Returns an NbaBoxScore object
44 45 46 47 |
# File 'lib/espnscrape.rb', line 44 def self.boxscore(game_id, f_mat = nil) NbaBoxScore.new(game_id: game_id, format: defaultFormat(f_mat)) end |
.player(espn_id) ⇒ NbaPlayer
Return new NbaPlayer object
126 127 128 |
# File 'lib/espnscrape.rb', line 126 def self.player(espn_id) NbaPlayer.new espn_id end |
.roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object
63 64 65 66 |
# File 'lib/espnscrape.rb', line 63 def self.roster(team_id, = {}) NbaRoster.new(team_id: team_id, format: defaultFormat(.fetch(:format, nil))) end |
.schedule(team_id, options = {}) ⇒ NbaSchedule
Return an NbaSchedule object
101 102 103 104 105 106 |
# File 'lib/espnscrape.rb', line 101 def self.schedule(team_id, = {}) NbaSchedule.new team_id: team_id, season_type: .fetch(:season, ''), format: defaultFormat(.fetch(:format, nil)), year: .fetch(:year, nil) end |
.teamList(f_mat = nil) ⇒ [[String]]
Return Array of Team Data
82 83 84 |
# File 'lib/espnscrape.rb', line 82 def self.teamList(f_mat = nil) NbaTeamList.new(format: defaultFormat(f_mat)).teamList end |
Instance Method Details
#boxscore(game_id, f_mat = nil) ⇒ NbaBoxScore
Returns an NbaBoxScore object
54 55 56 |
# File 'lib/espnscrape.rb', line 54 def boxscore(game_id, f_mat = nil) EspnScrape.boxscore game_id, (f_mat || @format) end |
#player(espn_id) ⇒ NbaPlayer
Return new NbaPlayer object
135 136 137 |
# File 'lib/espnscrape.rb', line 135 def player(espn_id) EspnScrape.player espn_id end |
#roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object
74 75 76 |
# File 'lib/espnscrape.rb', line 74 def roster(team_id, = {}) EspnScrape.roster team_id, format: (.fetch(:format, nil) || @format) end |
#schedule(team_id, options = {}) ⇒ NbaSchedule
Return an NbaSchedule object
114 115 116 117 118 119 |
# File 'lib/espnscrape.rb', line 114 def schedule(team_id, = {}) EspnScrape.schedule team_id, s_type: .fetch(:season, ''), format: (.fetch(:format, nil) || @format), year: .fetch(:year, nil) end |
#teamList(f_mat = nil) ⇒ [[String]]
Return Array of Team Data
90 91 92 |
# File 'lib/espnscrape.rb', line 90 def teamList(f_mat = nil) EspnScrape.teamList(f_mat || @format) end |