8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/providers/jumbotron/providers/espn/resources/competition_odds.rb', line 8
def self.acquire(sport:, league:, event_id:, competition_id:)
cooldown = Cooldown.new
return CommandTower::Clients::ClientResult.failure(error: CooldownActiveError.new) if cooldown.cooling_down?
result = Jumbotron::Clients.espn.competition_odds.get(
sport: sport,
league: league,
event_id: event_id,
competition_id: competition_id
)
if result.success?
cooldown.record_success!
else
cooldown.record_failure!(result.error)
end
result
end
|