class HoopScrape

HoopScrape main class

Constants

VERSION

Gem Version

Public Class Methods

boxscore(game_id, f_mat = nil) click to toggle source

Returns an {NbaBoxScore} object @param game_id [Integer] Boxscore ID @return [NbaBoxScore] NbaBoxScore @example

HoopScrape.boxscore(493848273)
# 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
new(config = {}) click to toggle source

initialize

# File lib/hoopscrape.rb, line 8
def initialize(config = {})
  @format = defaultFormat(config[:format])
end
player(espn_id) click to toggle source

Return new {NbaPlayer} object @param espn_id [String] ESPN Player ID @return [NbaPlayer] NbaPlayer @example

HoopScrape.player(2991473)
# File lib/hoopscrape.rb, line 101
def self.player(espn_id)
  NbaPlayer.new espn_id
end
roster(team_id, options = {}) click to toggle source

Returns an {NbaRoster} object @param team_id [String] Team ID @return [NbaRoster] NbaRoster @example

HoopScrape.roster('UTA')
# File lib/hoopscrape.rb, line 36
def self.roster(team_id, options = {})
  NbaRoster.new(team_id: team_id,
                format: defaultFormat(options.fetch(:format, nil)))
end
schedule(team_id, options = {}) click to toggle source

Return an {NbaSchedule} object @param team_id [String] Team ID @param options [Int] Season Type @param options [Int] Ending Year of Season (i.e. 2016 for 2015-16) @param options [Sym] Table Format (:to_structs/:to_hashes) @return [NbaSchedule] NbaSchedule @example

HoopScrape.schedule('UTA')            # Schedule for Latest Season Type
HoopScrape.schedule('TOR', s_type: 3) # Playoff Schedule
# File lib/hoopscrape.rb, line 76
def self.schedule(team_id, options = {})
  NbaSchedule.new team_id: team_id,
                  season_type: options[:season],
                  format: defaultFormat(options[:format]),
                  year: options[:year]
end
teamList(f_mat = nil) click to toggle source

Return Array of Team Data @return [[[String]]] NBA Team Data @example

HoopScrape.teamList(:to_structs)
# File lib/hoopscrape.rb, line 55
def self.teamList(f_mat = nil)
  NbaTeamList.new(format: defaultFormat(f_mat)).teamList
end

Public Instance Methods

boxscore(game_id, f_mat = nil) click to toggle source

Returns an {NbaBoxScore} object @param (see .boxscore) @return (see .boxscore) @example

hs.boxscore(493848273)
# File lib/hoopscrape.rb, line 27
def boxscore(game_id, f_mat = nil)
  HoopScrape.boxscore game_id, (f_mat || @format)
end
player(espn_id) click to toggle source

Return new {NbaPlayer} object @param (see .player) @return (see .player) @example

hs.player(2991473)
# File lib/hoopscrape.rb, line 110
def player(espn_id)
  HoopScrape.player espn_id
end
roster(team_id, options = {}) click to toggle source

Returns an {NbaRoster} object @param (see .roster) @return (see .roster) @example

hs.roster('UTA')
hs.roster('UTA', format: :to_structs)
# File lib/hoopscrape.rb, line 47
def roster(team_id, options = {})
  HoopScrape.roster team_id, format: (options.fetch(:format, nil) || @format)
end
schedule(team_id, options = {}) click to toggle source

Return an {NbaSchedule} object @param (see .schedule) @return (see .schedule) @example

hs.schedule('MIA')     # Schedule for Latest Season Type
hs.schedule('DET', season: 1, year: 2016)  # Preseason Schedule
# File lib/hoopscrape.rb, line 89
def schedule(team_id, options = {})
  HoopScrape.schedule team_id,
                      season: options[:season],
                      format: (options[:format] || @format),
                      year: options[:year]
end
teamList(f_mat = nil) click to toggle source

Return Array of Team Data @return (see .teamList) @example

hs.teamList(:to_structs)
# File lib/hoopscrape.rb, line 63
def teamList(f_mat = nil)
  HoopScrape.teamList(f_mat || @format)
end