grape-kaminari 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: 4fb24c245069275a376233ac2b1ab9ea14bacf83
4
- data.tar.gz: 1f74c3dd9df09d1bc3f015e23dd2f2289239eed2
3
+ metadata.gz: 0650a3fcc5272f2eed79e0e91bfa6eb5fb587163
4
+ data.tar.gz: cfdfdff5ef9331723eb5c44aa9664d992649ec6d
5
5
  SHA512:
6
- metadata.gz: 3f2fbb8ce000c0938fe14adc08e7c646bae1be1f2341fba2eff44e21e59133766db1152ceb873ea482d62ea17992a0eb8c7bdd381935b1c952999e778520fb6d
7
- data.tar.gz: 8d87799ba47f32584ed935f7f1f8db84ed71fbb8d4b92c937c8370570ab0aa577309268957eeb23fe3baa9b894211001f2ee74a77b7c8a54c5d9c44b1f133280
6
+ metadata.gz: 4080a0270909df209d36acea7842c54e0b65fe78c463695e9ea42911b0b8ced4ccda6effa7509e387251978e5f7983176a42b8d0628fffcdc4311d08ba661fcf
7
+ data.tar.gz: 0b8b07ff42c2b53a93b1804602571fe8b8d331e2294402867e2882c7723060540380611db1e115cf65d80c0b59f70eb4d326ca89cf6f4ae3c67eb39972b1487b
@@ -1 +1,11 @@
1
+ module Grape
2
+ module Kaminari
3
+ class << self
4
+ def post_0_9_0_grape?
5
+ Gem::Version.new(Grape::VERSION) > Gem::Version.new('0.9.0')
6
+ end
7
+ end
8
+ end
9
+ end
10
+
1
11
  require "grape/kaminari"
@@ -1,6 +1,12 @@
1
1
  module Grape
2
2
  module Kaminari
3
- class MaxValueValidator < Grape::Validations::SingleOptionValidator
3
+ base = if post_0_9_0_grape?
4
+ Grape::Validations::Base
5
+ else
6
+ Grape::Validations::SingleOptionValidator
7
+ end
8
+
9
+ class MaxValueValidator < base
4
10
  def validate_param!(attr_name, params)
5
11
  return unless params[attr_name]
6
12
 
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Kaminari
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
@@ -23,7 +23,11 @@ describe Grape::Kaminari do
23
23
 
24
24
  it 'adds to declared parameters' do
25
25
  subject.paginate
26
- expect(subject.settings[:declared_params]).to eq([:page, :per_page, :offset])
26
+ if Grape::Kaminari.post_0_9_0_grape?
27
+ expect(subject.inheritable_setting.route[:declared_params]).to eq([:page, :per_page, :offset])
28
+ else
29
+ expect(subject.settings[:declared_params]).to eq([:page, :per_page, :offset])
30
+ end
27
31
  end
28
32
 
29
33
  describe 'descriptions, validation, and defaults' do
@@ -122,7 +126,11 @@ describe Grape::Kaminari do
122
126
 
123
127
  it 'excludes :offset from declared params' do
124
128
  subject.paginate offset: false
125
- expect(subject.settings[:declared_params]).not_to include(:offset)
129
+ if Grape::Kaminari.post_0_9_0_grape?
130
+ expect(subject.inheritable_setting.route[:declared_params]).not_to include(:offset)
131
+ else
132
+ expect(subject.settings[:declared_params]).not_to include(:offset)
133
+ end
126
134
  end
127
135
 
128
136
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-kaminari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: kaminari
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '2.9'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.9'
83
83
  description: kaminari paginator integration for grape API framework
@@ -87,7 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
90
+ - ".gitignore"
91
91
  - Gemfile
92
92
  - LICENSE.txt
93
93
  - README.md
@@ -110,17 +110,17 @@ require_paths:
110
110
  - lib
111
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - '>='
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.1.11
123
+ rubygems_version: 2.2.2
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: kaminari integration for grape