Class: Football::Butler::ApiFootball::Coachs

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

Constant Summary collapse

PATH =
:coachs

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_id(id:, result:, filters:) ⇒ Object

COACHS

id integer The id of the coach

team integer The id of the team

search string >= 3 characters The name of the coach

/coachs?id=id



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

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

.by_team(team:, result:, filters:) ⇒ Object

/coachs?team=team



38
39
40
41
# File 'lib/football/butler/api_football/coachs.rb', line 38

def by_team(team:, result:, filters:)
  filters.merge!({ team: team })
  Api.get(path: PATH, result: result, filters: filters)
end

.search_by_name(name:, result:, filters:) ⇒ Object

/coachs?search=name



32
33
34
35
# File 'lib/football/butler/api_football/coachs.rb', line 32

def search_by_name(name:, result:, filters:)
  filters.merge!({ search: name })
  Api.get(path: PATH, result: result, filters: filters)
end