dry_serialization 0.3.1 → 0.4.3.1
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: 1c9d8e673079e48d49d858e5b8c951a85be6c6307e364635f6b95728bdb4eab8
|
4
|
+
data.tar.gz: e277c09f5bab9d9ecf1f5f52a6c8c386e1f075663b88d7ab55fad48742e2353b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9e73c35976f275645dedd95364844ad2a5cff7b5a9a62e4e5c27b20bacb9cb3404cc105c1e96d6c08c7b48a34b96b001de62c5e7b8b61086061efc662d46a78
|
7
|
+
data.tar.gz: 445d722bd9618fccac0eb9a6cf7d082287831bc8881a18a29570f0cde980c5fae9c729bfde8470e7694298e26dd65c26ced71bb9ac5b715f4b89053186bca75c
|
data/lib/dry_serialization.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module DrySerialization
|
2
|
+
module Concerns
|
3
|
+
module SerializationHelper
|
4
|
+
def success_response(data = {}, status = :ok)
|
5
|
+
render json: data, status: status
|
6
|
+
end
|
7
|
+
|
8
|
+
def error_response(errors, status = :unprocessable_entity)
|
9
|
+
errors = [errors] unless errors.is_a?(Array)
|
10
|
+
errors = handle_errors(errors)
|
11
|
+
|
12
|
+
render json: { errors: errors }, status: status
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def handle_errors(*errors)
|
18
|
+
errors.each_with_object([]) { |error, acc| acc << { detail: error } }
|
19
|
+
end
|
20
|
+
|
21
|
+
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.3.1
|
4
|
+
version: 0.4.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Heft
|
8
|
-
autorequire:
|
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
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description:
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- mikeheft@gmail.com
|
156
156
|
executables: []
|
@@ -162,17 +162,18 @@ files:
|
|
162
162
|
- dry_serialization.gemspec
|
163
163
|
- lib/dry_serialization.rb
|
164
164
|
- lib/dry_serialization/blueprinter.rb
|
165
|
+
- lib/dry_serialization/concerns/serialization_helper.rb
|
165
166
|
- lib/dry_serialization/fast_jsonapi.rb
|
166
167
|
- lib/dry_serialization/version.rb
|
167
168
|
- lib/generators/base_generator.rb
|
168
169
|
- lib/generators/dry_serialization/blueprinter/install_generator.rb
|
169
170
|
- lib/generators/dry_serialization/fast_jsonapi/install_generator.rb
|
170
171
|
- lib/generators/templates/api_controller.rb
|
171
|
-
homepage:
|
172
|
+
homepage:
|
172
173
|
licenses:
|
173
174
|
- MIT
|
174
175
|
metadata: {}
|
175
|
-
post_install_message:
|
176
|
+
post_install_message:
|
176
177
|
rdoc_options: []
|
177
178
|
require_paths:
|
178
179
|
- lib
|
@@ -187,8 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
188
|
- !ruby/object:Gem::Version
|
188
189
|
version: '0'
|
189
190
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
191
|
-
signing_key:
|
191
|
+
rubygems_version: 3.1.2
|
192
|
+
signing_key:
|
192
193
|
specification_version: 4
|
193
194
|
summary: Drys up serialized returns by passing in object, serializer, and an options
|
194
195
|
hash
|