Class: Retab::StoredBlockExecution

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_block_executions/stored_block_execution.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  workflow_id: :workflow_id,
  run_id: :run_id,
  block_id: :block_id,
  block_type: :block_type,
  lifecycle: :lifecycle,
  handle_inputs: :handle_inputs,
  artifact: :artifact,
  handle_outputs: :handle_outputs,
  routing_decision: :routing_decision,
  duration_ms: :duration_ms,
  created_at: :created_at,
  block_config: :block_config,
  step_id: :step_id,
  available_iterations: :available_iterations
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ StoredBlockExecution

Returns a new instance of StoredBlockExecution.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 43

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @workflow_id = hash[:workflow_id]
  @run_id = hash[:run_id]
  @block_id = hash[:block_id]
  @block_type = hash[:block_type]
  @lifecycle = hash[:lifecycle] ? (case hash[:lifecycle][:status] when "completed" then Retab::CompletedBlockExecutionLifecycle.new(hash[:lifecycle]) when "error" then Retab::ErrorBlockExecutionLifecycle.new(hash[:lifecycle]) when "skipped" then Retab::SkippedBlockExecutionLifecycle.new(hash[:lifecycle]) else hash[:lifecycle] end) : nil
  @handle_inputs = hash[:handle_inputs] || {}
  @artifact = hash[:artifact] ? Retab::StepArtifactRef.new(hash[:artifact]) : nil
  @handle_outputs = hash[:handle_outputs] || {}
  @routing_decision = (hash[:routing_decision] || [])
  @duration_ms = hash[:duration_ms]
  @created_at = hash[:created_at]
  @block_config = hash[:block_config] || {}
  @step_id = hash[:step_id]
  @available_iterations = (hash[:available_iterations] || []).map { |item| item || {} }
end

Instance Attribute Details

#artifactObject

Returns the value of attribute artifact.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def artifact
  @artifact
end

#available_iterationsObject

Returns the value of attribute available_iterations.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def available_iterations
  @available_iterations
end

#block_configObject

Returns the value of attribute block_config.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def block_config
  @block_config
end

#block_idObject

Returns the value of attribute block_id.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def block_id
  @block_id
end

#block_typeObject

Returns the value of attribute block_type.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def block_type
  @block_type
end

#created_atObject

Returns the value of attribute created_at.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def created_at
  @created_at
end

#duration_msObject

Returns the value of attribute duration_ms.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def duration_ms
  @duration_ms
end

#handle_inputsObject

Returns the value of attribute handle_inputs.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def handle_inputs
  @handle_inputs
end

#handle_outputsObject

Returns the value of attribute handle_outputs.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def handle_outputs
  @handle_outputs
end

#idObject

Returns the value of attribute id.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def id
  @id
end

#lifecycleObject

Returns the value of attribute lifecycle.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def lifecycle
  @lifecycle
end

#routing_decisionObject

Returns the value of attribute routing_decision.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def routing_decision
  @routing_decision
end

#run_idObject

Returns the value of attribute run_id.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def run_id
  @run_id
end

#step_idObject

Returns the value of attribute step_id.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def step_id
  @step_id
end

#workflow_idObject

Returns the value of attribute workflow_id.



26
27
28
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 26

def workflow_id
  @workflow_id
end