Module: NBA::GameRotation
- Defined in:
- lib/nba/game_rotation.rb
Overview
Provides methods to retrieve game rotation data
Constant Summary collapse
- HOME_TEAM =
Result set name for home team rotation
"HomeTeam".freeze
- AWAY_TEAM =
Result set name for away team rotation
"AwayTeam".freeze
Class Method Summary collapse
-
.all(game:, client: CLIENT) ⇒ Collection
Retrieves all rotation data for a game.
-
.away_team(game:, client: CLIENT) ⇒ Collection
Retrieves rotation data for the away team in a game.
-
.home_team(game:, client: CLIENT) ⇒ Collection
Retrieves rotation data for the home team in a game.
Class Method Details
.all(game:, client: CLIENT) ⇒ Collection
Retrieves all rotation data for a game
59 60 61 62 63 |
# File 'lib/nba/game_rotation.rb', line 59 def self.all(game:, client: CLIENT) home = home_team(game: game, client: client).to_a away = away_team(game: game, client: client).to_a Collection.new(home + away) end |
.away_team(game:, client: CLIENT) ⇒ Collection
Retrieves rotation data for the away team in a game
43 44 45 46 47 48 |
# File 'lib/nba/game_rotation.rb', line 43 def self.away_team(game:, client: CLIENT) game_id = extract_game_id(game) path = build_path(game_id) response = client.get(path) parse_response(response, AWAY_TEAM, game_id) end |
.home_team(game:, client: CLIENT) ⇒ Collection
Retrieves rotation data for the home team in a game
27 28 29 30 31 32 |
# File 'lib/nba/game_rotation.rb', line 27 def self.home_team(game:, client: CLIENT) game_id = extract_game_id(game) path = build_path(game_id) response = client.get(path) parse_response(response, HOME_TEAM, game_id) end |