Module: NBA::LeagueGameFinder
- Defined in:
- lib/nba/league_game_finder.rb
Overview
Provides methods to find games based on criteria
Constant Summary collapse
- TEAM_GAMES =
Result set name for team games
"TeamGameFinderResults".freeze
- PLAYER_GAMES =
Result set name for player games
"PlayerGameFinderResults".freeze
- REGULAR_SEASON =
Season type constant for regular season
"Regular Season".freeze
- PLAYOFFS =
Season type constant for playoffs
"Playoffs".freeze
Class Method Summary collapse
-
.by_player(player:, season: nil, season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection
Finds games for a player.
-
.by_team(team:, season: nil, season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection
Finds games for a team.
Class Method Details
.by_player(player:, season: nil, season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection
Finds games for a player
56 57 58 59 60 61 |
# File 'lib/nba/league_game_finder.rb', line 56 def self.by_player(player:, season: nil, season_type: REGULAR_SEASON, client: CLIENT) player_id = Utils.extract_id(player) path = build_player_path(player_id, season, season_type) response = client.get(path) parse_response(response, PLAYER_GAMES) end |
.by_team(team:, season: nil, season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection
Finds games for a team
38 39 40 41 42 43 |
# File 'lib/nba/league_game_finder.rb', line 38 def self.by_team(team:, season: nil, season_type: REGULAR_SEASON, client: CLIENT) team_id = Utils.extract_id(team) path = build_team_path(team_id, season, season_type) response = client.get(path) parse_response(response, TEAM_GAMES) end |