js-client-bridge 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,9 +32,9 @@ module JsClientBridge #:nodoc:
|
|
32
32
|
def format_response(response, formatting_options = {})
|
33
33
|
# Handle JSONP responses
|
34
34
|
if formatting_options[:jsonp].blank?
|
35
|
-
response
|
35
|
+
JSON.generate(response)
|
36
36
|
else
|
37
|
-
"#{formatting_options[:jsonp]}(#{response
|
37
|
+
"#{formatting_options[:jsonp]}(#{JSON.generate(response)})"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -20,7 +20,6 @@ module JsClientBridge #:nodoc:
|
|
20
20
|
# Generate our response hash and add the exceptions parameter
|
21
21
|
response = if options.include?(:message)
|
22
22
|
options.merge( validation_errors_to_hash(obj, options.delete(:message)) )
|
23
|
-
|
24
23
|
else
|
25
24
|
options.merge( validation_errors_to_hash(obj) )
|
26
25
|
end
|
@@ -35,13 +34,13 @@ module JsClientBridge #:nodoc:
|
|
35
34
|
|
36
35
|
validation = {
|
37
36
|
:_status => 'validation',
|
38
|
-
:_type => data_object.class,
|
37
|
+
:_type => data_object.class.to_s,
|
39
38
|
:_short_type => short_type,
|
40
39
|
:_message => message,
|
41
40
|
:validation => data_object.errors.to_hash,
|
42
41
|
}
|
43
42
|
|
44
|
-
validation[:id] = data_object.id.to_s unless data_object.
|
43
|
+
validation[:id] = data_object.id.to_s unless data_object.new?
|
45
44
|
|
46
45
|
validation
|
47
46
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-client-bridge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rolly Fordham
|