Sha256: a875fd3f9070321e659f96e2b905ef966eaf69d8b2c774408a523ca1f3a06405

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require_relative 'endpoint'

module Manifestly
  module Entity
    class Workflow < Endpoint
      attr_accessor :id
      attr_accessor :account_id
      attr_accessor :business_days
      attr_accessor :channel
      attr_accessor :description
      attr_accessor :expected_duration
      attr_accessor :expected_duration_units
      attr_accessor :external_id
      attr_accessor :hide_steps_from_external
      attr_reader :steps
      attr_reader :tag_list
      attr_accessor :title

      def self.endpoint_target
        :checklists
      end

      # Workflows use an 'upsert' methodology so the create and update routes are shared.
      # Lookups are done via the external_id you pass in
      def update
        create
      end

      def steps # rubocop:disable DuplicateMethods
        return @steps if @steps

        @steps = Manifestly::Entity::WorkflowStep.list(self) if id
        @steps ||= []
      end

      def steps=(values)
        @steps = Array(values).map { |it| WorkflowStep.new(self, it) }
      end

      def tag_list=(values)
        @tag_list = Array(values).map(&:upcase)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
manifestly-client-1.0.4 lib/manifestly/entity/workflow.rb
manifestly-client-1.0.3 lib/manifestly/entity/workflow.rb