diff options
author | Semyon Pupkov <mail@semyonpupkov.com> | 2016-11-22 00:15:46 +0500 |
---|---|---|
committer | Semyon Pupkov <mail@semyonpupkov.com> | 2016-11-22 09:19:26 +0500 |
commit | 77cf855bb995eb8875b41d5683c30bae2d17f2f4 (patch) | |
tree | ca476011924646484be55130438ea7e3295b60ab /lib/api/pagination_params.rb | |
parent | 53714ddf2bcc56659236d87647d8b8e8412592f3 (diff) | |
download | gitlab-ce-77cf855bb995eb8875b41d5683c30bae2d17f2f4.tar.gz |
Define common helper for describe pagination params in api
Diffstat (limited to 'lib/api/pagination_params.rb')
-rw-r--r-- | lib/api/pagination_params.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/api/pagination_params.rb b/lib/api/pagination_params.rb new file mode 100644 index 00000000000..8c1e4381a74 --- /dev/null +++ b/lib/api/pagination_params.rb @@ -0,0 +1,24 @@ +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, desc: 'Current page number' + optional :per_page, type: Integer, desc: 'Number of items per page' + end + end + end + end +end |