gitlab-org--gitlab-foss/lib/api/pagination_params.rb
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00

26 lines
584 B
Ruby

# frozen_string_literal: true
module API
# Concern for declare pagination params.
#
# @example
# class CustomApiResource < Grape::API
# include PaginationParams
#
# params do
# use :pagination
# end
# end
module PaginationParams
extend ActiveSupport::Concern
included do
helpers do
params :pagination do
optional :page, type: Integer, default: 1, desc: 'Current page number'
optional :per_page, type: Integer, default: 20, desc: 'Number of items per page'
end
end
end
end
end