Class: AuctionFunCore::Operations::AuctionContext::Processor::UnpauseOperation
- Inherits:
-
Base
- Object
- Base
- AuctionFunCore::Operations::AuctionContext::Processor::UnpauseOperation
- Defined in:
- lib/auction_fun_core/operations/auction_context/processor/unpause_operation.rb
Overview
Operation class for dispatch unpause auction. By default, this change auction status from ‘paused’ to ‘running’.
Class Method Summary collapse
-
.call(attributes) {|Dry::Matcher::Evaluator| ... } ⇒ Dry::Matcher::Evaluator
Executes the unpause operation with the provided attributes.
Instance Method Summary collapse
-
#call(attributes) ⇒ Dry::Monads::Result::Success, Dry::Monads::Result::Failure
Performs the unpause of an auction.
Class Method Details
.call(attributes) {|Dry::Matcher::Evaluator| ... } ⇒ Dry::Matcher::Evaluator
Executes the unpause operation with the provided attributes.
30 31 32 33 34 35 36 |
# File 'lib/auction_fun_core/operations/auction_context/processor/unpause_operation.rb', line 30 def self.call(attributes, &block) operation = new.call(attributes) return operation unless block Dry::Matcher::ResultMatcher.call(operation, &block) end |
Instance Method Details
#call(attributes) ⇒ Dry::Monads::Result::Success, Dry::Monads::Result::Failure
Performs the unpause of an auction.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/auction_fun_core/operations/auction_context/processor/unpause_operation.rb', line 59 def call(attributes) attrs = yield validate(attributes) auction_repository.transaction do |_t| @auction, _ = auction_repository.update(attrs[:auction_id], status: "running") publish_auction_unpause_event(@auction) end Success(attrs[:auction_id]) end |