Class: Football::Butler::FootballData::Odds

Inherits:
Base
  • Object
show all
Defined in:
lib/football/butler/football_data/odds.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:, from:, to:, result:) ⇒ Object

ODDS

v2/matches/id



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

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

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