grape-jsonapi-resources 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grape-jsonapi-resources/formatter.rb +12 -8
- data/lib/grape-jsonapi-resources/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58e000f1c8e32f6e080eb2f7585b57d76dfd8b97
|
4
|
+
data.tar.gz: 098060f3d2a658ab7659de650643faac924f5232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2ed58657a2bfb25229afff893f36cc65188ad7ef9c9ac077ebdf16c0a934c133caa06967d65429762a43f0d0e1c4450f86ce93f28a4c0a14f9e3da5caf7e0c1
|
7
|
+
data.tar.gz: 0b6ba3bdef1be2093f85e66c30f23903230290d9eba55870d5bf2b84851adc86b69a3b5d40b87b8e203bf7398bfbdad7efd8bc1c3b13df3f9630245cd417be5a
|
@@ -18,16 +18,20 @@ module Grape
|
|
18
18
|
|
19
19
|
resource_class = resource_class_for(resource)
|
20
20
|
|
21
|
-
if resource_class.nil?
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
if resource_class.nil?
|
22
|
+
if resource.blank?
|
23
|
+
# Return blank object
|
24
|
+
blank_return = {}
|
25
|
+
if resource.is_a?(Array)
|
26
|
+
blank_return[:data] = []
|
27
|
+
else
|
28
|
+
blank_return[:data] = {}
|
29
|
+
end
|
30
|
+
blank_return[:meta] = jsonapi_options[:meta] if jsonapi_options[:meta]
|
31
|
+
return blank_return.to_json
|
26
32
|
else
|
27
|
-
|
33
|
+
return nil
|
28
34
|
end
|
29
|
-
blank_return[:meta] = jsonapi_options[:meta] if jsonapi_options[:meta]
|
30
|
-
return blank_return.to_json
|
31
35
|
end
|
32
36
|
|
33
37
|
resource_instances = nil
|