Class: Football::Butler::FootballData::HeadToHead

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

Constant Summary collapse

PATH =
:matches

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_match(id:) ⇒ Object

HEAD TO HEAD

v2/matches/id



13
14
15
16
17
18
19
20
21
22
# File 'lib/football/butler/football_data/head_to_head.rb', line 13

def by_match(id:)
  path  = "#{PATH}/#{id}"
  match = Api.get(path: path, result: :parsed_response)

  if match.is_a?(Hash) && match.with_indifferent_access.dig(:head2head)
    match['head2head']
  else
    match
  end
end