Module: PactBroker::Api::Resources::PaginationMethods

Included in:
BranchVersions, Dashboard, Integrations, Labels, PacticipantBranches, Pacticipants, Versions
Defined in:
lib/pact_broker/api/resources/pagination_methods.rb

Instance Method Summary collapse

Instance Method Details

#default_pagination_optionsObject



22
23
24
# File 'lib/pact_broker/api/resources/pagination_methods.rb', line 22

def default_pagination_options
  { page_number: 1, page_size: 100 }
end

#pagination_optionsObject

rubocop: disable Metrics/CyclomaticComplexity



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pact_broker/api/resources/pagination_methods.rb', line 6

def pagination_options
  if request.query["page"] || request.query["size"]
    {
      page_number: request.query["page"]&.to_i || 1,
      page_size: request.query["size"]&.to_i || 100
    }
  elsif request.query["pageNumber"] || request.query["pageSize"]
    {
      page_number: request.query["pageNumber"]&.to_i || 1,
      page_size: request.query["pageSize"]&.to_i || 100
    }
  else
    {}
  end
end