Class: MLB::Roster
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::Roster
- Defined in:
- lib/mlb/roster.rb
Class Method Summary collapse
Class Method Details
.find(team:, season: Time.now.year, sport: Sport.new(id: 1)) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/mlb/roster.rb', line 12 def self.find(team:, season: Time.now.year, sport: Sport.new(id: 1)) team_id = team.respond_to?(:id) ? team.id : team sport_id = sport.respond_to?(:id) ? sport.id : sport params = {season:, sportId: sport_id} query_string = URI.encode_www_form(params) response = CLIENT.get("teams/#{team_id}/roster?#{query_string}") roster = from_json(response) roster.roster end |