Class: Football::Butler::FootballData::Standings

Inherits:
Base
  • Object
show all
Defined in:
lib/football/butler/football_data/standings.rb

Constant Summary collapse

PATH =
:standings
STANDING_TYPE_HOME =
'HOME'
STANDING_TYPE_AWAY =
'AWAY'

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

.away_by_competition(id:, result:, filters:) ⇒ Object

v2/competitions/id/standings?standingType=AWAY



32
33
34
35
# File 'lib/football/butler/football_data/standings.rb', line 32

def away_by_competition(id:, result:, filters:)
  filters.merge!({ standingType: STANDING_TYPE_AWAY })
  by_competition(id: id, filters: filters, result: result)
end

.by_competition(id:, result:, filters:) ⇒ Object



20
21
22
23
# File 'lib/football/butler/football_data/standings.rb', line 20

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

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

v2/competitions/id/standings



38
39
40
41
42
# File 'lib/football/butler/football_data/standings.rb', line 38

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

.home_by_competition(id:, result:, filters:) ⇒ Object

v2/competitions/id/standings?standingType=HOME



26
27
28
29
# File 'lib/football/butler/football_data/standings.rb', line 26

def home_by_competition(id:, result:, filters:)
  filters.merge!({ standingType: STANDING_TYPE_HOME })
  by_competition(id: id, filters: filters, result: result)
end