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 +5 -5
- data/Gemfile.lock +4 -4
- data/lib/fetcheable_on_api/pagineable.rb +6 -0
- data/lib/fetcheable_on_api/version.rb +1 -1
- data/lib/fetcheable_on_api.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5eedb9e4ed066e00c70b68c6e40a66aab2908012657c2b290d717d5961fde978
|
4
|
+
data.tar.gz: fe9d93cdf84b2d40bcca56b079a59ce5df8ab0ad43adcf7ea38b611d7aba2bcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
16
|
+
concurrent-ruby (1.1.3)
|
17
17
|
diff-lcs (1.3)
|
18
|
-
i18n (1.1.
|
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.
|
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
|
data/lib/fetcheable_on_api.rb
CHANGED
@@ -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
|
-
|
53
|
-
|
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.
|
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-
|
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
|
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.
|