apiql 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apiql.gemspec +1 -1
- data/lib/apiql.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af9fa1cb96cd3d2e6d145267c14c58dcf8d8c7a1447cfe824744ec5eba0cad03
|
4
|
+
data.tar.gz: 7c24953bb0c44591e51e381c3e514726239187148c5ec0266beb189f3db1ec0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70f020f58b6490b0d94b4b3f71f5c74bc4c432a3b19712e626058cf07c8235ae5f4f7001cd334b91f9ec41289af471bb6977987b8d72d283af62866978a83707
|
7
|
+
data.tar.gz: 27577d19ebb03273470d84ec35ca9a9b5248fe4e67647723a1f5d63ebc18a70a07a6e8ab22be1fa4e7944b0cac75e015bb32ceb8228c13f011b8d6a0d6f7ff63
|
data/apiql.gemspec
CHANGED
data/lib/apiql.rb
CHANGED
@@ -22,15 +22,15 @@ class APIQL
|
|
22
22
|
if page.present?
|
23
23
|
{
|
24
24
|
total: klass.count,
|
25
|
-
items: klass.offset(page * page_size).limit(page_size)
|
25
|
+
items: klass.eager_load(eager_load).offset(page * page_size).limit(page_size)
|
26
26
|
}
|
27
27
|
else
|
28
|
-
klass.all
|
28
|
+
klass.eager_load(eager_load).all
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
define_method "#{klass.name.underscore}" do |id|
|
33
|
-
item = klass.find(id)
|
33
|
+
item = klass.eager_load(eager_load).find(id)
|
34
34
|
|
35
35
|
authorize! :read, item
|
36
36
|
|
@@ -244,7 +244,7 @@ class APIQL
|
|
244
244
|
def eager_load
|
245
245
|
result = @eager_load
|
246
246
|
|
247
|
-
@eager_load =
|
247
|
+
@eager_load = []
|
248
248
|
|
249
249
|
result
|
250
250
|
end
|
@@ -265,7 +265,7 @@ class APIQL
|
|
265
265
|
@eager_load = APIQL::eager_loads(sub_schema)
|
266
266
|
data = public_send(function, *params)
|
267
267
|
if @eager_load.present? && !data.is_a?(::Hash) && !data.is_a?(::Array)
|
268
|
-
if data.respond_to?(:
|
268
|
+
if data.respond_to?(:eager_load)
|
269
269
|
data = data.eager_load(eager_load)
|
270
270
|
elsif data.respond_to?(:id)
|
271
271
|
data = data.class.eager_load(eager_load).find(data.id)
|
@@ -288,7 +288,7 @@ class APIQL
|
|
288
288
|
function = reg[:name]
|
289
289
|
params = @context.parse_params(reg[:params].presence)
|
290
290
|
|
291
|
-
@eager_load =
|
291
|
+
@eager_load = []
|
292
292
|
data = public_send(function, *params)
|
293
293
|
if data.is_a? Array
|
294
294
|
if data.any? { |item| !APIQL::simple_class?(item) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Silchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|