Class: Football::Butler::ApiFootball::Leagues
- Inherits:
-
BaseApiFootball
- Object
- Base
- BaseApiFootball
- Football::Butler::ApiFootball::Leagues
- Defined in:
- lib/football/butler/api_football/leagues.rb
Constant Summary collapse
- PATH =
:leagues
Constants inherited from Base
Class Method Summary collapse
- .all(result:, filters:) ⇒ Object
-
.all_cups(result:, filters:) ⇒ Object
/leagues?type=cup.
-
.all_leagues(result:, filters:) ⇒ Object
/leagues?type=league.
-
.all_seasons(result:) ⇒ Object
/leagues/seasons.
-
.by_country_name(name:, result:) ⇒ Object
/leagues?country=country.
-
.by_id(id:) ⇒ Object
LEAGUE /leagues?id=id.
-
.search_by_name(name:, filters:, result:) ⇒ Object
/leagues?search=name.
Methods inherited from Base
api_class, api_switch, api_switch_method, api_switch_result, error_message, invalid_config_result, not_found_result, reached_limit?, this_class, unsupported_api_call, unsupported_api_endpoint
Class Method Details
.all(result:, filters:) ⇒ Object
LEAGUES www.api-football.com/documentation-v3#operation/get-leagues
id integer The id of the league
name string The name of the league
country string The country name of the league
code string 2 characters FR, GB, IT… The Alpha2 code of the country
season integer 4 characters YYYY The season of the league
team integer The id of the team
type string Enum: “league” “cup” The type of the league
current string Enum: “true” “false” The state of the league
search string >= 3 characters The name or the country of the league
last integer <= 2 characters
/leagues
75 76 77 |
# File 'lib/football/butler/api_football/leagues.rb', line 75 def all(result:, filters:) Api.get(path: PATH, result: result, filters: filters) end |
.all_cups(result:, filters:) ⇒ Object
/leagues?type=cup
92 93 94 95 |
# File 'lib/football/butler/api_football/leagues.rb', line 92 def all_cups(result:, filters:) filters.merge!({ type: 'cup' }) Api.get(path: PATH, result: result, filters: filters) end |
.all_leagues(result:, filters:) ⇒ Object
/leagues?type=league
86 87 88 89 |
# File 'lib/football/butler/api_football/leagues.rb', line 86 def all_leagues(result:, filters:) filters.merge!({ type: 'league' }) Api.get(path: PATH, result: result, filters: filters) end |
.all_seasons(result:) ⇒ Object
/leagues/seasons
25 26 27 28 |
# File 'lib/football/butler/api_football/leagues.rb', line 25 def all_seasons(result:) path = "#{PATH}/seasons" Api.get(path: path, result: result) end |
.by_country_name(name:, result:) ⇒ Object
/leagues?country=country
19 20 21 22 |
# File 'lib/football/butler/api_football/leagues.rb', line 19 def by_country_name(name:, result:) filters = { country: name } Api.get(path: PATH, filters: filters, result: result) end |