12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/power_api/generator_helper/pagination_helper.rb', line 12
def
" ApiPagination.configure do |config|\n # If you have more than one gem included, you can choose a paginator.\n config.paginator = :kaminari\n\n # By default, this is set to 'Total'\n config.total_header = 'X-Total'\n\n # By default, this is set to 'Per-Page'\n config.per_page_header = 'X-Per-Page'\n\n # Optional: set this to add a header with the current page number.\n config.page_header = 'X-Page'\n\n # Optional: set this to add other response format. Useful with tools that define :jsonapi format\n # config.response_formats = [:json, :xml, :jsonapi]\n config.response_formats = [:jsonapi]\n\n # Optional: what parameter should be used to set the page option\n config.page_param do |params|\n params[:page][:number] if params[:page].is_a?(ActionController::Parameters)\n end\n\n # Optional: what parameter should be used to set the per page option\n config.per_page_param do |params|\n params[:page][:size] if params[:page].is_a?(ActionController::Parameters)\n end\n\n # Optional: Include the total and last_page link header\n # By default, this is set to true\n # Note: When using kaminari, this prevents the count call to the database\n config.include_total = true\n end\n API_PAGINATION\nend\n"
|