grape-pagy 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +13 -13
- data/README.md +2 -2
- data/grape-pagy.gemspec +2 -2
- data/lib/grape/pagy.rb +4 -4
- data/spec/grape/pagy_spec.rb +6 -4
- data/spec/spec_helper.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cf4286de9e78c7b5a4f4f9ea1fdf9ad8c5e688a64b44e4551c26e300509d42c
|
4
|
+
data.tar.gz: ca06ad206ff3fb7dadc9dcf9f37848afd58645d35f9b8af0dbe7819182694c1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b6094898f98b12b1bf636963d9e3254efa554469f6a179c0ea047022955c9f716c01c1961756d31b53a77f18947026d1929e4eaea80352de47771c2f92769c9
|
7
|
+
data.tar.gz: 8141124754f358828ae5c248fac72acd3dcd4788aac64b3db54e9afbcbbc7b7e366739227c0e081b5249d6e010e6596293f18f06e1dfe5286241bc46b0ed4ac7
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape-pagy (0.
|
4
|
+
grape-pagy (0.5.0)
|
5
5
|
grape (>= 1.5)
|
6
|
-
pagy (>= 4
|
6
|
+
pagy (>= 5.4)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -18,16 +18,16 @@ GEM
|
|
18
18
|
builder (3.2.4)
|
19
19
|
concurrent-ruby (1.1.8)
|
20
20
|
diff-lcs (1.4.4)
|
21
|
-
dry-configurable (0.
|
21
|
+
dry-configurable (0.13.0)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
|
-
dry-core (~> 0.
|
24
|
-
dry-container (0.
|
23
|
+
dry-core (~> 0.6)
|
24
|
+
dry-container (0.9.0)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
|
-
dry-configurable (~> 0.
|
27
|
-
dry-core (0.
|
26
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
27
|
+
dry-core (0.7.1)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
dry-inflector (0.2.
|
30
|
-
dry-logic (1.
|
29
|
+
dry-inflector (0.2.1)
|
30
|
+
dry-logic (1.2.0)
|
31
31
|
concurrent-ruby (~> 1.0)
|
32
32
|
dry-core (~> 0.5, >= 0.5)
|
33
33
|
dry-types (1.5.1)
|
@@ -36,7 +36,7 @@ GEM
|
|
36
36
|
dry-core (~> 0.5, >= 0.5)
|
37
37
|
dry-inflector (~> 0.1, >= 0.1.2)
|
38
38
|
dry-logic (~> 1.0, >= 1.0.2)
|
39
|
-
grape (1.
|
39
|
+
grape (1.6.0)
|
40
40
|
activesupport
|
41
41
|
builder
|
42
42
|
dry-types (>= 1.1)
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
ruby2_keywords (~> 0.0.1)
|
51
51
|
mustermann-grape (1.0.1)
|
52
52
|
mustermann (>= 1.0.0)
|
53
|
-
pagy (4.
|
53
|
+
pagy (5.4.0)
|
54
54
|
parallel (1.20.1)
|
55
55
|
parser (3.0.1.0)
|
56
56
|
ast (~> 2.4.1)
|
@@ -106,7 +106,7 @@ GEM
|
|
106
106
|
rubocop (~> 1.0)
|
107
107
|
rubocop-ast (>= 1.1.0)
|
108
108
|
ruby-progressbar (1.11.0)
|
109
|
-
ruby2_keywords (0.0.
|
109
|
+
ruby2_keywords (0.0.5)
|
110
110
|
tzinfo (2.0.4)
|
111
111
|
concurrent-ruby (~> 1.0)
|
112
112
|
unicode-display_width (2.0.0)
|
@@ -124,4 +124,4 @@ DEPENDENCIES
|
|
124
124
|
rubocop-bsm
|
125
125
|
|
126
126
|
BUNDLED WITH
|
127
|
-
2.2.
|
127
|
+
2.2.21
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Grape::Pagy
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Ruby](https://github.com/bsm/grape-pagy/actions/workflows/ruby.yml/badge.svg)](https://github.com/bsm/grape-pagy/actions/workflows/ruby.yml)
|
4
4
|
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
|
5
5
|
|
6
6
|
[Pagy](https://github.com/ddnexus/pagy) pagination for [grape](https://github.com/ruby-grape/grape) API framework.
|
@@ -47,7 +47,7 @@ class MyApi < Grape::API
|
|
47
47
|
resource :strings do
|
48
48
|
desc 'Supports arrays as well as relations.'
|
49
49
|
params do
|
50
|
-
# Override defaults by setting Pagy::
|
50
|
+
# Override defaults by setting Pagy::DEFAULT or by passing options.
|
51
51
|
use :pagy,
|
52
52
|
items_param: :per_page, # Accept per_page=N param to limit items.
|
53
53
|
items: 2, # If per_page param is blank, default to 2.
|
data/grape-pagy.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'grape-pagy'
|
3
|
-
spec.version = '0.
|
3
|
+
spec.version = '0.5.0'
|
4
4
|
spec.authors = ['Black Square Media']
|
5
5
|
spec.email = ['info@blacksquaremedia.com']
|
6
6
|
spec.description = 'Pagy paginator for grape API'
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.required_ruby_version = '>= 3.0'
|
15
15
|
|
16
16
|
spec.add_runtime_dependency 'grape', '>= 1.5'
|
17
|
-
spec.add_runtime_dependency 'pagy', '>= 4
|
17
|
+
spec.add_runtime_dependency 'pagy', '>= 5.4'
|
18
18
|
|
19
19
|
spec.add_development_dependency 'bundler'
|
20
20
|
spec.add_development_dependency 'rack-test'
|
data/lib/grape/pagy.rb
CHANGED
@@ -32,10 +32,10 @@ module Grape
|
|
32
32
|
extend Grape::API::Helpers
|
33
33
|
|
34
34
|
params :pagy do |opts|
|
35
|
-
items = opts.delete(:items) || ::Pagy::
|
36
|
-
page = opts.delete(:page) || ::Pagy::
|
37
|
-
page_param = opts[:page_param] || ::Pagy::
|
38
|
-
items_param = opts[:items_param] || ::Pagy::
|
35
|
+
items = opts.delete(:items) || ::Pagy::DEFAULT[:items]
|
36
|
+
page = opts.delete(:page) || ::Pagy::DEFAULT[:page]
|
37
|
+
page_param = opts[:page_param] || ::Pagy::DEFAULT[:page_param]
|
38
|
+
items_param = opts[:items_param] || ::Pagy::DEFAULT[:items_param]
|
39
39
|
|
40
40
|
@api.route_setting(:pagy_options, opts)
|
41
41
|
optional page_param, type: Integer, default: page, desc: 'Page offset to fetch.'
|
data/spec/grape/pagy_spec.rb
CHANGED
@@ -10,7 +10,9 @@ describe Grape::Pagy do
|
|
10
10
|
expect(last_response.status).to eq(200)
|
11
11
|
expect(last_response.headers).to include(
|
12
12
|
'Current-Page' => '1',
|
13
|
-
'Link' =>
|
13
|
+
'Link' => '<http://example.org/?page=1&items=5>; rel="first", ' \
|
14
|
+
'<http://example.org/?page=2&items=5>; rel="next", ' \
|
15
|
+
'<http://example.org/?page=3&items=5>; rel="last"',
|
14
16
|
'Page-Items' => '5',
|
15
17
|
'Total-Count' => '12',
|
16
18
|
'Total-Pages' => '3',
|
@@ -57,9 +59,9 @@ describe Grape::Pagy do
|
|
57
59
|
'Current-Page' => '2',
|
58
60
|
'Page-Items' => '3',
|
59
61
|
'Link' => [
|
60
|
-
%(<http://example.org/countless?page=1>; rel="first"),
|
61
|
-
%(<http://example.org/countless?page=1>; rel="prev"),
|
62
|
-
%(<http://example.org/countless?page=3>; rel="next"),
|
62
|
+
%(<http://example.org/countless?page=1&items=3>; rel="first"),
|
63
|
+
%(<http://example.org/countless?page=1&items=3>; rel="prev"),
|
64
|
+
%(<http://example.org/countless?page=3&items=3>; rel="next"),
|
63
65
|
].join(', '),
|
64
66
|
)
|
65
67
|
expect(last_response.headers).not_to include(
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-pagy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4
|
33
|
+
version: '5.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '4
|
40
|
+
version: '5.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|