Class: EspnScrape
- Inherits:
-
Object
- Object
- EspnScrape
- Defined in:
- lib/espnscrape.rb
Overview
EspnScrape main class
Constant Summary collapse
- VERSION =
Gem Version
'0.6.5'.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
8 9 10 |
# File 'lib/espnscrape.rb', line 8 def initialize(config = {}) @format = defaultFormat(config[:format]) end |
Class Method Details
.boxscore(game_id, f_mat = nil) ⇒ NbaBoxScore
Returns an NbaBoxScore object
17 18 19 20 |
# File 'lib/espnscrape.rb', line 17 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
101 102 103 |
# File 'lib/espnscrape.rb', line 101 def self.player(espn_id) NbaPlayer.new espn_id end |
.roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object
36 37 38 39 |
# File 'lib/espnscrape.rb', line 36 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
76 77 78 79 80 81 |
# File 'lib/espnscrape.rb', line 76 def self.schedule(team_id, = {}) NbaSchedule.new team_id: team_id, season_type: [:season], format: defaultFormat([:format]), year: [:year] end |
.teamList(f_mat = nil) ⇒ [[String]]
Return Array of Team Data
55 56 57 |
# File 'lib/espnscrape.rb', line 55 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
27 28 29 |
# File 'lib/espnscrape.rb', line 27 def boxscore(game_id, f_mat = nil) EspnScrape.boxscore game_id, (f_mat || @format) end |
#player(espn_id) ⇒ NbaPlayer
Return new NbaPlayer object
110 111 112 |
# File 'lib/espnscrape.rb', line 110 def player(espn_id) EspnScrape.player espn_id end |
#roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object
47 48 49 |
# File 'lib/espnscrape.rb', line 47 def roster(team_id, = {}) EspnScrape.roster team_id, format: (.fetch(:format, nil) || @format) end |
#schedule(team_id, options = {}) ⇒ NbaSchedule
Return an NbaSchedule object
89 90 91 92 93 94 |
# File 'lib/espnscrape.rb', line 89 def schedule(team_id, = {}) EspnScrape.schedule team_id, season: [:season], format: ([:format] || @format), year: [:year] end |
#teamList(f_mat = nil) ⇒ [[String]]
Return Array of Team Data
63 64 65 |
# File 'lib/espnscrape.rb', line 63 def teamList(f_mat = nil) EspnScrape.teamList(f_mat || @format) end |