Class: Football::Butler::ApiFootball::Teams

Inherits:
BaseApiFootball show all
Defined in:
lib/football/butler/api_football/teams.rb

Constant Summary collapse

PATH =
:teams

Constants inherited from Base

Base::MSG_INVALID_CONFIG

Class Method Summary collapse

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

.by_competition_and_year(id:, year:, result:, filters:) ⇒ Object

TEAMS

id integer The id of the team

name string The name of the team

league integer The id of the league

season integer 4 characters YYYY The season of the league

country string The country name of the team

search string >= 3 characters The name or the country name of the team

/teams?league=id&season=year



58
59
60
61
# File 'lib/football/butler/api_football/teams.rb', line 58

def by_competition_and_year(id:, year:, result:, filters:)
  filters.merge!({ league: id, season: year })
  Api.get(path: PATH, result: result, filters: filters)
end

.by_country_name(name:) ⇒ Object

/teams/country=country



26
27
28
29
# File 'lib/football/butler/api_football/teams.rb', line 26

def by_country_name(name:)
  filters = { country: name }
  Api.get(path: PATH, filters: filters)
end

.by_id(id:) ⇒ Object

TEAM

/teams/id=id



14
15
16
17
# File 'lib/football/butler/api_football/teams.rb', line 14

def by_id(id:)
  filters = { id: id }
  Api.get(path: PATH, filters: filters)
end

.by_name(name:) ⇒ Object

/teams/id=id



20
21
22
23
# File 'lib/football/butler/api_football/teams.rb', line 20

def by_name(name:)
  filters = { name: name }
  Api.get(path: PATH, filters: filters)
end