lib/grape/kaminari.rb in grape-kaminari-0.1.5 vs lib/grape/kaminari.rb in grape-kaminari-0.1.6

- old
+ new

@@ -21,18 +21,22 @@ end def self.paginate(options = {}) options.reverse_merge!( per_page: ::Kaminari.config.default_per_page || 10, - max_per_page: ::Kaminari.config.max_per_page + max_per_page: ::Kaminari.config.max_per_page, + offset: 0 ) params do optional :page, type: Integer, default: 1, desc: 'Page offset to fetch.' optional :per_page, type: Integer, default: options[:per_page], desc: 'Number of results to return per page.', max_value: options[:max_per_page] - optional :offset, type: Integer, default: 0 + if options[:offset].is_a? Numeric + optional :offset, type: Integer, default: options[:offset], + desc: 'Pad a number of results.' + end end end end end end