dry_serialization 0.4.1 → 0.4.3.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a7bb2bd8ce76221bceba243095ecbb4f7d05b290714fa0ff12e2d75448552f
|
4
|
+
data.tar.gz: 631820be97d5ed577abdd347724ac6e977c26f9fc2003dbe163c94ee44579707
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5f9bd45173f5c1ce498de0ff57c8029997896b2b76ee2c4126938a9cca1b6b880fbf8e136bfff5d3af6a13b532089554d95bb85abbbab9efa422e68fc7fc756
|
7
|
+
data.tar.gz: a024336f7ec12f731f2a11623af105865da5d8ee46a231c488a605b25e169fbf696647ee756786c0935906644b6ae743f01fe3a321e5a2c12cfc16cd392e89ef
|
@@ -2,21 +2,22 @@ module DrySerialization
|
|
2
2
|
module Concerns
|
3
3
|
module SerializationHelper
|
4
4
|
def success_response(data = {}, status = :ok)
|
5
|
-
|
6
|
-
render json: default_response
|
5
|
+
render json: data, status: status
|
7
6
|
end
|
8
|
-
|
7
|
+
|
9
8
|
def error_response(errors, status = :unprocessable_entity)
|
10
9
|
errors = [errors] unless errors.is_a?(Array)
|
11
|
-
errors =
|
12
|
-
|
13
|
-
|
14
|
-
render json: default_response
|
10
|
+
errors = handle_errors(errors)
|
11
|
+
|
12
|
+
render json: { errors: errors }, status: status
|
15
13
|
end
|
16
14
|
|
17
|
-
|
18
|
-
|
15
|
+
private
|
16
|
+
|
17
|
+
def handle_errors(errors)
|
18
|
+
errors.each_with_object([]) { |error, acc| acc << { detail: error } }
|
19
19
|
end
|
20
|
+
|
20
21
|
end
|
21
22
|
end
|
22
|
-
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry_serialization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Heft
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|