Class: Retab::WorkflowTestRun
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::WorkflowTestRun
- Defined in:
- lib/retab/workflow_test_runs/workflow_test_run.rb
Constant Summary collapse
- HASH_ATTRS =
{ id: :id, workflow: :workflow, trigger: :trigger, lifecycle: :lifecycle, timing: :timing, target: :target, test_id: :test_id, total_tests: :total_tests, counts: :counts }.freeze
Instance Attribute Summary collapse
-
#counts ⇒ Object
Returns the value of attribute counts.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
-
#target ⇒ Object
Returns the value of attribute target.
-
#test_id ⇒ Object
Returns the value of attribute test_id.
-
#timing ⇒ Object
Returns the value of attribute timing.
-
#total_tests ⇒ Object
Returns the value of attribute total_tests.
-
#trigger ⇒ Object
Returns the value of attribute trigger.
-
#workflow ⇒ Object
Returns the value of attribute workflow.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ WorkflowTestRun
constructor
A new instance of WorkflowTestRun.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ WorkflowTestRun
Returns a new instance of WorkflowTestRun.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 31 def initialize(json) hash = self.class.normalize(json) @id = hash[:id] @workflow = hash[:workflow] ? Retab::WorkflowSnapshotRef.new(hash[:workflow]) : nil @trigger = hash[:trigger] ? (case hash[:trigger][:type] when "api" then Retab::ApiTrigger.new(hash[:trigger]) when "email" then Retab::EmailTrigger.new(hash[:trigger]) when "manual" then Retab::ManualTrigger.new(hash[:trigger]) when "restart" then Retab::RestartTrigger.new(hash[:trigger]) when "schedule" then Retab::ScheduleTrigger.new(hash[:trigger]) when "webhook" then Retab::WebhookTrigger.new(hash[:trigger]) else hash[:trigger] end) : nil @lifecycle = hash[:lifecycle] ? (case hash[:lifecycle][:status] when "cancelled" then Retab::CancelledWorkflowTestRun.new(hash[:lifecycle]) when "completed" then Retab::CompletedWorkflowTestRun.new(hash[:lifecycle]) when "error" then Retab::ErrorWorkflowTestRun.new(hash[:lifecycle]) when "pending" then Retab::PendingWorkflowTestRun.new(hash[:lifecycle]) when "queued" then Retab::QueuedWorkflowTestRun.new(hash[:lifecycle]) when "running" then Retab::RunningWorkflowTestRun.new(hash[:lifecycle]) else hash[:lifecycle] end) : nil @timing = hash[:timing] ? Retab::WorkflowTestRunTiming.new(hash[:timing]) : nil @target = hash[:target] ? Retab::WorkflowTestBlockTarget.new(hash[:target]) : nil @test_id = hash[:test_id] @total_tests = hash[:total_tests] @counts = hash[:counts] ? Retab::BlockTestBatchExecutionCounts.new(hash[:counts]) : nil end |
Instance Attribute Details
#counts ⇒ Object
Returns the value of attribute counts.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def counts @counts end |
#id ⇒ Object
Returns the value of attribute id.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def id @id end |
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def lifecycle @lifecycle end |
#target ⇒ Object
Returns the value of attribute target.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def target @target end |
#test_id ⇒ Object
Returns the value of attribute test_id.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def test_id @test_id end |
#timing ⇒ Object
Returns the value of attribute timing.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def timing @timing end |
#total_tests ⇒ Object
Returns the value of attribute total_tests.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def total_tests @total_tests end |
#trigger ⇒ Object
Returns the value of attribute trigger.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def trigger @trigger end |
#workflow ⇒ Object
Returns the value of attribute workflow.
20 21 22 |
# File 'lib/retab/workflow_test_runs/workflow_test_run.rb', line 20 def workflow @workflow end |