Class: Retab::WorkflowRunStep

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_steps/workflow_run_step.rb

Constant Summary collapse

HASH_ATTRS =
{
  block_id: :block_id,
  step_id: :step_id,
  block_type: :block_type,
  block_label: :block_label,
  lifecycle: :lifecycle,
  started_at: :started_at,
  completed_at: :completed_at,
  model: :model,
  loop_containers: :loop_containers,
  run_id: :run_id,
  created_at: :created_at,
  handle_inputs: :handle_inputs,
  handle_outputs: :handle_outputs,
  artifact: :artifact,
  retry_count: :retry_count
}.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) ⇒ WorkflowRunStep

Returns a new instance of WorkflowRunStep.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 44

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @block_id = hash[:block_id]
  @step_id = hash[:step_id]
  @block_type = hash[:block_type]
  @block_label = hash[:block_label]
  @lifecycle = hash[:lifecycle] ? (
    case hash[:lifecycle][:status]
    when "awaiting_review"
      Retab::AwaitingReviewStepLifecycle.new(hash[:lifecycle])
    when "cancelled"
      Retab::CancelledStepLifecycle.new(hash[:lifecycle])
    when "completed"
      Retab::CompletedStepLifecycle.new(hash[:lifecycle])
    when "error"
      Retab::ErrorStepLifecycle.new(hash[:lifecycle])
    when "pending"
      Retab::PendingStepLifecycle.new(hash[:lifecycle])
    when "queued"
      Retab::QueuedStepLifecycle.new(hash[:lifecycle])
    when "running"
      Retab::RunningStepLifecycle.new(hash[:lifecycle])
    when "skipped"
      Retab::SkippedStepLifecycle.new(hash[:lifecycle])
    else
      hash[:lifecycle]
    end
  ) : nil
  @started_at = hash[:started_at]
  @completed_at = hash[:completed_at]
  @model = hash[:model]
  @loop_containers = (hash[:loop_containers] || []).map { |item|
    item ? Retab::ContainerContextData.new(item) : nil
  }
  @run_id = hash[:run_id]
  @created_at = hash[:created_at]
  @handle_inputs = hash[:handle_inputs] || {}
  @handle_outputs = hash[:handle_outputs] || {}
  @artifact = hash[:artifact] ? Retab::StepArtifactRef.new(hash[:artifact]) : nil
  @retry_count = hash[:retry_count]
end

Instance Attribute Details

#artifactObject

Returns the value of attribute artifact.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def artifact
  @artifact
end

#block_idObject

Returns the value of attribute block_id.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def block_id
  @block_id
end

#block_labelObject

Returns the value of attribute block_label.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def block_label
  @block_label
end

#block_typeObject

Returns the value of attribute block_type.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def block_type
  @block_type
end

#completed_atObject

Returns the value of attribute completed_at.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def completed_at
  @completed_at
end

#created_atObject

Returns the value of attribute created_at.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def created_at
  @created_at
end

#handle_inputsObject

Returns the value of attribute handle_inputs.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.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_steps/workflow_run_step.rb', line 26

def handle_outputs
  @handle_outputs
end

#lifecycleObject

Returns the value of attribute lifecycle.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def lifecycle
  @lifecycle
end

#loop_containersObject

Returns the value of attribute loop_containers.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def loop_containers
  @loop_containers
end

#modelObject

Returns the value of attribute model.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def model
  @model
end

#retry_countObject

Returns the value of attribute retry_count.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def retry_count
  @retry_count
end

#run_idObject

Returns the value of attribute run_id.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def run_id
  @run_id
end

#started_atObject

Returns the value of attribute started_at.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def started_at
  @started_at
end

#step_idObject

Returns the value of attribute step_id.



26
27
28
# File 'lib/retab/workflow_steps/workflow_run_step.rb', line 26

def step_id
  @step_id
end