Class: Football::Butler::ApiFootball::Fixtures

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

Constant Summary collapse

PATH =
:fixtures

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

FIXTURES

id integer The id of the fixture

live string Enum: “all” “id-id” date stringYYYY-MM-DD A valid date

league integer The id of the league

season integer 4 characters YYYY The season of the league

team integer The id of the team

last integer <= 2 characters For the X last fixtures

next integer <= 2 characters For the X next fixtures

from stringYYYY-MM-DD A valid date

to stringYYYY-MM-DD A valid date

round string The round of the fixture

status string The status short of the fixture

timezone string A valid timezone from the endpoint Timezone

/fixtures?league=id&season=year



72
73
74
75
# File 'lib/football/butler/api_football/fixtures.rb', line 72

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

.by_id(id:) ⇒ Object

FIXTURE /fixtures?id=id



13
14
15
16
# File 'lib/football/butler/api_football/fixtures.rb', line 13

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