Class: Sorare::Rewards::GameWeekRewards
- Inherits:
-
Object
- Object
- Sorare::Rewards::GameWeekRewards
- Defined in:
- lib/sorare/rewards/game_week_rewards.rb
Overview
GameWeekRewards stores rewards related data for a specified GameWeek, salt, And a card allocations hash
{
'global-all_star' => {
'D1' => {
'rare' => { 'tier_0' => 0, 'tier_1' => 1 }
}
}
}
Constant Summary collapse
- MISSING_PARAMETER =
'%s parameter required'
Instance Attribute Summary collapse
-
#card_allocations ⇒ Object
readonly
Returns the value of attribute card_allocations.
-
#cooldown_limit ⇒ Object
readonly
Returns the value of attribute cooldown_limit.
-
#game_week ⇒ Object
readonly
Returns the value of attribute game_week.
-
#rarity_limit ⇒ Object
readonly
Returns the value of attribute rarity_limit.
-
#salt ⇒ Object
readonly
Returns the value of attribute salt.
Instance Method Summary collapse
- #cards ⇒ Object
- #computed_card_allocations ⇒ Object
-
#initialize(game_week:, salt: nil, card_allocations: nil, rarity_limit: true, cooldown_limit: true) ⇒ GameWeekRewards
constructor
A new instance of GameWeekRewards.
- #prize_pools ⇒ Object
- #reward_allocations ⇒ Object
Constructor Details
#initialize(game_week:, salt: nil, card_allocations: nil, rarity_limit: true, cooldown_limit: true) ⇒ GameWeekRewards
Returns a new instance of GameWeekRewards.
19 20 21 22 23 24 25 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 19 def initialize(game_week:, salt: nil, card_allocations: nil, rarity_limit: true, cooldown_limit: true) @game_week = game_week @salt = salt || game_week.salt @card_allocations = card_allocations || computed_card_allocations @rarity_limit = rarity_limit @cooldown_limit = cooldown_limit end |
Instance Attribute Details
#card_allocations ⇒ Object (readonly)
Returns the value of attribute card_allocations.
15 16 17 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 15 def card_allocations @card_allocations end |
#cooldown_limit ⇒ Object (readonly)
Returns the value of attribute cooldown_limit.
15 16 17 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 15 def cooldown_limit @cooldown_limit end |
#game_week ⇒ Object (readonly)
Returns the value of attribute game_week.
15 16 17 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 15 def game_week @game_week end |
#rarity_limit ⇒ Object (readonly)
Returns the value of attribute rarity_limit.
15 16 17 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 15 def rarity_limit @rarity_limit end |
#salt ⇒ Object (readonly)
Returns the value of attribute salt.
15 16 17 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 15 def salt @salt end |
Instance Method Details
#cards ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 27 def cards @cards ||= Sorare::Rewards::Pick.call!( salt: salt, game_week: game_week, card_allocations: card_allocations, rarity_limit: rarity_limit, cooldown_limit: cooldown_limit ).cards_picked end |
#computed_card_allocations ⇒ Object
47 48 49 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 47 def computed_card_allocations Transposer.transpose_allocations(reward_allocations.card_allocations) end |
#prize_pools ⇒ Object
37 38 39 |
# File 'lib/sorare/rewards/game_week_rewards.rb', line 37 def prize_pools @prize_pools ||= reward_allocations.prize_pools end |