Sha256: 35b7c5567d51ce511308cb031a2d5d95518e903a241db61586549c402658b8dc

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

# typed: false
module Researchable
  module FreedcampApi
    class ListMilestones < Endpoint
      integer :milestone_id, default: nil
      integer :project_id, default: nil
      integer :f_cf, default: 1

      def execute
        list_milestones(milestone_id)
      end

      # sig do
      # params(
      # task_id: T.nilable(Integer)
      # ).returns(
      # T::Array[Researchable::FreedcampApi::Structs::Task]
      # )
      # end
      def list_milestones(milestone_id)
        milestone_query = milestone_id ? "/#{milestone_id}" : '/'
        project_query = project_id ? "&project_id=#{project_id}" : ''
        custom_fields_query = f_cf.nil? ? '' : "&f_cf=#{f_cf}"
        fetch_all('milestones') do |limit, offset|
          url = "/milestones#{milestone_query}?limit=#{limit}
                  #{project_query}
                  #{custom_fields_query}
                   &offset=#{offset}"
          session.get(url)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
researchable-freedcamp-api-0.1.8 lib/researchable/freedcamp_api/list_milestones.rb
researchable-freedcamp-api-0.1.7 lib/researchable/freedcamp_api/list_milestones.rb