Sha256: f809913d0acbe5e7496efd559b5d30a4a1674384522f8bdb2983f5ff1a7df5ff

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

module Ecoportal
  module API
    class V2
      class Pages
        class PageStage
          class Task < Ecoportal::API::Common::Content::DoubleModel
            passkey     :id
            passforced  :patch_ver, default: 0

            passthrough :name
            passthrough :user_lookups, :user_ids
            passthrough :strategies, :scheduled_callbacks
            passboolean :historic

            passboolean :complete, :completable
            passdate :due, :complete_at
            passthrough :complete_by_id, :completed_by_name

            passthrough :last_strategy
            passboolean :is_retry, :rejected
            passthrough :retry_reason
            passthrough :rejected_by, :rejected_by_name, :rejected_notes
            passdate :rejected_at

            passboolean :escalated
            passdate :escalated_at

            passboolean :submitted
            passthrough :type
            passthrough :view_type

            def ooze
              self._parent.ooze
            end

            def fill_in?
              type == 'complete_page'
            end

            def review?
              type == 'review_page'
            end

            def complete!
              return mark_as_submit   if fill_in?
              return mark_as_sign_off if review?
            end

            private

            def mark_as_submit
              doc['submitted'] = true
            end

            def mark_as_sign_off
              doc['sign_off'] = true
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecoportal-api-v2-2.0.8 lib/ecoportal/api/v2/pages/page_stage/task.rb
ecoportal-api-v2-2.0.7 lib/ecoportal/api/v2/pages/page_stage/task.rb