module Ecoportal module API class V2 class Pages class PageStage class Tasks < Ecoportal::API::Common::Content::CollectionModel class_resolver :task_class, "Ecoportal::API::V2::Pages::PageStage::Task" self.klass = :task_class def ooze self._parent.ooze end # @return [Ecoportal::API::V2::Pages::PageStage::Task] def get_by_id(id) self.find do |task| task.id == id end end # @return [Array] def get_by_type(type) select do |task| task.type == type end end # @return [Array] def open(&block) reject(&:complete).tap do |res| res.each(&block) end end # @return [Array] def complete(&block) select(&:complete).tap do |res| res.each(&block) end end # @return [Array] def fill_in(active: :unused, &block) target = self target = open if active == true target = complete if active == false target.select(&:fill_in?).tap do |res| res.each(&block) end end # @return [Array] def review(active: :unused, &block) target = self target = open if active == true target = complete if active == false target.select(&:review?).tap do |res| res.each(&block) end end end end end end end end