class Sorare::Rewards::Cards::PickForDivisionAndRarity
PickForDivisionAndRarity
picks the rewards for a given division and rarity Receive a list of pickers for each tiers
{ 'tier_0' => Picker, 'tier_1' => Picker }
A game week data And a reward allocations
{ 'tier_0' => 1, 'tier_1' => 2 }
Public Instance Methods
call()
click to toggle source
# File lib/sorare/rewards/interactors/cards/pick_for_division_and_rarity.rb, line 22 def call context.cards_picked = supply! end
supply!()
click to toggle source
# File lib/sorare/rewards/interactors/cards/pick_for_division_and_rarity.rb, line 26 def supply! allocations.keys.index_with do |tier| next [] if pickers&.dig(tier).nil? PickForDivisionRarityAndQuality.call!(**context.to_h, allocations: allocations[tier], picker: pickers[tier]).cards_picked end end