Class: Sorare::Rewards::Cards::PickForLeague

Inherits:
Object
  • Object
show all
Includes:
Interactor, WithPickerOptions
Defined in:
lib/sorare/rewards/interactors/cards/pick_for_league.rb

Overview

PickForLeague picks the rewards for a given league Receive a game week object And a league allocations

{
  'D1' => {
    'rare' => { 'tier_0' => 1, 'tier_1' => 2 }
  }
}

Instance Method Summary collapse

Instance Method Details

#callObject



27
28
29
30
31
32
33
# File 'lib/sorare/rewards/interactors/cards/pick_for_league.rb', line 27

def call
  context.cards_picked = allocations.keys.index_with do |division|
    PickForDivision.call!(
      **context.to_h, allocations: allocations[division]
    ).cards_picked
  end
end