Class: Retab::WorkflowTestResult

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_test_run_results/workflow_test_result.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  run_id: :run_id,
  test_id: :test_id,
  lifecycle: :lifecycle,
  timing: :timing,
  verdict: :verdict,
  workflow_id: :workflow_id,
  target: :target,
  execution_fingerprint: :execution_fingerprint,
  handle_inputs_fingerprint: :handle_inputs_fingerprint,
  workflow_draft_fingerprint: :workflow_draft_fingerprint,
  block_config_fingerprint: :block_config_fingerprint,
  source: :source,
  outputs: :outputs,
  routing_decision: :routing_decision,
  warnings: :warnings,
  error: :error,
  skipped: :skipped,
  assertion_result: :assertion_result,
  verdict_summary: :verdict_summary
}.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) ⇒ WorkflowTestResult

Returns a new instance of WorkflowTestResult.



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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 54

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @id = hash[:id]
  @run_id = hash[:run_id]
  @test_id = hash[:test_id]
  @lifecycle = hash[:lifecycle] ? (
    case hash[:lifecycle][:status]
    when "cancelled"
      Retab::CancelledWorkflowTestRun.new(hash[:lifecycle])
    when "completed"
      Retab::CompletedWorkflowTestRun.new(hash[:lifecycle])
    when "error"
      Retab::ErrorWorkflowTestRun.new(hash[:lifecycle])
    when "pending"
      Retab::PendingWorkflowTestRun.new(hash[:lifecycle])
    when "queued"
      Retab::QueuedWorkflowTestRun.new(hash[:lifecycle])
    when "running"
      Retab::RunningWorkflowTestRun.new(hash[:lifecycle])
    else
      hash[:lifecycle]
    end
  ) : nil
  @timing = hash[:timing] ? Retab::WorkflowTestRunTiming.new(hash[:timing]) : nil
  @verdict = hash[:verdict]
  @workflow_id = hash[:workflow_id]
  @target = hash[:target] ? Retab::WorkflowTestBlockTarget.new(hash[:target]) : nil
  @execution_fingerprint = hash[:execution_fingerprint]
  @handle_inputs_fingerprint = hash[:handle_inputs_fingerprint]
  @workflow_draft_fingerprint = hash[:workflow_draft_fingerprint]
  @block_config_fingerprint = hash[:block_config_fingerprint]
  @source = hash[:source] ? (
    case hash[:source][:type]
    when "manual"
      Retab::ManualWorkflowTestSource.new(hash[:source])
    when "run_step"
      Retab::RunStepWorkflowTestSource.new(hash[:source])
    else
      hash[:source]
    end
  ) : nil
  @outputs = hash[:outputs] || {}
  @routing_decision = (hash[:routing_decision] || [])
  @warnings = (hash[:warnings] || [])
  @error = hash[:error] ? Retab::ErrorDetails.new(hash[:error]) : nil
  @skipped = hash[:skipped]
  @assertion_result = hash[:assertion_result] ? Retab::AssertionResult.new(hash[:assertion_result]) : nil
  @verdict_summary = hash[:verdict_summary] ? Retab::VerdictSummary.new(hash[:verdict_summary]) : nil
end

Instance Attribute Details

#assertion_resultObject

Returns the value of attribute assertion_result.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def assertion_result
  @assertion_result
end

#block_config_fingerprintObject

Returns the value of attribute block_config_fingerprint.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def block_config_fingerprint
  @block_config_fingerprint
end

#errorObject

Returns the value of attribute error.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def error
  @error
end

#execution_fingerprintObject

Returns the value of attribute execution_fingerprint.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def execution_fingerprint
  @execution_fingerprint
end

#handle_inputs_fingerprintObject

Returns the value of attribute handle_inputs_fingerprint.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def handle_inputs_fingerprint
  @handle_inputs_fingerprint
end

#idObject

Returns the value of attribute id.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def id
  @id
end

#lifecycleObject

Returns the value of attribute lifecycle.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def lifecycle
  @lifecycle
end

#outputsObject

Returns the value of attribute outputs.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def outputs
  @outputs
end

#routing_decisionObject

Returns the value of attribute routing_decision.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def routing_decision
  @routing_decision
end

#run_idObject

Returns the value of attribute run_id.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def run_id
  @run_id
end

#skippedObject

Returns the value of attribute skipped.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def skipped
  @skipped
end

#sourceObject

Returns the value of attribute source.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def source
  @source
end

#targetObject

Returns the value of attribute target.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def target
  @target
end

#test_idObject

Returns the value of attribute test_id.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def test_id
  @test_id
end

#timingObject

Returns the value of attribute timing.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def timing
  @timing
end

#verdictObject

Returns the value of attribute verdict.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def verdict
  @verdict
end

#verdict_summaryObject

Returns the value of attribute verdict_summary.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def verdict_summary
  @verdict_summary
end

#warningsObject

Returns the value of attribute warnings.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def warnings
  @warnings
end

#workflow_draft_fingerprintObject

Returns the value of attribute workflow_draft_fingerprint.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def workflow_draft_fingerprint
  @workflow_draft_fingerprint
end

#workflow_idObject

Returns the value of attribute workflow_id.



31
32
33
# File 'lib/retab/workflow_test_run_results/workflow_test_result.rb', line 31

def workflow_id
  @workflow_id
end