grape-pagy 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +1 -1
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +4 -4
- data/grape-pagy.gemspec +3 -3
- data/lib/grape/pagy.rb +5 -4
- data/spec/spec_helper.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: b587c249c2841b932ceba9be1e7fb25678ce0095345f6e07fcd0eb4231e9db0d
|
4
|
+
data.tar.gz: 427c30f87fd2b90ef082c0926198779b51bae79256b5a32ecff4772464e99fe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8e59c02f4e9bd59465ae90e4f4d1d449fc66ac8eade1d1fd1774a4a675baefd89a836b202910d4bb31eb754145f2191673333eb88a81c9cfdaf9b4b31e35ede
|
7
|
+
data.tar.gz: ce49cc0544a6ce5162eaad691742b5263f221e31ffbb5a4fde39228d517dacb6adc5fca23ac7ea34039c87b723b77d6e8e54a8cc20e7e4f7576f17d40ca10afe
|
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
@@ -46,7 +46,7 @@ build-iPhoneSimulator/
|
|
46
46
|
# for a library or gem, you might want to ignore these files since the code is
|
47
47
|
# intended to run in multiple environments; otherwise, check them in:
|
48
48
|
# Gemfile.lock
|
49
|
-
|
49
|
+
.ruby-version
|
50
50
|
# .ruby-gemset
|
51
51
|
|
52
52
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
data/.rubocop.yml
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.4.0)
|
5
5
|
grape (>= 1.5)
|
6
|
-
pagy (>=
|
6
|
+
pagy (>= 4.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -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 (3.
|
53
|
+
pagy (4.3.0)
|
54
54
|
parallel (1.20.1)
|
55
55
|
parser (3.0.1.0)
|
56
56
|
ast (~> 2.4.1)
|
@@ -124,4 +124,4 @@ DEPENDENCIES
|
|
124
124
|
rubocop-bsm
|
125
125
|
|
126
126
|
BUNDLED WITH
|
127
|
-
2.
|
127
|
+
2.2.16
|
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.4.0'
|
4
4
|
spec.authors = ['Black Square Media']
|
5
5
|
spec.email = ['info@blacksquaremedia.com']
|
6
6
|
spec.description = 'Pagy paginator for grape API'
|
@@ -11,10 +11,10 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.files = `git ls-files -z`.split("\x0").reject {|f| f.start_with?('spec/') }
|
12
12
|
spec.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
13
13
|
spec.require_paths = ['lib']
|
14
|
-
spec.required_ruby_version = '>=
|
14
|
+
spec.required_ruby_version = '>= 3.0'
|
15
15
|
|
16
16
|
spec.add_runtime_dependency 'grape', '>= 1.5'
|
17
|
-
spec.add_runtime_dependency 'pagy', '>=
|
17
|
+
spec.add_runtime_dependency 'pagy', '>= 4.2'
|
18
18
|
|
19
19
|
spec.add_development_dependency 'bundler'
|
20
20
|
spec.add_development_dependency 'rack-test'
|
data/lib/grape/pagy.rb
CHANGED
@@ -13,7 +13,7 @@ module Grape
|
|
13
13
|
include ::Pagy::Backend
|
14
14
|
|
15
15
|
def paginate(collection, using: nil, **opts, &block)
|
16
|
-
|
16
|
+
opts = pagy_countless_get_vars(nil, opts)
|
17
17
|
using ||= if collection.respond_to?(:arel_table)
|
18
18
|
:arel
|
19
19
|
elsif collection.is_a?(Array)
|
@@ -31,9 +31,9 @@ module Grape
|
|
31
31
|
module Helpers
|
32
32
|
extend Grape::API::Helpers
|
33
33
|
|
34
|
-
params :pagy do |
|
35
|
-
items
|
36
|
-
page
|
34
|
+
params :pagy do |opts|
|
35
|
+
items = opts.delete(:items) || ::Pagy::VARS[:items]
|
36
|
+
page = opts.delete(:page) || ::Pagy::VARS[:page]
|
37
37
|
page_param = opts[:page_param] || ::Pagy::VARS[:page_param]
|
38
38
|
items_param = opts[:items_param] || ::Pagy::VARS[:items_param]
|
39
39
|
|
@@ -45,6 +45,7 @@ module Grape
|
|
45
45
|
# @param [Array|ActiveRecord::Relation] collection the collection or relation.
|
46
46
|
def pagy(collection, **opts)
|
47
47
|
defaults = route_setting(:pagy_options) || {}
|
48
|
+
|
48
49
|
Wrapper.new(request, params).paginate(collection, **defaults, **opts) do |key, value|
|
49
50
|
header key, value
|
50
51
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-pagy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media
|
@@ -30,20 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '4.0'
|
33
|
+
version: '4.2'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '4.0'
|
40
|
+
version: '4.2'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: bundler
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,14 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
141
|
requirements:
|
148
142
|
- - ">="
|
149
143
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
144
|
+
version: '3.0'
|
151
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
146
|
requirements:
|
153
147
|
- - ">="
|
154
148
|
- !ruby/object:Gem::Version
|
155
149
|
version: '0'
|
156
150
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.2.15
|
158
152
|
signing_key:
|
159
153
|
specification_version: 4
|
160
154
|
summary: ''
|