Class: Football::Butler::FootballData::Teams

Inherits:
Base
  • Object
show all
Defined in:
lib/football/butler/football_data/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(id:, result:, filters:) ⇒ Object

TEAMS

season=YEAR stage=STAGE

v2/competitions/id/teams



24
25
26
27
# File 'lib/football/butler/football_data/teams.rb', line 24

def by_competition(id:, result:, filters:)
  path = "#{Competitions::PATH}/#{id}/#{PATH}"
  Api.get(path: path, result: result, filters: filters)
end

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

v2/competitions/id/teams?year=year



30
31
32
33
34
# File 'lib/football/butler/football_data/teams.rb', line 30

def by_competition_and_year(id:, year:, result:, filters:)
  path = "#{Competitions::PATH}/#{id}/#{PATH}"
  filters.merge!({ year: year })
  Api.get(path: path, result: result, filters: filters)
end

.by_id(id:) ⇒ Object

TEAM v2/teams/id returns team object directly as a hash



13
14
15
16
# File 'lib/football/butler/football_data/teams.rb', line 13

def by_id(id:)
  path = "#{PATH}/#{id}"
  Api.get(path: path)
end