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: :workflow, trigger: :trigger, lifecycle: :lifecycle, timing: :timing, inputs: :inputs }.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.
-
#timing ⇒ Object
Returns the value of attribute timing.
-
#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) ⇒ WorkflowRun
constructor
A new instance of WorkflowRun.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ WorkflowRun
Returns a new instance of WorkflowRun.
25 26 27 28 29 30 31 32 33 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 25 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 "awaiting_review" then Retab::AwaitingReviewRun.new(hash[:lifecycle]) when "cancelled" then Retab::CancelledTerminal.new(hash[:lifecycle]) when "completed" then Retab::CompletedTerminal.new(hash[:lifecycle]) when "error" then Retab::ErrorTerminal.new(hash[:lifecycle]) when "pending" then Retab::PendingRun.new(hash[:lifecycle]) when "running" then 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 end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
17 18 19 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 17 def id @id end |
#inputs ⇒ Object
Returns the value of attribute inputs.
17 18 19 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 17 def inputs @inputs end |
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
17 18 19 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 17 def lifecycle @lifecycle end |
#timing ⇒ Object
Returns the value of attribute timing.
17 18 19 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 17 def timing @timing end |
#trigger ⇒ Object
Returns the value of attribute trigger.
17 18 19 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 17 def trigger @trigger end |
#workflow ⇒ Object
Returns the value of attribute workflow.
17 18 19 |
# File 'lib/retab/workflow_runs/workflow_run.rb', line 17 def workflow @workflow end |