api-pagination 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api-pagination/version.rb +1 -1
- data/lib/api-pagination.rb +4 -4
- data/spec/rails_spec.rb +2 -2
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aeee41828ccf353b3be509b5ddc10f180cb238d9b12bb8c357dc3ddfd35f07e
|
4
|
+
data.tar.gz: d2e33f4bf383e78f99d9e0d5ee6878e6fa54c8f9ad7412de18d23cadf45ec650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45ef1013c9a791da01d230be2f1a719af87a658b7ba7ab5a2643959eebe9bed8c7935f591f3077a8ed9db5822d561299a9fad87b8347faa3d45b7e6bab70cfc
|
7
|
+
data.tar.gz: 81e9f814f3ba16bcf86f1a07a26d7ac951e1dbc8a13221e9ef6db207861389ee301b6cb2c1923ff3deffc5718bc203070c0f4b77fca64535abe26f62590fdd6f
|
data/lib/api-pagination.rb
CHANGED
@@ -50,14 +50,14 @@ module ApiPagination
|
|
50
50
|
if Pagy::DEFAULT[:max_per_page] && options[:per_page] > Pagy::DEFAULT[:max_per_page]
|
51
51
|
options[:per_page] = Pagy::DEFAULT[:max_per_page]
|
52
52
|
elsif options[:per_page] <= 0
|
53
|
-
options[:per_page] = Pagy::DEFAULT[:
|
53
|
+
options[:per_page] = Pagy::DEFAULT[:limit]
|
54
54
|
end
|
55
55
|
|
56
56
|
pagy = pagy_from(collection, options)
|
57
57
|
collection = if collection.respond_to?(:offset) && collection.respond_to?(:limit)
|
58
|
-
collection.offset(pagy.offset).limit(pagy.
|
58
|
+
collection.offset(pagy.offset).limit(pagy.limit)
|
59
59
|
else
|
60
|
-
collection[pagy.offset, pagy.
|
60
|
+
collection[pagy.offset, pagy.limit]
|
61
61
|
end
|
62
62
|
|
63
63
|
return [collection, pagy]
|
@@ -70,7 +70,7 @@ module ApiPagination
|
|
70
70
|
count = collection.is_a?(Array) ? collection.count : collection.count(:all)
|
71
71
|
end
|
72
72
|
|
73
|
-
Pagy.new(count: count,
|
73
|
+
Pagy.new(count: count, limit: options[:per_page], page: options[:page])
|
74
74
|
end
|
75
75
|
|
76
76
|
def pagy_pages_from(pagy)
|
data/spec/rails_spec.rb
CHANGED
@@ -286,7 +286,7 @@ describe NumbersController, :type => :controller do
|
|
286
286
|
|
287
287
|
expect(response.header['Per-Page']).to eq(
|
288
288
|
case ApiPagination.config.paginator
|
289
|
-
when :pagy then Pagy::DEFAULT[:
|
289
|
+
when :pagy then Pagy::DEFAULT[:limit].to_s
|
290
290
|
when :kaminari then Kaminari.config.default_per_page.to_s
|
291
291
|
when :will_paginate then WillPaginate.per_page.to_s
|
292
292
|
end
|
@@ -301,7 +301,7 @@ describe NumbersController, :type => :controller do
|
|
301
301
|
|
302
302
|
expect(response.header['Per-Page']).to eq(
|
303
303
|
case ApiPagination.config.paginator
|
304
|
-
when :pagy then Pagy::DEFAULT[:
|
304
|
+
when :pagy then Pagy::DEFAULT[:limit].to_s
|
305
305
|
when :kaminari then Kaminari.config.default_per_page.to_s
|
306
306
|
when :will_paginate then WillPaginate.per_page.to_s
|
307
307
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kaminari
|
@@ -36,20 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 5.1.2
|
39
|
+
version: '9.0'
|
43
40
|
type: :development
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 5.1.2
|
46
|
+
version: '9.0'
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: will_paginate
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
207
|
- !ruby/object:Gem::Version
|
214
208
|
version: '0'
|
215
209
|
requirements: []
|
216
|
-
rubygems_version: 3.
|
210
|
+
rubygems_version: 3.5.16
|
217
211
|
signing_key:
|
218
212
|
specification_version: 4
|
219
213
|
summary: Link header pagination for Rails and Grape APIs. Don't use the request body.
|