Module: NBA::TeamGameStreakFinder

Defined in:
lib/nba/team_game_streak_finder.rb

Overview

Provides methods to find team game streaks

Constant Summary collapse

RESULT_SET_NAME =

Result set name for streak finder results

Returns:

  • (String)

    the result set name

"TeamGameStreakFinderParametersResults".freeze
STAT_FILTERS =

Stat filter parameter mappings

Returns:

  • (Hash)

    mapping of Ruby method parameters to API parameters

{gt_pts: :GtPTS, gt_reb: :GtREB, gt_ast: :GtAST, gt_stl: :GtSTL, gt_blk: :GtBLK,
gt_fg3m: :GtFG3M, w_streak: :WStreak, l_streak: :LStreak}.freeze

Class Method Summary collapse

Class Method Details

.find(season: nil, team: nil, active_streaks_only: nil, gt_pts: nil, gt_reb: nil, gt_ast: nil, gt_stl: nil, gt_blk: nil, gt_fg3m: nil, w_streak: nil, l_streak: nil, client: CLIENT) ⇒ Collection

Finds team game streaks matching the specified criteria

Examples:

Find active 100+ point streaks

NBA::TeamGameStreakFinder.find(gt_pts: 100, active_streaks_only: true)

Parameters:

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

    the season to search (e.g., “2024-25”)

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

    filter by team ID or Team object

  • active_streaks_only (Boolean, nil) (defaults to: nil)

    only return active streaks

  • gt_pts (Integer, nil) (defaults to: nil)

    minimum points per game

  • gt_reb (Integer, nil) (defaults to: nil)

    minimum rebounds per game

  • gt_ast (Integer, nil) (defaults to: nil)

    minimum assists per game

  • gt_stl (Integer, nil) (defaults to: nil)

    minimum steals per game

  • gt_blk (Integer, nil) (defaults to: nil)

    minimum blocks per game

  • gt_fg3m (Integer, nil) (defaults to: nil)

    minimum 3-pointers made per game

  • w_streak (Integer, nil) (defaults to: nil)

    minimum consecutive wins

  • l_streak (Integer, nil) (defaults to: nil)

    minimum consecutive losses

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    collection of TeamGameStreak objects



39
40
41
42
43
44
45
# File 'lib/nba/team_game_streak_finder.rb', line 39

def self.find(season: nil, team: nil, active_streaks_only: nil, gt_pts: nil, gt_reb: nil,
  gt_ast: nil, gt_stl: nil, gt_blk: nil, gt_fg3m: nil, w_streak: nil, l_streak: nil, client: CLIENT)
  filters = {gt_pts: gt_pts, gt_reb: gt_reb, gt_ast: gt_ast, gt_stl: gt_stl, gt_blk: gt_blk,
             gt_fg3m: gt_fg3m, w_streak: w_streak, l_streak: l_streak}
  path = build_path(season, team, active_streaks_only, filters)
  ResponseParser.parse(client.get(path), result_set: RESULT_SET_NAME) { |data| build_streak(data) }
end