Sha256: 382b8184a8373c2c56d8f5b60b3769f3b82e01c0da827dc7b8408c600e3f7da0

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require_relative 'endpoint'

module Manifestly
  module Entity
    class WorkflowStep < ChildEndpoint
      attr_accessor :id
      attr_accessor :checklist_id
      attr_accessor :position
      attr_accessor :title
      attr_accessor :description
      attr_accessor :description_with_links
      attr_accessor :created_at
      attr_accessor :updated_at
      attr_reader :header_step
      attr_accessor :active
      attr_accessor :original_id
      attr_accessor :late_at_offset
      attr_accessor :late_at_offset_units
      attr_accessor :late_at_basis
      attr_accessor :parent_step_id

      invalid_method(:create)
      invalid_class_method(:get)
      invalid_method(:update)
      invalid_method(:save)
      invalid_method(:delete)

      def self.parent_class
        Workflow
      end

      def self.endpoint_target
        :steps
      end

      def content_objects
        return @content_objects if @content_objects

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

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

      # Header step needs to always be a boolean (even if not set)
      def header_step # rubocop:disable DuplicateMethods
        @header_step || false
      end

      # Always convert to a boolean
      def header_step=(value)
        @header_step = (value.to_s == 'true')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
manifestly-client-1.0.3 lib/manifestly/entity/workflow_step.rb
manifestly-client-1.0.1 lib/manifestly/entity/workflow_step.rb
manifestly-client-1.0.0 lib/manifestly/entity/workflow_step.rb