Class: HoopScrape
- Inherits:
 - 
      Object
      
        
- Object
 - HoopScrape
 
 
- Defined in:
 - lib/hoopscrape.rb
 
Overview
HoopScrape main class
Constant Summary collapse
- VERSION =
          
Gem Version
 '1.0.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 = {})  ⇒ HoopScrape 
    
    
  
  
  
    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 = {}) ⇒ HoopScrape
initialize
      8 9 10  | 
    
      # File 'lib/hoopscrape.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/hoopscrape.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/hoopscrape.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/hoopscrape.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/hoopscrape.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/hoopscrape.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/hoopscrape.rb', line 27 def boxscore(game_id, f_mat = nil) HoopScrape.boxscore game_id, (f_mat || @format) end  | 
  
#player(espn_id) ⇒ NbaPlayer
Return new NbaPlayer object
      110 111 112  | 
    
      # File 'lib/hoopscrape.rb', line 110 def player(espn_id) HoopScrape.player espn_id end  | 
  
#roster(team_id, options = {}) ⇒ NbaRoster
Returns an NbaRoster object
      47 48 49  | 
    
      # File 'lib/hoopscrape.rb', line 47 def roster(team_id, = {}) HoopScrape.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/hoopscrape.rb', line 89 def schedule(team_id, = {}) HoopScrape.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/hoopscrape.rb', line 63 def teamList(f_mat = nil) HoopScrape.teamList(f_mat || @format) end  |