Class: Smith::Workflow::Composite::Input
- Inherits:
-
Payload
- Object
- Dry::Struct
- Payload
- Smith::Workflow::Composite::Input
- Defined in:
- lib/smith/workflow/composite/input.rb
Constant Summary
Constants inherited from Payload
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(attributes) ⇒ Input
Returns a new instance of Input.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/smith/workflow/composite/input.rb', line 25 def initialize(attributes) owned = self.class.normalize_attributes(attributes) values = self.class.send( :normalized_values, agent_messages: owned[:agent_messages], session_messages: owned[:session_messages] ) super(values.merge(digest: owned[:digest])) raise ArgumentError, "composite input digest does not match" unless digest == PayloadDigest.call(values) end |
Class Method Details
.build(agent_messages:, session_messages:) ⇒ Object
20 21 22 23 |
# File 'lib/smith/workflow/composite/input.rb', line 20 def self.build(agent_messages:, session_messages:) values = normalized_values(agent_messages:, session_messages:) new(values.merge(digest: PayloadDigest.call(values))) end |