grape-kaminari 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0ae809ad4c135dcf91437d3e66be5aeade55263df274f958da45e3518643121
4
- data.tar.gz: 6444fd46138c8e330a9c74254f27d0512ea861df07eb90cde07f070a1e43a0e6
3
+ metadata.gz: 690c3b70419498572169fa3e2daee43ba5adef9c93e46ba8b0da6944f2afdcc0
4
+ data.tar.gz: 49f722ee554da32f4ecc3351abc2e5edc44454882046cfadf39f0d99c7ba2ba5
5
5
  SHA512:
6
- metadata.gz: 5633fb0d0acecfe2aa68eaff97e29aabddd087922b0ab17a439b26a6fd8ac3889f5f3c902dff54b1729bace30fe6c81c2972a1075785653ea0785b5326ad79e0
7
- data.tar.gz: 25fbc7a3ad61bc457e237da7ccf9dfbced16c76b291cec006ed45ac9504fc9e208d3f5ac2e3f30f9f94396d7b157214f106aeec05bd8d121e1b6ee06e614025a
6
+ metadata.gz: c08980fd147c292e51c546c19166a095b012fe0727e95a30d5ac9a5682eecfd66fdbf907167b0c2c5160c854269728ecca34cee6808009660e02075eaed67d35
7
+ data.tar.gz: ffdf0838305fd025f5fda2fb96ee6c58b9f46bfbe0fe511f13de9b06d9683f1f6651d45a23d8b923434974f65d930242bcfb00723a3042dffa9cdecd6dba8960
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-kaminari (0.2.1)
5
- grape (>= 1.0)
4
+ grape-kaminari (0.3.0)
5
+ grape (>= 1.0, != 1.4.0)
6
6
  kaminari-grape
7
7
 
8
8
  GEM
@@ -16,9 +16,9 @@ GEM
16
16
  zeitwerk (~> 2.2, >= 2.2.2)
17
17
  ast (2.4.1)
18
18
  builder (3.2.4)
19
- concurrent-ruby (1.1.6)
20
- diff-lcs (1.3)
21
- dry-configurable (0.11.5)
19
+ concurrent-ruby (1.1.7)
20
+ diff-lcs (1.4.4)
21
+ dry-configurable (0.11.6)
22
22
  concurrent-ruby (~> 1.0)
23
23
  dry-core (~> 0.4, >= 0.4.7)
24
24
  dry-equalizer (~> 0.2)
@@ -47,7 +47,7 @@ GEM
47
47
  mustermann-grape (~> 1.0.0)
48
48
  rack (>= 1.3.0)
49
49
  rack-accept
50
- i18n (1.8.3)
50
+ i18n (1.8.5)
51
51
  concurrent-ruby (~> 1.0)
52
52
  kaminari-core (1.2.1)
53
53
  kaminari-grape (1.0.1)
@@ -59,8 +59,8 @@ GEM
59
59
  mustermann-grape (1.0.1)
60
60
  mustermann (>= 1.0.0)
61
61
  parallel (1.19.2)
62
- parser (2.7.1.3)
63
- ast (~> 2.4.0)
62
+ parser (2.7.1.4)
63
+ ast (~> 2.4.1)
64
64
  rack (2.2.3)
65
65
  rack-accept (0.4.5)
66
66
  rack (>= 0.4)
@@ -83,24 +83,24 @@ GEM
83
83
  diff-lcs (>= 1.2.0, < 2.0)
84
84
  rspec-support (~> 3.9.0)
85
85
  rspec-support (3.9.3)
86
- rubocop (0.85.1)
86
+ rubocop (0.89.0)
87
87
  parallel (~> 1.10)
88
- parser (>= 2.7.0.1)
88
+ parser (>= 2.7.1.1)
89
89
  rainbow (>= 2.2.2, < 4.0)
90
90
  regexp_parser (>= 1.7)
91
91
  rexml
92
- rubocop-ast (>= 0.0.3)
92
+ rubocop-ast (>= 0.1.0, < 1.0)
93
93
  ruby-progressbar (~> 1.7)
94
94
  unicode-display_width (>= 1.4.0, < 2.0)
95
- rubocop-ast (0.0.3)
96
- parser (>= 2.7.0.1)
95
+ rubocop-ast (0.3.0)
96
+ parser (>= 2.7.1.4)
97
97
  ruby-progressbar (1.10.1)
98
98
  ruby2_keywords (0.0.2)
99
99
  thread_safe (0.3.6)
100
100
  tzinfo (1.2.7)
101
101
  thread_safe (~> 0.1)
102
102
  unicode-display_width (1.7.0)
103
- zeitwerk (2.3.0)
103
+ zeitwerk (2.4.0)
104
104
 
105
105
  PLATFORMS
106
106
  ruby
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ['lib']
18
18
  spec.required_ruby_version = '>= 2.5'
19
19
 
20
- spec.add_runtime_dependency 'grape', '>= 1.0'
20
+ spec.add_runtime_dependency 'grape', '>= 1.0', '!= 1.4.0'
21
21
  spec.add_runtime_dependency 'kaminari-grape'
22
22
 
23
23
  spec.add_development_dependency 'bundler'
@@ -5,6 +5,13 @@ require 'kaminari/grape'
5
5
 
6
6
  module Grape
7
7
  module Kaminari
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ helpers HelperMethods
12
+ base_instance.extend DSLMethods
13
+ end
14
+
8
15
  module HelperMethods # :nodoc:
9
16
  def paginate(collection)
10
17
  collection.page(params[:page].to_i)
@@ -22,7 +29,7 @@ module Grape
22
29
  end
23
30
  end
24
31
 
25
- module ClassMethods # :nodoc:
32
+ module DSLMethods # :nodoc:
26
33
  def paginate(**options)
27
34
  options.reverse_merge!(
28
35
  per_page: ::Kaminari.config.default_per_page || 10,
@@ -42,10 +49,5 @@ module Grape
42
49
  end
43
50
  end
44
51
  end
45
-
46
- def self.included(base)
47
- base.helpers HelperMethods
48
- base.extend ClassMethods
49
- end
50
52
  end
51
53
  end
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Kaminari
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
@@ -13,13 +13,18 @@ class PaginatedAPI < Grape::API
13
13
  get 'no-offset' do
14
14
  paginate(Kaminari.paginate_array((1..10).to_a))
15
15
  end
16
+
17
+ resource :sub do
18
+ paginate per_page: 2
19
+ get '/' do
20
+ paginate(Kaminari.paginate_array((1..10).to_a))
21
+ end
22
+ end
16
23
  end
17
24
 
18
25
  describe Grape::Kaminari do
19
26
  subject { PaginatedAPI.new }
20
- def app
21
- subject
22
- end
27
+ let(:app) { subject }
23
28
  let(:json) { JSON.parse(last_response.body) }
24
29
  let(:header) { last_response.header }
25
30
 
@@ -51,5 +56,10 @@ describe Grape::Kaminari do
51
56
  expect(header['X-Prev-Page']).to eq '2'
52
57
  expect(header['X-Offset']).to eq '1'
53
58
  end
59
+
60
+ it 'can be inherited' do
61
+ get '/sub', page: 1
62
+ expect(json).to eq [1, 2]
63
+ end
54
64
  end
55
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-kaminari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-18 00:00:00.000000000 Z
12
+ date: 2020-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: grape
@@ -18,6 +18,9 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
+ - - "!="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.4.0
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -25,6 +28,9 @@ dependencies:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: '1.0'
31
+ - - "!="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.0
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: kaminari-grape
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
157
  - !ruby/object:Gem::Version
152
158
  version: '0'
153
159
  requirements: []
154
- rubygems_version: 3.1.4
160
+ rubygems_version: 3.1.2
155
161
  signing_key:
156
162
  specification_version: 4
157
163
  summary: kaminari integration for grape