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,
  workflow_version_id: :workflow_version_id,
  source_run_id: :source_run_id,
  block_id: :block_id,
  block_type: :block_type,
  lifecycle: :lifecycle,
  handle_inputs: :handle_inputs,
  artifact: :artifact,
  handle_outputs: :handle_outputs,
  routing_decisions: :routing_decisions,
  duration_ms: :duration_ms,
  created_at: :created_at,
  started_at: :started_at,
  completed_at: :completed_at,
  handle_inputs_fingerprint: :handle_inputs_fingerprint,
  workflow_draft_fingerprint: :workflow_draft_fingerprint,
  block_config_fingerprint: :block_config_fingerprint,
  execution_fingerprint: :execution_fingerprint,
  block_config: :block_config,
  source_step_id: :source_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

deep_symbolize, #inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ StoredBlockExecution

Returns a new instance of StoredBlockExecution.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 58

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @id = hash[:id]
  @workflow_id = hash[:workflow_id]
  @workflow_version_id = hash[:workflow_version_id]
  @source_run_id = hash[:source_run_id]
  @block_id = hash[:block_id]
  @block_type = hash[:block_type]
  @lifecycle = hash[:lifecycle] ? (
    case hash[:lifecycle][:status]
    when "cancelled"
      Retab::CancelledBlockExecutionLifecycle.new(hash[:lifecycle])
    when "completed"
      Retab::CompletedBlockExecutionLifecycle.new(hash[:lifecycle])
    when "error"
      Retab::ErrorBlockExecutionLifecycle.new(hash[:lifecycle])
    when "pending"
      Retab::PendingBlockExecutionLifecycle.new(hash[:lifecycle])
    when "queued"
      Retab::QueuedBlockExecutionLifecycle.new(hash[:lifecycle])
    when "running"
      Retab::RunningBlockExecutionLifecycle.new(hash[:lifecycle])
    when "skipped"
      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_decisions = (hash[:routing_decisions] || [])
  @duration_ms = hash[:duration_ms]
  @created_at = hash[:created_at]
  @started_at = hash[:started_at]
  @completed_at = hash[:completed_at]
  @handle_inputs_fingerprint = hash[:handle_inputs_fingerprint]
  @workflow_draft_fingerprint = hash[:workflow_draft_fingerprint]
  @block_config_fingerprint = hash[:block_config_fingerprint]
  @execution_fingerprint = hash[:execution_fingerprint]
  @block_config = hash[:block_config] || {}
  @source_step_id = hash[:source_step_id]
  @available_iterations = (hash[:available_iterations] || []).map { |item| item || {} }
end

Instance Attribute Details

#artifactObject

Returns the value of attribute artifact.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def artifact
  @artifact
end

#available_iterationsObject

Returns the value of attribute available_iterations.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def available_iterations
  @available_iterations
end

#block_configObject

Returns the value of attribute block_config.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def block_config
  @block_config
end

#block_config_fingerprintObject

Returns the value of attribute block_config_fingerprint.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def block_config_fingerprint
  @block_config_fingerprint
end

#block_idObject

Returns the value of attribute block_id.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def block_id
  @block_id
end

#block_typeObject

Returns the value of attribute block_type.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def block_type
  @block_type
end

#completed_atObject

Returns the value of attribute completed_at.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def completed_at
  @completed_at
end

#created_atObject

Returns the value of attribute created_at.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def created_at
  @created_at
end

#duration_msObject

Returns the value of attribute duration_ms.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def duration_ms
  @duration_ms
end

#execution_fingerprintObject

Returns the value of attribute execution_fingerprint.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def execution_fingerprint
  @execution_fingerprint
end

#handle_inputsObject

Returns the value of attribute handle_inputs.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def handle_inputs
  @handle_inputs
end

#handle_inputs_fingerprintObject

Returns the value of attribute handle_inputs_fingerprint.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def handle_inputs_fingerprint
  @handle_inputs_fingerprint
end

#handle_outputsObject

Returns the value of attribute handle_outputs.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def handle_outputs
  @handle_outputs
end

#idObject

Returns the value of attribute id.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def id
  @id
end

#lifecycleObject

Returns the value of attribute lifecycle.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def lifecycle
  @lifecycle
end

#routing_decisionsObject

Returns the value of attribute routing_decisions.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def routing_decisions
  @routing_decisions
end

#source_run_idObject

Returns the value of attribute source_run_id.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def source_run_id
  @source_run_id
end

#source_step_idObject

Returns the value of attribute source_step_id.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def source_step_id
  @source_step_id
end

#started_atObject

Returns the value of attribute started_at.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def started_at
  @started_at
end

#workflow_draft_fingerprintObject

Returns the value of attribute workflow_draft_fingerprint.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def workflow_draft_fingerprint
  @workflow_draft_fingerprint
end

#workflow_idObject

Returns the value of attribute workflow_id.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def workflow_id
  @workflow_id
end

#workflow_version_idObject

Returns the value of attribute workflow_version_id.



33
34
35
# File 'lib/retab/workflow_block_executions/stored_block_execution.rb', line 33

def workflow_version_id
  @workflow_version_id
end