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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b587c249c2841b932ceba9be1e7fb25678ce0095345f6e07fcd0eb4231e9db0d
4
- data.tar.gz: 427c30f87fd2b90ef082c0926198779b51bae79256b5a32ecff4772464e99fe0
3
+ metadata.gz: 5cf4286de9e78c7b5a4f4f9ea1fdf9ad8c5e688a64b44e4551c26e300509d42c
4
+ data.tar.gz: ca06ad206ff3fb7dadc9dcf9f37848afd58645d35f9b8af0dbe7819182694c1e
5
5
  SHA512:
6
- metadata.gz: a8e59c02f4e9bd59465ae90e4f4d1d449fc66ac8eade1d1fd1774a4a675baefd89a836b202910d4bb31eb754145f2191673333eb88a81c9cfdaf9b4b31e35ede
7
- data.tar.gz: ce49cc0544a6ce5162eaad691742b5263f221e31ffbb5a4fde39228d517dacb6adc5fca23ac7ea34039c87b723b77d6e8e54a8cc20e7e4f7576f17d40ca10afe
6
+ metadata.gz: 0b6094898f98b12b1bf636963d9e3254efa554469f6a179c0ea047022955c9f716c01c1961756d31b53a77f18947026d1929e4eaea80352de47771c2f92769c9
7
+ data.tar.gz: 8141124754f358828ae5c248fac72acd3dcd4788aac64b3db54e9afbcbbc7b7e366739227c0e081b5249d6e010e6596293f18f06e1dfe5286241bc46b0ed4ac7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.5.0
2
+
3
+ - Pin to Pagy 5.x.
4
+
5
+ ### 0.4.0
6
+
7
+ - Pin to Pagy 4.x.
8
+
1
9
  ### 0.3.1
2
10
 
3
11
  - Pin to Pagy 3.x.
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-pagy (0.4.0)
4
+ grape-pagy (0.5.0)
5
5
  grape (>= 1.5)
6
- pagy (>= 4.2)
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.12.1)
21
+ dry-configurable (0.13.0)
22
22
  concurrent-ruby (~> 1.0)
23
- dry-core (~> 0.5, >= 0.5.0)
24
- dry-container (0.7.2)
23
+ dry-core (~> 0.6)
24
+ dry-container (0.9.0)
25
25
  concurrent-ruby (~> 1.0)
26
- dry-configurable (~> 0.1, >= 0.1.3)
27
- dry-core (0.5.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.0)
30
- dry-logic (1.1.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.5.3)
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.3.0)
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.4)
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.16
127
+ 2.2.21
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Grape::Pagy
2
2
 
3
- [![Build Status](https://travis-ci.org/bsm/grape-pagy.png?branch=master)](https://travis-ci.org/bsm/grape-pagy)
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::VARS or by passing options.
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.4.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.2'
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::VARS[:items]
36
- page = opts.delete(:page) || ::Pagy::VARS[:page]
37
- page_param = opts[:page_param] || ::Pagy::VARS[:page_param]
38
- items_param = opts[:items_param] || ::Pagy::VARS[:items_param]
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.'
@@ -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' => %(<http://example.org/?page=1>; rel="first", <http://example.org/?page=2>; rel="next", <http://example.org/?page=3>; rel="last"),
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
@@ -4,8 +4,8 @@ require 'rspec'
4
4
  require 'grape/pagy'
5
5
  require 'rack/test'
6
6
 
7
- Pagy::VARS[:items] = 10
8
- Pagy::VARS[:max_items] = 20
7
+ Pagy::DEFAULT[:items] = 10
8
+ Pagy::DEFAULT[:max_items] = 20
9
9
 
10
10
  class TestArray < Array
11
11
  def limit(num)
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.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-04-21 00:00:00.000000000 Z
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.2'
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.2'
40
+ version: '5.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement