Module: NBA::MatchupsRollup

Defined in:
lib/nba/matchups_rollup.rb

Overview

Provides methods to retrieve NBA matchup rollup statistics

Constant Summary collapse

RESULT_SET =

Result set name for matchups rollup

"MatchupsRollup".freeze

Class Method Summary collapse

Class Method Details

.all(season: Utils.current_season, season_type: "Regular Season", per_mode: "Totals", def_player: nil, def_team: nil, off_player: nil, off_team: nil, league: League::NBA, client: CLIENT) ⇒ Collection

Retrieves matchup rollup statistics

Examples:

matchups = NBA::MatchupsRollup.all(season: 2023)
matchups.each { |m| puts "#{m.def_player_name}: #{m.matchup_fg_pct}" }


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nba/matchups_rollup.rb', line 32

def self.all(season: Utils.current_season, season_type: "Regular Season",
  per_mode: "Totals", def_player: nil, def_team: nil, off_player: nil,
  off_team: nil, league: League::NBA, client: CLIENT)
  league_id = Utils.extract_league_id(league)
  opts = {season: season, season_type: season_type, per_mode: per_mode,
          def_player_id: Utils.extract_id(def_player), def_team_id: Utils.extract_id(def_team),
          off_player_id: Utils.extract_id(off_player), off_team_id: Utils.extract_id(off_team),
          league_id: league_id}
  ResponseParser.parse(client.get(build_path(opts)), result_set: RESULT_SET) do |data|
    build_matchup(data)
  end
end