Class: Retab::WorkflowRun
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::WorkflowRun
- Defined in:
- lib/retab/workflow_runs/workflow_run.rb
Constant Summary collapse
- HASH_ATTRS =
{ id: :id, workflow_id: :workflow_id, workflow_version_id: :workflow_version_id, trigger: :trigger, lifecycle: :lifecycle, timing: :timing, inputs: :inputs, metadata: :metadata }.freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#timing ⇒ Object
Returns the value of attribute timing.
-
#trigger ⇒ Object
Returns the value of attribute trigger.
-
#workflow_id ⇒ Object
Returns the value of attribute workflow_id.
-
#workflow_version_id ⇒ Object
Returns the value of attribute workflow_version_id.
Instance Method Summary collapse
-
#initialize(json) ⇒ WorkflowRun
constructor
A new instance of WorkflowRun.
Constructor Details
#initialize(json) ⇒ WorkflowRun
Returns a new instance of WorkflowRun.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 30 def initialize(json) super() hash = self.class.normalize(json) @id = hash[:id] @workflow_id = hash[:workflow_id] @workflow_version_id = hash[:workflow_version_id] @trigger = hash[:trigger] ? Retab::TriggerInfo.new(hash[:trigger]) : nil @lifecycle = hash[:lifecycle] ? ( case hash[:lifecycle][:status] when "awaiting_review" Retab::AwaitingReviewRun.new(hash[:lifecycle]) when "cancelled" Retab::CancelledTerminal.new(hash[:lifecycle]) when "completed" Retab::CompletedTerminal.new(hash[:lifecycle]) when "error" Retab::ErrorTerminal.new(hash[:lifecycle]) when "pending" Retab::PendingRun.new(hash[:lifecycle]) when "running" Retab::RunningRun.new(hash[:lifecycle]) else hash[:lifecycle] end ) : nil @timing = hash[:timing] ? Retab::RunTiming.new(hash[:timing]) : nil @inputs = hash[:inputs] ? Retab::RunInputs.new(hash[:inputs]) : nil @metadata = hash[:metadata] || {} end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def id @id end |
#inputs ⇒ Object
Returns the value of attribute inputs.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def inputs @inputs end |
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def lifecycle @lifecycle end |
#metadata ⇒ Object
Returns the value of attribute metadata.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def @metadata end |
#timing ⇒ Object
Returns the value of attribute timing.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def timing @timing end |
#trigger ⇒ Object
Returns the value of attribute trigger.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def trigger @trigger end |
#workflow_id ⇒ Object
Returns the value of attribute workflow_id.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def workflow_id @workflow_id end |
#workflow_version_id ⇒ Object
Returns the value of attribute workflow_version_id.
19 20 21 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 19 def workflow_version_id @workflow_version_id end |