Module: NBA::ScheduleInternational
- Defined in:
- lib/nba/schedule_international.rb
Overview
Provides methods to retrieve international league schedule
Constant Summary collapse
- LEAGUE_SCHEDULE =
Result set name for league schedule
"LeagueSchedule".freeze
Class Method Summary collapse
-
.all(season: Utils.current_season, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves the international league schedule.
-
.by_date(date:, season: Utils.current_season, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves international games for a specific date.
-
.by_team(team:, season: Utils.current_season, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves international games for a specific team.
Class Method Details
.all(season: Utils.current_season, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves the international league schedule
24 25 26 27 28 29 |
# File 'lib/nba/schedule_international.rb', line 24 def self.all(season: Utils.current_season, 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_date(date:, season: Utils.current_season, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves international games for a specific date
42 43 44 45 46 47 |
# File 'lib/nba/schedule_international.rb', line 42 def self.by_date(date:, season: Utils.current_season, league: League::NBA, client: CLIENT) all_games = all(season: season, league: league, client: client) date_str = date.strftime filtered = all_games.select { |g| g.game_date&.start_with?(date_str) } Collection.new(filtered) end |
.by_team(team:, season: Utils.current_season, league: League::NBA, client: CLIENT) ⇒ Collection
Retrieves international games for a specific team
60 61 62 63 64 65 |
# File 'lib/nba/schedule_international.rb', line 60 def self.by_team(team:, season: Utils.current_season, league: League::NBA, client: CLIENT) team_id = extract_team_id(team) all_games = all(season: season, league: league, client: client) filtered = all_games.select { |g| g.home_team_id.eql?(team_id) || g.away_team_id.eql?(team_id) } Collection.new(filtered) end |