Class: Munificent::KeyAssignment::KeyManager
- Inherits:
-
Object
- Object
- Munificent::KeyAssignment::KeyManager
- Defined in:
- app/services/munificent/key_assignment/key_manager.rb
Instance Method Summary collapse
- #key_assigned?(game, donator_bundle_tier:) ⇒ Boolean
- #lock_unassigned_key(game, fundraiser: nil) ⇒ Object
Instance Method Details
#key_assigned?(game, donator_bundle_tier:) ⇒ Boolean
4 5 6 |
# File 'app/services/munificent/key_assignment/key_manager.rb', line 4 def key_assigned?(game, donator_bundle_tier:) donator_bundle_tier.assigned_games.include?(game) end |
#lock_unassigned_key(game, fundraiser: nil) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/services/munificent/key_assignment/key_manager.rb', line 8 def lock_unassigned_key(game, fundraiser: nil) # https://api.rubyonrails.org/v6.1.0/classes/ActiveRecord/Locking/Pessimistic.html # https://www.postgresql.org/docs/9.5/sql-select.html#SQL-FOR-UPDATE-SHARE Munificent::Key.transaction do yield unassigned_key(game, fundraiser:) end end |