Module: NBA::CumeStatsTeamGames

Defined in:
lib/nba/cume_stats_team_games.rb

Overview

Provides methods to retrieve cumulative stats team games

Defined Under Namespace

Modules: PathBuilder

Constant Summary collapse

RESULTS =

Result set name

Returns:

  • (String)

    the result set name

"CumeStatsTeamGames".freeze
REGULAR_SEASON =

Regular season type

Returns:

  • (String)

    the season type

"Regular Season".freeze
PLAYOFFS =

Playoffs season type

Returns:

  • (String)

    the season type

"Playoffs".freeze

Class Method Summary collapse

Class Method Details

.all(team:, season:, season_type: REGULAR_SEASON, league: League::NBA, location: nil, outcome: nil, season_id: nil, vs_conference: nil, vs_division: nil, vs_team: nil, client: CLIENT) ⇒ Collection

Retrieves cumulative stats team games

Examples:

games = NBA::CumeStatsTeamGames.all(team: 1610612747, season: 2023)
games.each { |g| puts "#{g.matchup}: #{g.game_id}" }

Parameters:

  • team (Integer, String, Team)

    the team ID or Team 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)

    the location filter (Home, Road)

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

    the outcome filter (W, L)

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

    the season ID

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

    the vs conference filter (East, West)

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

    the vs division filter

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

    the vs team ID or Team object

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of cumulative stats team games entries



40
41
42
43
44
45
46
47
48
# File 'lib/nba/cume_stats_team_games.rb', line 40

def self.all(team:, season:, season_type: REGULAR_SEASON, league: League::NBA, location: nil, outcome: nil,
  season_id: nil, vs_conference: nil, vs_division: nil, vs_team: nil, client: CLIENT)
  opts = {team: team, season: season, season_type: season_type, league: league, location: location,
          outcome: outcome, season_id: season_id, vs_conference: vs_conference,
          vs_division: vs_division, vs_team: vs_team}
  path = PathBuilder.build(opts)
  response = client.get(path)
  parse_response(response)
end