json_api_toolbox 0.17.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: 3ad7345c4b37202ed05ab044fd99d6bfcd8e6e47
4
- data.tar.gz: b742d7b754794c1ff35f586851562930cc8e068c
3
+ metadata.gz: d86adcef9e00a063dd8fbc2f4931f97617944048
4
+ data.tar.gz: 21c6fffd1922e785c24c2c9c5c5ebd9de8f2a85c
5
5
  SHA512:
6
- metadata.gz: 94985f43e75243383ef8e5a4e76f3187383a6a52079c005bba484c31df492b256ede3e6e48efae0df2c36bae76890b6d91fb4a29ef1b1cc9ea5534ec7a1aafc4
7
- data.tar.gz: c782dffcd059fa36a99e4f1e49ec9af3182a9f642cd34769e76aa4421c556f37167efcaa860f3c860ad488f60ff93f89e4e588d417589cc59dc28f2c7650588a
6
+ metadata.gz: 4405d86a77ddd9e18efb4168f8b93eef4a920119782700cc14c2e2d9bd501861f5339176b261afd0dc389f2b9abe947b21aeef79403dc6b1719e563878128ff4
7
+ data.tar.gz: e82e752c41c23a8fb914f2eae069e145fb84f522968e290ad5abb029f9839ecb5ffc3d51ef6fa2c2f372c1771a118899b22404b753df92a92ea83f34bc73b8a9
@@ -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
- ## [Unreleased]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonApiToolbox
4
- VERSION = '0.17.0'
4
+ VERSION = '1.0.0'
5
5
  end
@@ -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({ jsonapi_errors: object.errors }.merge(options))
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
@@ -25,7 +25,7 @@ module JsonApiToolbox
25
25
  source: {} },
26
26
  jsonapi_class: {
27
27
  class: { Hash: JsonApiToolbox::Serializables::SerializableException }
28
- } }
28
+ }, status: :internal_server_error }
29
29
  end
30
30
 
31
31
  def puts_build_log_error(error)
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.17.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: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack