Sha256: 4d30d08071c14241dad75b12947d255adf22c83a525a36216d545d44d5a2456e

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 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.path
        '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

        # If you are trying to get the steps on a workflow returned by the `list` functionality,
        @steps = self.class.get(id).steps 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-0.0.1 lib/manifestly/entity/workflow.rb
manifestly-client-0.0.0 lib/manifestly/entity/workflow.rb