class Football::Butler::FootballData::Lineups

Constants

PATH

Public Class Methods

by_match(id:) click to toggle source
LINEUPS

v2/matches/{id}

# File lib/football/butler/football_data/lineups.rb, line 13
def by_match(id:)
  path  = "#{PATH}/#{id}"
  match = Api.get(path: path, result: :match)

  if match.is_a?(Hash) && match.with_indifferent_access.dig(:homeTeam) &&
    match.with_indifferent_access.dig(:awayTeam)

    lineups = {}
    lineups['homeTeam'] = match['homeTeam']
    lineups['awayTeam'] = match['awayTeam']
    lineups
  else
    match
  end
end