Module: NBA::PlayerGameStreakFinder

Defined in:
lib/nba/player_game_streak_finder.rb

Overview

Provides methods to find player game streaks

Constant Summary collapse

RESULT_SET_NAME =

Result set name for streak finder results

Returns:

  • (String)

    the result set name

"PlayerGameStreakFinderResults".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}.freeze

Class Method Summary collapse

Class Method Details

.find(season: nil, player: 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, client: CLIENT) ⇒ Collection

Finds player game streaks matching the specified criteria

Examples:

Find active 10+ point streaks

NBA::PlayerGameStreakFinder.find(gt_pts: 10, active_streaks_only: true)

Parameters:

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

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

  • player (Integer, Player, nil) (defaults to: nil)

    filter by player ID or Player object

  • 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

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    collection of GameStreak objects



37
38
39
40
41
42
# File 'lib/nba/player_game_streak_finder.rb', line 37

def self.find(season: nil, player: 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, 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}
  path = build_path(season, player, team, active_streaks_only, filters)
  ResponseParser.parse(client.get(path), result_set: RESULT_SET_NAME) { |data| build_streak(data) }
end