api-blocks 0.4.9 → 0.4.10
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.
- checksums.yaml +4 -4
- data/lib/api_blocks/responder.rb +8 -4
- data/lib/api_blocks/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 843bea891fd702377450792011768058f8a43285f736e9cb0bad420c58045e09
|
4
|
+
data.tar.gz: cd35fa0fe8ccd051c56305104c93947197b398967d755d6272d55a060e053de5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e292eb8cf9aa670003e623bcb92b23b210bd0b47278852a9bc8b515ba8bb9253da180c4f53ecaf9f36d3e3b9a0e9a4bfd7b3fe2ba69f15f0e75660e8597c871b
|
7
|
+
data.tar.gz: 7a448439cd7c1c9839fcd5b4cbd0206a313c76a0842363d0b23fdc6372d95bb2b0bd48eafba18054d477aa60f7d663eb8019850c24b22c4bc83b2156c1c0c13d
|
data/lib/api_blocks/responder.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "action_controller/responder"
|
4
|
+
require "responders"
|
5
|
+
require "dry/monads/result"
|
6
|
+
require "dry/validation/result"
|
7
7
|
|
8
8
|
# ApiBlocks::Responder provides a responder with better error handling and
|
9
9
|
# `ApiBlocks::Interactor` through `Dry::Monads::Result` support.
|
@@ -20,6 +20,10 @@ class ApiBlocks::Responder < ActionController::Responder
|
|
20
20
|
[{ errors: resource.errors.to_h }, :unprocessable_entity]
|
21
21
|
when ActiveRecord::RecordInvalid
|
22
22
|
[{ errors: resource.record.errors }, :unprocessable_entity]
|
23
|
+
when String
|
24
|
+
[{ detail: resource }, :internal_server_error]
|
25
|
+
when ProblemDetails::Document
|
26
|
+
[resource.to_h, resource.status]
|
23
27
|
when StandardError
|
24
28
|
# propagate the error so it can be handled through the standard rails
|
25
29
|
# error handlers.
|
data/lib/api_blocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul d'Hubert
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - '='
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.
|
215
|
+
version: 0.77.0
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - '='
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.
|
222
|
+
version: 0.77.0
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: yard
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|