dry_serialization 0.4.2 → 0.4.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: d459a861acc9de313bcab71122b336f30d34666a3411400e4cb54bea9183fbf3
4
- data.tar.gz: 2a81afbac8b773d22afb9bd0707472a08404e35d482ee6e495442f4ae4fa7982
3
+ metadata.gz: 90a445b57058169cbfcbc1320111c29db630285f4cdb2b2d8677dc6bf40efdd4
4
+ data.tar.gz: f96c09045f95e6b9d28bbc08a8c6ffc79f1c9026301c85e062fb97fcd0b5bbbd
5
5
  SHA512:
6
- metadata.gz: 4d40cd9fd0eed6bfa27bbd405db14839215d456b6c5d32712338c8947be74fabb6e9c6ec92c4a45dce44aee0e5934aa3788aec4463067fe233f4cde53ce29a72
7
- data.tar.gz: c048532d1db6519248e62c4923f6528c977e55a2c4cfd0c1a4f6469c3d21ecdfb5158351806cc2431b059e1ef5f40d3f0cf58a70f7d13521867ca89ffc2089b1
6
+ metadata.gz: cb606bc1c012bbb4d0963cfc5df3ed4997da217bb8c7e49264261b89db7853f0811cafef908a8d2b61acb29d3e6bba568b504d11b217ac92d0999d1f5c2b8da0
7
+ data.tar.gz: 970b00e53f7306ef07f5ec563499c8de15a83d7feee525dec520531be0b125ec474b782c32785f5378a90e56bfdbe437a66eba88a26bd3b8389e5a3ff9f7e0f0
@@ -7,10 +7,16 @@ module DrySerialization
7
7
 
8
8
  def error_response(errors, status = :unprocessable_entity)
9
9
  errors = [errors] unless errors.is_a?(Array)
10
- errors = { errors: errors }
10
+ errors = handle_errors(errors)
11
11
 
12
12
  render json: errors, status: status
13
13
  end
14
+
15
+ private
16
+
17
+ def handle_errors(*errors)
18
+ errors.each_with_object([]) { |error, acc| acc << { detail: error } }
19
+ end
14
20
 
15
21
  end
16
22
  end
@@ -1,3 +1,3 @@
1
1
  module DrySerialization
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  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.2
4
+ version: 0.4.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-09-24 00:00:00.000000000 Z
11
+ date: 2020-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler