Class: Smith::Workflow::PreparedStepDispatch

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/smith/workflow/prepared_step_dispatch.rb

Constant Summary collapse

ATTRIBUTES =
%i[prepared_step token dispatch_digest].freeze
MAX_ATTRIBUTE_ENTRIES =
8
MAX_SERIALIZED_BYTES =
8 * 1024

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ PreparedStepDispatch

Returns a new instance of PreparedStepDispatch.



81
82
83
84
85
# File 'lib/smith/workflow/prepared_step_dispatch.rb', line 81

def initialize(attributes)
  super
  self.attributes.freeze
  freeze
end

Class Method Details

.deserialize(value) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/smith/workflow/prepared_step_dispatch.rb', line 24

def self.deserialize(value)
  attributes = parse_attributes(value)
  normalized = normalize_attributes(attributes)
  validate_attributes!(normalized)
  normalized[:prepared_step] = PreparedStep.deserialize(normalized[:prepared_step])
  new(normalized)
rescue JSON::ParserError, TypeError => e
  raise ArgumentError, "prepared-step dispatch is invalid: #{e.message}"
end