restpack_serializer 0.4.15 → 0.4.16

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: 04b87432ce7c31847f7a1e11448448f1adc19209
4
- data.tar.gz: d776997e1bef5f76389e6c0be52261c7707b3a2e
3
+ metadata.gz: edca97b0920315c164716fd440b31108e76c65f4
4
+ data.tar.gz: fba756395137ac36ec9c1e75d610050bb3fbe008
5
5
  SHA512:
6
- metadata.gz: dc397cb3e9ee84bc020d6c1e91b2f834d55fc95d5d7b466b48ecdaf1b6664b30b431bc0fee8bf0e52da1848be6b0418020adf61ed12413cbeb2c2f639b6800c1
7
- data.tar.gz: 50f1625a09e4f34cab9545f5b34882e87e7b62a2c4a763080961edc3e20ef1db2e9b3e5c5970ab8708910a4c195c018592d8013ea02224a3b2a311b6878b65f6
6
+ metadata.gz: 07fa0719ed2576ee95a0d025edc215ee99375346b04b581603d167fd20eceeaca9ac42b9942a14cf245e2f733699325169169c3b3f8c799ae02a8c0c8b2e54b2
7
+ data.tar.gz: e4ef801153749be306c31fcdb6afff9caf194e18405be2f50d69c3efffb234542d5ac02df9e11be7e51d2c1a3a6ee3b5279713819556be086a80d51a586fd8f7
@@ -1,5 +1,4 @@
1
- require 'will_paginate'
2
- require 'will_paginate/active_record'
1
+ require 'kaminari'
3
2
  require 'protected_attributes'
4
3
 
5
4
  require 'restpack_serializer/version'
@@ -8,6 +7,8 @@ require 'restpack_serializer/serializable'
8
7
  require 'restpack_serializer/factory'
9
8
  require 'restpack_serializer/result'
10
9
 
10
+ Kaminari::Hooks.init
11
+
11
12
  module RestPack
12
13
  module Serializer
13
14
  mattr_accessor :config
@@ -7,10 +7,7 @@ module RestPack::Serializer::Paging
7
7
  end
8
8
 
9
9
  def page_with_options(options)
10
- page = options.scope_with_filters.paginate(
11
- page: options.page,
12
- per_page: options.page_size
13
- )
10
+ page = options.scope_with_filters.page(options.page).per(options.page_size)
14
11
 
15
12
  result = RestPack::Serializer::Result.new
16
13
  result.resources[self.key] = serialize_page(page, options)
@@ -39,11 +36,11 @@ module RestPack::Serializer::Paging
39
36
  meta = {
40
37
  page: options.page,
41
38
  page_size: options.page_size,
42
- count: page.total_entries,
39
+ count: page.total_count,
43
40
  include: options.include
44
41
  }
45
42
 
46
- meta[:page_count] = ((page.total_entries - 1) / options.page_size) + 1
43
+ meta[:page_count] = ((page.total_count - 1) / options.page_size) + 1
47
44
  meta[:previous_page] = meta[:page] > 1 ? meta[:page] - 1 : nil
48
45
  meta[:next_page] = meta[:page] < meta[:page_count] ? meta[:page] + 1 : nil
49
46
 
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.4.15'
3
+ VERSION = '0.4.16'
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency 'activerecord', '~> 4.0.3'
21
21
  gem.add_dependency 'activesupport', '~> 4.0.3'
22
22
  gem.add_dependency 'protected_attributes', '~> 1.0.5'
23
- gem.add_dependency 'will_paginate', '~> 3.0.5'
23
+ gem.add_dependency 'kaminari', '~> 0.15.1'
24
24
 
25
25
  gem.add_development_dependency 'restpack_gem', '~> 0.0.9'
26
26
  gem.add_development_dependency 'rake', '~> 10.0.3'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.5
55
55
  - !ruby/object:Gem::Dependency
56
- name: will_paginate
56
+ name: kaminari
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.5
61
+ version: 0.15.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 3.0.5
68
+ version: 0.15.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: restpack_gem
71
71
  requirement: !ruby/object:Gem::Requirement