grape-jsonapi-resources 0.0.1 → 0.0.2
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 +13 -1
- data/lib/grape-jsonapi-resources/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1482149e25e0b798ea671dd78d8ad46ecdbf45ab
|
4
|
+
data.tar.gz: fefd078234f23d2fd4a1ed432e8f9cd03f223753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19321fbb60946b17527c5aae964fec9f2e9ec4b7678ae6102e37532a02a35d213b083ee9826b200410728dfde178cb4cd0c3deb92ca9bc8822924877191a8d7
|
7
|
+
data.tar.gz: 093c57eb13304e1268ea845d7d73db392bbb47a9620ddd9aec2c4a780d215bc602c3f6018fd49f2b3960b2d3af9606d673d1ab16f73498f9fc3f64349b6a97ae
|
@@ -17,7 +17,19 @@ module Grape
|
|
17
17
|
context.merge!(jsonapi_options.delete(:context)) if jsonapi_options[:context]
|
18
18
|
|
19
19
|
resource_class = resource_class_for(resource)
|
20
|
-
|
20
|
+
|
21
|
+
unless resource_class
|
22
|
+
# Return blank object
|
23
|
+
blank_return = {}
|
24
|
+
if resource.is_a?(Array)
|
25
|
+
blank_return[:data] = []
|
26
|
+
else
|
27
|
+
blank_return[:data] = {}
|
28
|
+
end
|
29
|
+
blank_return[:meta] = jsonapi_options[:meta] if jsonapi_options[:meta]
|
30
|
+
return blank_return.to_json
|
31
|
+
end
|
32
|
+
|
21
33
|
resource_instances = nil
|
22
34
|
if resource.respond_to?(:to_ary)
|
23
35
|
resource_instances = resource.to_ary.collect do |each_resource|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-jsonapi-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cary Dunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.4.5
|
148
|
+
rubygems_version: 2.4.5.1
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Use jsonapi-resources in grape
|