Class: ApiSports::StandingsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/api_sports/resources/standings.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#get_request, #get_single_resource, #handle_response, #initialize

Constructor Details

This class inherits a constructor from ApiSports::Resource

Instance Method Details

#retrieve(league_id:, season_id: nil, team_id: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/api_sports/resources/standings.rb', line 5

def retrieve(league_id:, season_id: nil, team_id: nil)
  response = get_request("standings",
                         params: { league: league_id,
                                   season: season_id,
                                   team: team_id }.compact)
  Collection.from_response(response, type: Standing) do |body|
    body["response"].first["league"]["standings"].first.map { |attrs| Standing.new(attrs) }
  end
end