Class: Football::Butler::Apifootball::Competitions

Inherits:
BaseApifootball show all
Defined in:
lib/football/butler/apifootball/competitions.rb

Constant Summary collapse

PATH =
:get_leagues

Constants inherited from Base

Base::MSG_INVALID_CONFIG

Class Method Summary collapse

Methods inherited from BaseApifootball

build_path

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

COMPETITIONS

country_id Country ID - if set only leagues from specific country will be returned (Optional)

action=get_league



23
24
25
# File 'lib/football/butler/apifootball/competitions.rb', line 23

def all(result:, filters:)
  Api.get(path: build_path(PATH), result: result, filters: filters)
end

.by_country(id:, result:) ⇒ Object

COMPETITION action=get_leagues&country_id=id



13
14
15
16
# File 'lib/football/butler/apifootball/competitions.rb', line 13

def by_country(id:, result:)
  filters = { country_id: id }
  Api.get(path: build_path(PATH), filters: filters, result: result)
end