Class: Sequent::Core::Command

Inherits:
BaseCommand show all
Defined in:
lib/sequent/core/command.rb

Overview

Most commonly used Command Command can be instantiated just by using:

Command.new(aggregate_id: "1", user_id: "joe")

But the Sequent::Core::Helpers::ParamSupport also enables Commands to be created from a params hash (like the one from Sinatra) as follows:

command = Command.from_params(params)

Direct Known Subclasses

TakeSnapshot, UpdateCommand

Instance Method Summary collapse

Methods inherited from BaseCommand

inherited

Methods included from Helpers::TypeConversionSupport

#parse_attrs_to_correct_types

Methods included from Helpers::Copyable

#copy

Methods included from Helpers::AttributeSupport

#as_json, #attributes, #ensure_known_attributes, included, #update, #validation_errors

Methods included from Helpers::UuidHelper

new_uuid

Methods included from Helpers::EqualSupport

#==, #eql?, #hash

Methods included from Helpers::ParamSupport

#as_params, #from_params, included, #to_params

Methods included from Helpers::Mergable

#merge!

Constructor Details

#initialize(args = {}) ⇒ Command

Returns a new instance of Command.



94
95
96
97
98
# File 'lib/sequent/core/command.rb', line 94

def initialize(args = {})
  fail ArgumentError, 'Missing aggregate_id' if args[:aggregate_id].nil?

  super
end