Class: SportsApi::Football::LeagueResource
- Defined in:
- lib/sports_api/football/resources/leagues/league.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #find(id:) ⇒ Object
-
#list(**params) ⇒ Object
Arguments: id: [Integer](optional) - The league ID.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from SportsApi::Resource
Instance Method Details
#find(id:) ⇒ Object
21 22 23 24 |
# File 'lib/sports_api/football/resources/leagues/league.rb', line 21 def find(id:) response = get_request('leagues', params: { id: id.to_s }) SportsApi::Football::League.new(response.body['response'][0]) end |
#list(**params) ⇒ Object
Arguments: id: [Integer](optional) - The league ID. name: [String](optional) - The name of the league. country: [String] (optional) - The country name of the league. code: [String] (optional) - The country code of the league (= XXX). season: [Integer] (optional) - The season of the league (= YYYY). type: [String] (optional) - The type of the league [“league”, “cup”]. current: [String] (optional) - The current status of the league [“true”, “false”]. team: [Integer] (optional) - The team ID that has played at least one match. search: [String] (optional) - The league or country name, can be some letters (>= XXX).
16 17 18 19 |
# File 'lib/sports_api/football/resources/leagues/league.rb', line 16 def list(**params) response = get_request('leagues', params:) Collection.from_response(response, type: SportsApi::Football::League) end |