fetcheable_on_api 0.1.3 → 0.1.4

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
- SHA1:
3
- metadata.gz: 3f28d2fc702708ed0bec47b13b9d4573f0d817c5
4
- data.tar.gz: 4a33d75b625c595516143e00088a6b5374cb1b85
2
+ SHA256:
3
+ metadata.gz: 5eedb9e4ed066e00c70b68c6e40a66aab2908012657c2b290d717d5961fde978
4
+ data.tar.gz: fe9d93cdf84b2d40bcca56b079a59ce5df8ab0ad43adcf7ea38b611d7aba2bcc
5
5
  SHA512:
6
- metadata.gz: 8b64b0d3dbc5cf98d933e4b4187c86ab91ed9e35fe06d13450973a364cb07ffbbffd4ec5d319713de04ffde8041ebcc0f5a7f71079b5df9174e251ca20040662
7
- data.tar.gz: 73292fdb8271450c7bce3f67e4daa08d26c77e129e249e519e41fb7080831dda22ebaca12d7c3803b22c02799fd6145169091aa49b2a1fc8e25ad549a39fe559
6
+ metadata.gz: 22189018b1660c830d13e46ab1f83fcf3b2f8e9a7d5a6e2807758e19f336bf4c2f04e5ff3715ff8551d1681360c1d5abf2d1c9e1541ee52cc178fa1020f5d8fc
7
+ data.tar.gz: a265f51a961e07ec9ccedcbb51a22da4e2ffffd00a2aa056efbcf67f6c1357b95cfb3707b893b05c472c4092ee50529c392679afc0a55ae36f80f7b9a2b244a4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fetcheable_on_api (0.1.1)
4
+ fetcheable_on_api (0.1.4)
5
5
  activesupport (>= 4.1)
6
6
 
7
7
  GEM
@@ -13,9 +13,9 @@ GEM
13
13
  minitest (~> 5.1)
14
14
  tzinfo (~> 1.1)
15
15
  ast (2.4.0)
16
- concurrent-ruby (1.0.5)
16
+ concurrent-ruby (1.1.3)
17
17
  diff-lcs (1.3)
18
- i18n (1.1.0)
18
+ i18n (1.1.1)
19
19
  concurrent-ruby (~> 1.0)
20
20
  jaro_winkler (1.5.1)
21
21
  minitest (5.11.3)
@@ -63,4 +63,4 @@ DEPENDENCIES
63
63
  rubocop (~> 0.59.2)
64
64
 
65
65
  BUNDLED WITH
66
- 1.16.5
66
+ 1.16.6
@@ -28,6 +28,12 @@ module FetcheableOnApi
28
28
  ).to_i
29
29
 
30
30
  offset = (params[:page].fetch(:number, 1).to_i - 1) * limit
31
+ count = collection.except(:offset, :limit, :order).count
32
+
33
+ response.headers['Pagination-Current-Page'] = params[:page].fetch(:number, 1)
34
+ response.headers['Pagination-Per'] = limit
35
+ response.headers['Pagination-Total-Pages'] = 1 + (count / limit).ceil
36
+ response.headers['Pagination-Total-Count'] = count
31
37
 
32
38
  collection.limit(limit).offset(offset)
33
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FetcheableOnApi
4
- VERSION = '0.1.3'.freeze
4
+ VERSION = '0.1.4'.freeze
5
5
  end
@@ -48,9 +48,10 @@ module FetcheableOnApi
48
48
  protected
49
49
 
50
50
  def apply_fetcheable(collection)
51
+ collection = apply_filters(collection)
51
52
  collection = apply_sort(collection)
52
- collection = apply_pagination(collection)
53
- apply_filters(collection)
53
+
54
+ apply_pagination(collection)
54
55
  end
55
56
  end
56
57
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetcheable_on_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabien
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.6.14
125
+ rubygems_version: 2.7.6
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: A controller filters engine gem based on jsonapi spec.