Module: NBA::DraftHistory
- Defined in:
- lib/nba/draft_history.rb
Overview
Provides methods to retrieve draft history
Constant Summary collapse
- DRAFT_HISTORY =
Result set name for draft history
"DraftHistory".freeze
Class Method Summary collapse
-
.all(season: nil, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves all draft picks for a season.
-
.by_team(team:, season: nil, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves draft picks for a specific team.
Class Method Details
.all(season: nil, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves all draft picks for a season
24 25 26 27 28 29 |
# File 'lib/nba/draft_history.rb', line 24 def self.all(season: nil, league: League::NBA, client: CLIENT) league_id = Utils.extract_league_id(league) path = build_path(season, league_id) response = client.get(path) parse_response(response) end |
.by_team(team:, season: nil, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves draft picks for a specific team
42 43 44 45 46 47 |
# File 'lib/nba/draft_history.rb', line 42 def self.by_team(team:, season: nil, league: League::NBA, client: CLIENT) team_id = extract_team_id(team) all_picks = all(season: season, league: league, client: client) filtered = all_picks.select { |pick| pick.team_id.eql?(team_id) } Collection.new(filtered) end |