apiql 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/apiql.gemspec +1 -1
  3. data/lib/apiql.rb +6 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 456ef97a233db53a9e51b2fe04e55c8e360e2f12077e745ac1527278a294dd50
4
- data.tar.gz: 79d50b2cf5b3bc79b3eeca1bed1b3d401a1a2fb76ef1cf5b4ac7ac1d9e3dbc05
3
+ metadata.gz: af9fa1cb96cd3d2e6d145267c14c58dcf8d8c7a1447cfe824744ec5eba0cad03
4
+ data.tar.gz: 7c24953bb0c44591e51e381c3e514726239187148c5ec0266beb189f3db1ec0b
5
5
  SHA512:
6
- metadata.gz: 96f51297e1bc429c789f3614deb3a959a2746fed188b2197cf6a92e31233dbb9f5d4e57815775f9c12478c17bee34673573ae32a508854ab1cd576ed16b9ab4d
7
- data.tar.gz: a2c0f57660d4be5f0ac9e76fa8814d038fa748dde5bd38f147a0fd3f7355aff15e161d853c0a21bfb0a02687adddad6359e2b448973f47f8bd2b34fe7a5e4c0f
6
+ metadata.gz: 70f020f58b6490b0d94b4b3f71f5c74bc4c432a3b19712e626058cf07c8235ae5f4f7001cd334b91f9ec41289af471bb6977987b8d72d283af62866978a83707
7
+ data.tar.gz: 27577d19ebb03273470d84ec35ca9a9b5248fe4e67647723a1f5d63ebc18a70a07a6e8ab22be1fa4e7944b0cac75e015bb32ceb8228c13f011b8d6a0d6f7ff63
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'apiql'
7
- spec.version = '0.4.5'
7
+ spec.version = '0.4.6'
8
8
  spec.authors = ['Dmitry Silchenko']
9
9
  spec.email = ['dmitry@desofto.com']
10
10
 
@@ -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 = nil
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?(:each) && data.respond_to?(:map)
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.5
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-08-28 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler