json_api_toolbox 0.11.2 → 0.12.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 +4 -0
- data/json_api_toolbox.gemspec +1 -0
- data/lib/json_api_toolbox.rb +2 -0
- data/lib/json_api_toolbox/serializables/serializable_exception.rb +11 -0
- data/lib/json_api_toolbox/version.rb +1 -1
- data/lib/renderizable_exceptions.rb +27 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c07167e784b4b56414110ef63def3aac9c666bd
|
4
|
+
data.tar.gz: aa95ca274f2c296572908fbf11589e3c3d54ba97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61b9beec0e83c9bd2fdda9f3c0228f9fd5a755d2078d72b8efdaab8fa5390cc77901116fcbb7d5961b33df038c0ea86e7fe2b24b6e6de450721cf08b865da5ec
|
7
|
+
data.tar.gz: a267387af4d2e225e9233133605b6eafd9fa419db0cba7882f56471b2aec38f33f3530238ac20a7134721e80c52f1aee95f97e14c8b89ca347ab65aaa58d2b58
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.12.0] - 2018-04-03
|
10
|
+
### Added
|
11
|
+
- Added JsonApi default exception renderizable
|
12
|
+
|
9
13
|
## [0.11.2] - 2018-03-14
|
10
14
|
### Fixed
|
11
15
|
- Fixed rspec dependency
|
data/json_api_toolbox.gemspec
CHANGED
data/lib/json_api_toolbox.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'active_support/inflector'
|
4
4
|
require 'renderizable'
|
5
|
+
require 'renderizable_exceptions'
|
5
6
|
require 'enums'
|
6
7
|
require 'postable'
|
7
8
|
require 'service'
|
@@ -12,5 +13,6 @@ require_relative 'json_api_toolbox/spec_support/shared_examples_for_controllers'
|
|
12
13
|
require_relative 'json_api_toolbox/serializables/serializable_enum_option'
|
13
14
|
require_relative 'json_api_toolbox/serializables/serializable_job'
|
14
15
|
require_relative 'json_api_toolbox/serializables/serializable_version'
|
16
|
+
require_relative 'json_api_toolbox/serializables/serializable_exception'
|
15
17
|
|
16
18
|
module JsonApiToolbox; end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JsonApiToolbox
|
4
|
+
module Serializables
|
5
|
+
class SerializableException < JSONAPI::Serializable::Resource
|
6
|
+
attribute(:title) { @object[:title] }
|
7
|
+
attribute(:detail) { @object[:detail] }
|
8
|
+
attribute(:source) { @object[:source] }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
require 'pry'
|
5
|
+
|
6
|
+
module JsonApiToolbox
|
7
|
+
module RenderizableExceptions
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
rescue_from Exception, with: :render_any_exception
|
12
|
+
end
|
13
|
+
|
14
|
+
def render_any_exception(exception)
|
15
|
+
render(
|
16
|
+
jsonapi_errors: {
|
17
|
+
title: exception.class.to_s,
|
18
|
+
detail: exception.message,
|
19
|
+
source: {}
|
20
|
+
},
|
21
|
+
jsonapi_class: {
|
22
|
+
class: { Hash: JsonApiToolbox::Serializables::SerializableException }
|
23
|
+
}
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
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: 0.12.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-03
|
11
|
+
date: 2018-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -206,6 +206,20 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: shoulda-matchers
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '3.1'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '3.1'
|
209
223
|
description:
|
210
224
|
email:
|
211
225
|
- abacha@gmail.com
|
@@ -227,12 +241,14 @@ files:
|
|
227
241
|
- lib/json_api_toolbox.rb
|
228
242
|
- lib/json_api_toolbox/paginable.rb
|
229
243
|
- lib/json_api_toolbox/serializables/serializable_enum_option.rb
|
244
|
+
- lib/json_api_toolbox/serializables/serializable_exception.rb
|
230
245
|
- lib/json_api_toolbox/serializables/serializable_job.rb
|
231
246
|
- lib/json_api_toolbox/serializables/serializable_version.rb
|
232
247
|
- lib/json_api_toolbox/spec_support/shared_examples_for_controllers.rb
|
233
248
|
- lib/json_api_toolbox/version.rb
|
234
249
|
- lib/postable.rb
|
235
250
|
- lib/renderizable.rb
|
251
|
+
- lib/renderizable_exceptions.rb
|
236
252
|
- lib/service.rb
|
237
253
|
homepage: http://bitbucket.org/guideinvestimentos/json_api_toolbox
|
238
254
|
licenses: []
|