Class: ApiSports::LeaguesResource
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#get_request, #get_single_resource, #handle_response, #initialize
Instance Method Details
#list(**params) ⇒ Object
5
6
7
8
|
# File 'lib/api_sports/resources/leagues.rb', line 5
def list(**params)
response = get_request("leagues", params: params)
Collection.from_response(response, type: League)
end
|
#retrieve(league_id:) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/api_sports/resources/leagues.rb', line 10
def retrieve(league_id:)
response = get_single_resource("leagues", params: { id: league_id }) do |r|
r.body["response"].first.dig("league")
end
League.new(response)
end
|
17
18
19
20
|
# File 'lib/api_sports/resources/leagues.rb', line 17
def seasons
response = get_request("leagues/seasons")
Collection.from_response(response, type: Season)
end
|