Class: Xmlstats::Endpoints::MlbTeamResults
- Inherits:
-
Object
- Object
- Xmlstats::Endpoints::MlbTeamResults
- Includes:
- Xmlstats::Endpoint
- Defined in:
- lib/xmlstats/endpoints/mlb_team_results.rb
Class Method Summary collapse
Methods included from Xmlstats::Endpoint
Class Method Details
.fetch(team_id = nil, season = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/xmlstats/endpoints/mlb_team_results.rb', line 5 def self.fetch(team_id = nil, season = nil) raise "please specify team_id as detailed in https://erikberg.com/api#teamresults" unless team_id params = { season: season } response = fetch_json("mlb/results/#{team_id}", params) [ response ].flatten.map do |result| Xmlstats::Objects::TeamResult.new result end end |