Sha256: 2347ec470feac24c4f4615f2412fa1baf3430f2b705f5b09d59de46e62fc9d26

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

# typed: true

module UpGush
  class SyncUpWorkflow < T::Struct
    extend T::Sig

    const :up_wf_id, T.nilable(String)

    sig { returns(T.nilable(::Workflow)) }
    attr_accessor :up_workflow

    sig { params(data: T::Hash[Symbol, T.untyped]).returns(T::Boolean) }
    def sync_with(data)
      return false if data.empty? || up_wf_id.blank?

      up_wf = UpGush::Models::Workflow.find_by(id: up_wf_id)
      return false unless up_wf

      # stopped workflows are hard stops from admin. no other updates should be performed.
      !up_wf.stopped? && up_wf.update(data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
up_gush-3.0.0.1 lib/up_gush/sync_up_workflow.rb