Module: NBA::CumeStatsPlayerGames

Defined in:
lib/nba/cume_stats_player_games.rb

Overview

Provides methods to retrieve cumulative stats player games

Defined Under Namespace

Modules: PathBuilder

Constant Summary collapse

RESULTS =

Result set name for cumulative stats player games

Returns:

  • (String)

    the result set name

"CumeStatsPlayerGames".freeze

Class Method Summary collapse

Class Method Details

.all(player:, season:, season_type: "Regular Season", league: League::NBA, location: nil, outcome: nil, vs_conference: nil, vs_division: nil, vs_team: nil, client: CLIENT) ⇒ Collection

Retrieves all cumulative stats player games for specified criteria

Examples:

games = NBA::CumeStatsPlayerGames.all(player: 201939, season: 2024, season_type: "Regular Season")
games.each { |game| puts "#{game.matchup} - #{game.game_id}" }

Parameters:

  • player (Integer, Player)

    the player ID or Player object

  • season (Integer)

    the season year

  • season_type (String) (defaults to: "Regular Season")

    the season type (Regular Season, Playoffs)

  • league (String, League) (defaults to: League::NBA)

    the league ID or League object (default NBA)

  • location (String, nil) (defaults to: nil)

    filter by location (Home, Road)

  • outcome (String, nil) (defaults to: nil)

    filter by outcome (W, L)

  • vs_conference (String, nil) (defaults to: nil)

    filter by opponent conference

  • vs_division (String, nil) (defaults to: nil)

    filter by opponent division

  • vs_team (Integer, Team, nil) (defaults to: nil)

    filter by opponent team ID or Team object

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of cumulative stats player games entries



32
33
34
35
36
37
38
39
# File 'lib/nba/cume_stats_player_games.rb', line 32

def self.all(player:, season:, season_type: "Regular Season", league: League::NBA, location: nil,
  outcome: nil, vs_conference: nil, vs_division: nil, vs_team: nil, client: CLIENT)
  opts = {player: player, season: season, season_type: season_type, league: league,
          location: location, outcome: outcome, vs_conference: vs_conference,
          vs_division: vs_division, vs_team: vs_team}
  path = PathBuilder.build(opts)
  ResponseParser.parse(client.get(path), result_set: RESULTS) { |data| build_entry(data) }
end