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