Class: Sorare::Rewards::Cards::PickForDivision

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

Overview

PickForDivision picks the rewards for a given league And a division reward allocations

{
  'rare' => [5, 15, 0, 0],
  'super_rare' => [1, 4, 0, 0],
  'unique' => [0, 0, 1, 0]
}

Instance Method Summary collapse

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
# File 'lib/sorare/rewards/interactors/cards/pick_for_division.rb', line 24

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