Class: Yes::Core::Command
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Yes::Core::Command
- Defined in:
- lib/yes/core/command.rb
Overview
Base command class for all commands in the system. Inherits from Dry::Struct for type-safe attribute definitions.
Defined Under Namespace
Classes: Invalid
Constant Summary collapse
- RESERVED_KEYS =
%i[transaction origin batch_id command_id metadata es_encrypted].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#payload ⇒ Hash
Returns the command payload excluding reserved keys.
Class Method Details
.new(attributes) ⇒ Object
21 22 23 24 25 |
# File 'lib/yes/core/command.rb', line 21 def self.new(attributes) super rescue Dry::Struct::Error => e raise Invalid.new(extra: attributes), e end |
Instance Method Details
#payload ⇒ Hash
Returns the command payload excluding reserved keys.
30 31 32 |
# File 'lib/yes/core/command.rb', line 30 def payload to_h.except(*RESERVED_KEYS) end |