|
|
@ -39,8 +39,10 @@ module API |
|
|
|
def initialize(models, self_link, query: {}, page: nil, per_page: nil, current_user:) |
|
|
|
def initialize(models, self_link, query: {}, page: nil, per_page: nil, current_user:) |
|
|
|
@self_link_base = self_link |
|
|
|
@self_link_base = self_link |
|
|
|
@query = query |
|
|
|
@query = query |
|
|
|
@page = page || 1 |
|
|
|
@page = page.to_i > 0 ? page.to_i : 1 |
|
|
|
@per_page = [per_page || self.class.per_page_default(models), maximum_page_size].min |
|
|
|
@per_page = [per_page || self.class.per_page_default(models), maximum_page_size] |
|
|
|
|
|
|
|
.map(&:to_i) |
|
|
|
|
|
|
|
.min |
|
|
|
|
|
|
|
|
|
|
|
full_self_link = make_page_link(page: @page, page_size: @per_page) |
|
|
|
full_self_link = make_page_link(page: @page, page_size: @per_page) |
|
|
|
paged = paged_models(models) |
|
|
|
paged = paged_models(models) |
|
|
|