Class: MLB::SportPlayers
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::SportPlayers
- Defined in:
- lib/mlb/sport_players.rb
Overview
Provides methods for fetching players for a sport from the API
Class Method Summary collapse
-
.all(season: nil, sport: Utils::DEFAULT_SPORT_ID) ⇒ Array<Player>
Retrieves all players for a sport.
Class Method Details
.all(season: nil, sport: Utils::DEFAULT_SPORT_ID) ⇒ Array<Player>
Retrieves all players for a sport
23 24 25 26 27 28 |
# File 'lib/mlb/sport_players.rb', line 23 def self.all(season: nil, sport: Utils::DEFAULT_SPORT_ID) season ||= Utils.current_season sport_id = Utils.extract_id(sport) response = CLIENT.get("sports/#{sport_id}/players?#{Utils.build_query(season:)}") from_json(response).people end |