Class: ApiBlocks::Interactor
- Inherits:
-
Object
- Object
- ApiBlocks::Interactor
- Includes:
- Dry::Transaction
- Defined in:
- lib/api_blocks/interactor.rb
Overview
ApiBlocks::Interactor implements a base interactor class.
It is based on ‘Dry::Transaction` and implements input schema parsing and validation as well as database transaction handling.
Class Attribute Summary collapse
-
.input_schema ⇒ Object
Returns the value of attribute input_schema.
Class Method Summary collapse
-
.call(*args) ⇒ Object
Call the interactor with its arguments.
-
.input(&block) ⇒ Object
Define a contract for the input of this interactor using ‘dry-validation`.
-
.with_step_args(*args) ⇒ Object
Call the interactor with additional step arguments.
Class Attribute Details
.input_schema ⇒ Object
Returns the value of attribute input_schema.
43 44 45 |
# File 'lib/api_blocks/interactor.rb', line 43 def input_schema @input_schema end |
Class Method Details
.call(*args) ⇒ Object
Call the interactor with its arguments.
75 76 77 |
# File 'lib/api_blocks/interactor.rb', line 75 def self.call(*args) new.call(*args) end |
.input(&block) ⇒ Object
Define a contract for the input of this interactor using ‘dry-validation`
61 62 63 |
# File 'lib/api_blocks/interactor.rb', line 61 def self.input(&block) @input_schema = Class.new(Dry::Validation::Contract, &block).new end |
.with_step_args(*args) ⇒ Object
Call the interactor with additional step arguments.
85 86 87 |
# File 'lib/api_blocks/interactor.rb', line 85 def self.with_step_args(*args) new.with_step_args(*args) end |