json_api_toolbox 0.17.0 → 1.0.0
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/CHANGELOG.md +6 -1
- data/lib/json_api_toolbox/version.rb +1 -1
- data/lib/renderizable.rb +8 -1
- data/lib/renderizable_exceptions.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d86adcef9e00a063dd8fbc2f4931f97617944048
|
4
|
+
data.tar.gz: 21c6fffd1922e785c24c2c9c5c5ebd9de8f2a85c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4405d86a77ddd9e18efb4168f8b93eef4a920119782700cc14c2e2d9bd501861f5339176b261afd0dc389f2b9abe947b21aeef79403dc6b1719e563878128ff4
|
7
|
+
data.tar.gz: e82e752c41c23a8fb914f2eae069e145fb84f522968e290ad5abb029f9839ecb5ffc3d51ef6fa2c2f372c1771a118899b22404b753df92a92ea83f34bc73b8a9
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## [Released]
|
8
|
+
|
9
|
+
## [1.0.0] - 2019-05-13
|
10
|
+
### Added
|
11
|
+
- Added status internal_server_error on exception renderizable
|
12
|
+
- Added status unprocessable_entity on renderizable when object have errors
|
8
13
|
|
9
14
|
## [0.17.0] - 2018-08-14
|
10
15
|
### Added
|
data/lib/renderizable.rb
CHANGED
@@ -4,7 +4,7 @@ module JsonApiToolbox
|
|
4
4
|
module Renderizable
|
5
5
|
def render_object(object, options = {})
|
6
6
|
if object.respond_to?(:errors) && object.errors.any?
|
7
|
-
render(
|
7
|
+
render(build_error_options(object, options))
|
8
8
|
else
|
9
9
|
renderization = { jsonapi: object,
|
10
10
|
include: includes_params,
|
@@ -80,5 +80,12 @@ module JsonApiToolbox
|
|
80
80
|
{}
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
def build_error_options(object, options)
|
85
|
+
if options[:status].blank?
|
86
|
+
options = options.merge(status: :unprocessable_entity)
|
87
|
+
end
|
88
|
+
{ jsonapi_errors: object.errors }.merge(options)
|
89
|
+
end
|
83
90
|
end
|
84
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adriano Bacha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|