apiql 0.3.3 → 0.3.4
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 +18 -15
- 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: da237b810c30af8f312652d463e5a4ba2ee980653052a74e0533ee46cba32ebd
|
4
|
+
data.tar.gz: 110df82b41b3cd9a670ce414c40fa61d8e872fc9067d25e2949f030fa746ded2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a25bbf772de28b18c1bc8d16e4e4bcddcb2feadbbe8a2218a8a6d526745a47ea71f12de7f383da317de68e880d01e25258aaf899a7b4c34b31a147ede70a85
|
7
|
+
data.tar.gz: 2b5a81697b13a95e2030d101d4c126af165c5422f4dffee8bc867098f37e0521f934d26adffc8bac8f20068c3a345b8584accacedd01847a38fcda8a86a537eb
|
data/apiql.gemspec
CHANGED
data/lib/apiql.rb
CHANGED
@@ -246,7 +246,6 @@ class APIQL
|
|
246
246
|
names = field.split('.')
|
247
247
|
if names.count > 1
|
248
248
|
o = nil
|
249
|
-
|
250
249
|
names.each do |field|
|
251
250
|
if o.present?
|
252
251
|
if o.respond_to? field
|
@@ -301,19 +300,7 @@ class APIQL
|
|
301
300
|
end
|
302
301
|
|
303
302
|
if data.is_a?(Hash) && schema.present?
|
304
|
-
|
305
|
-
|
306
|
-
schema.each do |field|
|
307
|
-
if field.is_a? Hash
|
308
|
-
field.each do |field, sub_schema|
|
309
|
-
respond[field] = render_value(data[field.to_sym], sub_schema)
|
310
|
-
end
|
311
|
-
else
|
312
|
-
respond[field] = render_value(data[field.to_sym])
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
respond
|
303
|
+
HashEntity.new(data, @context).render(schema)
|
317
304
|
else
|
318
305
|
render_value(data, schema)
|
319
306
|
end
|
@@ -330,7 +317,23 @@ class APIQL
|
|
330
317
|
|
331
318
|
class HashEntity < Entity
|
332
319
|
def get_field(field, params = nil)
|
333
|
-
|
320
|
+
o = nil
|
321
|
+
|
322
|
+
field.split('.').each do |name|
|
323
|
+
if o.present?
|
324
|
+
if o.respond_to? name
|
325
|
+
o = o.public_send(name)
|
326
|
+
else
|
327
|
+
o = nil
|
328
|
+
break
|
329
|
+
end
|
330
|
+
else
|
331
|
+
o = object[name.to_sym]
|
332
|
+
break unless o.present?
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
o
|
334
337
|
end
|
335
338
|
end
|
336
339
|
|
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.3.
|
4
|
+
version: 0.3.4
|
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-07-
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|