Sha256: 20a1fbd0f006e909ff282ea8018ff00ae0d1e31492bb659e0557724215f551d4

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 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 :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.1 lib/manifestly/entity/workflow.rb
manifestly-client-1.0.0 lib/manifestly/entity/workflow.rb