Sha256: 32650ff8121e781034d631c82c2db1366a46ac0f5b8e79455aa2b8ce59ff013c

Contents?: true

Size: 978 Bytes

Versions: 6

Compression:

Stored size: 978 Bytes

Contents

# typed: false
module Researchable
  module FreedcampApi
    class ListTasks < Endpoint
      integer :task_id, default: nil
      integer :f_with_archived, default: 1

      # Accepts "active", "archived", "all" values. Omitting is equal to "active".
      string :lists_status, default: 'active'
      integer :f_cf, default: 1

      # @api private
      def execute
        list_tasks(task_id)
      end

      sig do
        params(
          task_id: T.nilable(Integer)
        ).returns(
          T::Array[Researchable::FreedcampApi::Structs::Task]
        )
      end
      def list_tasks(task_id)
        task_query = task_id ? "/#{task_id}" : '/'
        fetch_all('tasks') do |limit, offset|
          session.get("/tasks#{task_query}?limit=#{limit}
                   &offset=#{offset}
                   &f_with_archived=#{f_with_archived}
                   &f_cf=#{f_cf}
                   &lists_status=#{lists_status}")
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
researchable-freedcamp-api-0.1.5 lib/researchable/freedcamp_api/list_tasks.rb
researchable-freedcamp-api-0.1.4 lib/researchable/freedcamp_api/list_tasks.rb
researchable-freedcamp-api-0.1.3 lib/researchable/freedcamp_api/list_tasks.rb
researchable-freedcamp-api-0.1.2 lib/researchable/freedcamp_api/list_tasks.rb
researchable-freedcamp-api-0.1.1 lib/researchable/freedcamp_api/list_tasks.rb
researchable-freedcamp-api-0.1.0 lib/researchable/freedcamp_api/list_tasks.rb