elocal_api_support 0.1.5 → 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 647e718d434d57645ffe02fb1c31147e0f67cae6
|
4
|
+
data.tar.gz: f96f4d3d65aa353deb8b4361aef685f628de993d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff18b48e210a10b526eabd67cb2a47690e4683dc562ff7d4ed7a42389d8a3f054c412681512d6313f28eb0e8bd82262f13efd1277f9d3bca7440e7cec15562fb
|
7
|
+
data.tar.gz: f21ca084f3a357b78f86317794f50aa8eceae46cbbcc967afe33c6d43368a14394088d54fc7682ca17804f479131835afe417baec715801370d95de95f356f6d
|
@@ -10,6 +10,10 @@ module ElocalApiSupport
|
|
10
10
|
|
11
11
|
protected
|
12
12
|
|
13
|
+
def require_pagination?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
13
17
|
# Her library likes to paginate with headers,
|
14
18
|
# ActiveResource cannot handle headers.
|
15
19
|
# So awesomely, two implementations. To use the "Her" implementation with headers
|
@@ -50,7 +54,7 @@ module ElocalApiSupport
|
|
50
54
|
end
|
51
55
|
|
52
56
|
def paginated_request?
|
53
|
-
params[:page].present? || params[:per_page].present?
|
57
|
+
require_pagination? || params[:page].present? || params[:per_page].present?
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
@@ -16,7 +16,7 @@ module ElocalApiSupport::ModelFromParams
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def with_pagination(rel)
|
19
|
-
if
|
19
|
+
if paginated_request?
|
20
20
|
rel.page(current_page).per(per_page)
|
21
21
|
else
|
22
22
|
rel.page(current_page).limit(false)
|
@@ -56,8 +56,12 @@ module ElocalApiSupport::ModelFromParams
|
|
56
56
|
rel
|
57
57
|
end
|
58
58
|
|
59
|
+
def default_per_page
|
60
|
+
500
|
61
|
+
end
|
62
|
+
|
59
63
|
def per_page
|
60
|
-
@per_page ||= (params[:per_page] ||
|
64
|
+
@per_page ||= (params[:per_page] || default_per_page).to_i
|
61
65
|
end
|
62
66
|
|
63
67
|
def current_page
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elocal_api_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Di Marco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|