json_api_toolbox 2.1.0 → 3.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
  SHA256:
3
- metadata.gz: 57d15d5fd3e2fd4747a2606e83d3f38f8a1991dac1ce62bfa9dd9ccc45e27f94
4
- data.tar.gz: ecbb101680a6767f7d83238a6e0500ef67ac4addbebc6500c9881172678b7d1e
3
+ metadata.gz: d9c03a1afc1da78c6af3a8d92549ccee5cb1901eb996ee87a54d9fe918c5d313
4
+ data.tar.gz: cb6e51096559d9ad400cd4e3cd02a59f9a79afac1af504f91b283e26bb2cc456
5
5
  SHA512:
6
- metadata.gz: 76bee9fcd248fd05746574fbcc763bfe83150c4822574ea3238c068613c712a09eb11c8d46426e2b8f4f43a5475642aedc6a2f2ea893108a954a4bddf1b63f14
7
- data.tar.gz: 365556a551fb49c8050a78c106df2d7c5e1d02eee6e9c289f8ea0abe3f16c150902505a67be7ebfe86a3d7d942b7dc7922e7e8418d3c63fcc3757ac5055fdf18
6
+ metadata.gz: ad46e9d5e2a669d6471c7a8013afe86e13beae98867d0962e77eb3f89411de192b072266af5d455de695edf8ca5e621e9283dc40c67fded2fe55a3a2d66420f8
7
+ data.tar.gz: cf72e98693263a8a9b587443ec29fe0a0a7dad9a4ce4ba39a666e50993f255e4c09c24a72109c45480d0d87a3279ac31130e6f90a5d3594bb8b04641b0e54b32
data/.rubocop.yml CHANGED
@@ -2,5 +2,5 @@ inherit_from:
2
2
  - '.rubocop.base.yml'
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
5
+ TargetRubyVersion: 3.0
6
6
  SuggestExtensions: false
data/.version CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 3.0.0
data/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.0.0] - 2024-06-04
10
+ ### Changed
11
+ - Atualiza imagem do ruby de 2.6 para 3.0
12
+ - Adiciona elastic-apm no renderizable exceptions
13
+
14
+ ### Added
15
+ - Adiciona gem elastic-apm
16
+
17
+ ### Removed
18
+ - Rake task: rake lint-and-test
19
+
9
20
  ## [2.1.0] - 2022-11-09
10
21
  ### Changed
11
22
  - Permite seja via parametro, seja via ENV alterar o timeout do RestClient
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json_api_toolbox (2.1.0)
4
+ json_api_toolbox (3.0.0)
5
5
  activerecord (>= 5.1.0)
6
6
  activesupport (>= 5.1.0)
7
+ elastic-apm
7
8
  json-api-vanilla
8
9
  jsonapi-serializable
9
10
  log_toolbox
@@ -73,33 +74,54 @@ GEM
73
74
  minitest (>= 5.1)
74
75
  tzinfo (~> 2.0)
75
76
  zeitwerk (~> 2.3)
77
+ addressable (2.8.6)
78
+ public_suffix (>= 2.0.2, < 6.0)
76
79
  ast (2.4.2)
80
+ base64 (0.2.0)
77
81
  builder (3.2.4)
78
82
  byebug (11.1.3)
79
83
  coderay (1.1.3)
80
84
  concurrent-ruby (1.1.9)
81
85
  crass (1.0.6)
86
+ date (3.3.4)
82
87
  diff-lcs (1.4.4)
83
- domain_name (0.5.20190701)
84
- unf (>= 0.0.5, < 1.0.0)
85
- erubi (1.11.0)
86
- globalid (1.0.0)
87
- activesupport (>= 5.0)
88
+ domain_name (0.6.20240107)
89
+ elastic-apm (4.7.3)
90
+ concurrent-ruby (~> 1.0)
91
+ http (>= 3.0)
92
+ ruby2_keywords
93
+ erubi (1.12.0)
94
+ ffi (1.17.0)
95
+ ffi-compiler (1.3.2)
96
+ ffi (>= 1.15.5)
97
+ rake
98
+ globalid (1.2.1)
99
+ activesupport (>= 6.1)
100
+ http (5.2.0)
101
+ addressable (~> 2.8)
102
+ base64 (~> 0.1)
103
+ http-cookie (~> 1.0)
104
+ http-form_data (~> 2.2)
105
+ llhttp-ffi (~> 0.5.0)
88
106
  http-accept (1.7.0)
89
- http-cookie (1.0.5)
107
+ http-cookie (1.0.6)
90
108
  domain_name (~> 0.5)
109
+ http-form_data (2.3.0)
91
110
  i18n (1.8.10)
92
111
  concurrent-ruby (~> 1.0)
93
112
  json-api-vanilla (1.0.4)
94
113
  jsonapi-renderer (0.2.2)
95
114
  jsonapi-serializable (0.3.1)
96
115
  jsonapi-renderer (~> 0.2.0)
116
+ llhttp-ffi (0.5.0)
117
+ ffi-compiler (~> 1.0)
118
+ rake (~> 13.0)
97
119
  log_toolbox (1.3.11)
98
120
  lograge (>= 0.11.1)
99
121
  logstash-event (>= 1.2.02)
100
122
  logstash-logger (>= 0.26.1)
101
123
  rails (>= 5.0)
102
- lograge (0.12.0)
124
+ lograge (0.14.0)
103
125
  actionpack (>= 4)
104
126
  activesupport (>= 4)
105
127
  railties (>= 4)
@@ -107,23 +129,33 @@ GEM
107
129
  logstash-event (1.2.02)
108
130
  logstash-logger (0.26.1)
109
131
  logstash-event (~> 1.2)
110
- loofah (2.19.0)
132
+ loofah (2.22.0)
111
133
  crass (~> 1.0.2)
112
- nokogiri (>= 1.5.9)
113
- mail (2.7.1)
134
+ nokogiri (>= 1.12.0)
135
+ mail (2.8.1)
114
136
  mini_mime (>= 0.1.1)
115
- marcel (1.0.2)
137
+ net-imap
138
+ net-pop
139
+ net-smtp
140
+ marcel (1.0.4)
116
141
  method_source (1.0.0)
117
- mime-types (3.4.1)
142
+ mime-types (3.5.2)
118
143
  mime-types-data (~> 3.2015)
119
- mime-types-data (3.2022.0105)
120
- mini_mime (1.1.2)
144
+ mime-types-data (3.2024.0507)
145
+ mini_mime (1.1.5)
121
146
  minitest (5.14.4)
147
+ net-imap (0.4.12)
148
+ date
149
+ net-protocol
150
+ net-pop (0.1.2)
151
+ net-protocol
152
+ net-protocol (0.2.2)
153
+ timeout
154
+ net-smtp (0.5.0)
155
+ net-protocol
122
156
  netrc (0.11.0)
123
- nio4r (2.5.8)
124
- nokogiri (1.13.9-x86_64-darwin)
125
- racc (~> 1.4)
126
- nokogiri (1.13.9-x86_64-linux)
157
+ nio4r (2.7.3)
158
+ nokogiri (1.16.5-x86_64-linux)
127
159
  racc (~> 1.4)
128
160
  parallel (1.20.1)
129
161
  parser (3.0.2.0)
@@ -134,9 +166,10 @@ GEM
134
166
  pry-byebug (3.9.0)
135
167
  byebug (~> 11.0)
136
168
  pry (~> 0.13.0)
137
- racc (1.6.0)
138
- rack (2.2.4)
139
- rack-test (2.0.2)
169
+ public_suffix (5.0.5)
170
+ racc (1.8.0)
171
+ rack (2.2.9)
172
+ rack-test (2.1.0)
140
173
  rack (>= 1.3)
141
174
  rails (6.1.4)
142
175
  actioncable (= 6.1.4)
@@ -153,11 +186,13 @@ GEM
153
186
  bundler (>= 1.15.0)
154
187
  railties (= 6.1.4)
155
188
  sprockets-rails (>= 2.0.0)
156
- rails-dom-testing (2.0.3)
157
- activesupport (>= 4.2.0)
189
+ rails-dom-testing (2.2.0)
190
+ activesupport (>= 5.0.0)
191
+ minitest
158
192
  nokogiri (>= 1.6)
159
- rails-html-sanitizer (1.4.3)
160
- loofah (~> 2.3)
193
+ rails-html-sanitizer (1.6.0)
194
+ loofah (~> 2.21)
195
+ nokogiri (~> 1.14)
161
196
  railties (6.1.4)
162
197
  actionpack (= 6.1.4)
163
198
  activesupport (= 6.1.4)
@@ -167,7 +202,7 @@ GEM
167
202
  rainbow (3.0.0)
168
203
  rake (13.0.6)
169
204
  regexp_parser (2.1.1)
170
- request_store (1.5.1)
205
+ request_store (1.7.0)
171
206
  rack (>= 1.4)
172
207
  rest-client (2.1.0)
173
208
  http-accept (>= 1.7.0, < 2.0)
@@ -200,26 +235,25 @@ GEM
200
235
  rubocop-ast (1.10.0)
201
236
  parser (>= 3.0.1.1)
202
237
  ruby-progressbar (1.11.0)
238
+ ruby2_keywords (0.0.5)
203
239
  shoulda-matchers (5.0.0)
204
240
  activesupport (>= 5.2.0)
205
- sprockets (4.1.1)
241
+ sprockets (4.2.1)
206
242
  concurrent-ruby (~> 1.0)
207
- rack (> 1, < 3)
243
+ rack (>= 2.2.4, < 4)
208
244
  sprockets-rails (3.4.2)
209
245
  actionpack (>= 5.2)
210
246
  activesupport (>= 5.2)
211
247
  sprockets (>= 3.0.0)
212
- thor (1.2.1)
248
+ thor (1.3.1)
249
+ timeout (0.4.1)
213
250
  tzinfo (2.0.4)
214
251
  concurrent-ruby (~> 1.0)
215
- unf (0.1.4)
216
- unf_ext
217
- unf_ext (0.0.8.2)
218
252
  unicode-display_width (2.0.0)
219
- websocket-driver (0.7.5)
253
+ websocket-driver (0.7.6)
220
254
  websocket-extensions (>= 0.1.0)
221
255
  websocket-extensions (0.1.5)
222
- will_paginate (3.3.1)
256
+ will_paginate (4.0.0)
223
257
  zeitwerk (2.4.2)
224
258
 
225
259
  PLATFORMS
data/Rakefile CHANGED
@@ -1,11 +1,3 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  require "rubocop/rake_task"
4
-
5
- RSpec::Core::RakeTask.new(:spec)
6
- RuboCop::RakeTask.new(:lint)
7
-
8
- task default: :spec
9
-
10
- desc 'Execute both RuboCop and RSpec'
11
- task "lint-and-test" => [:lint, :spec]
@@ -1,10 +1,9 @@
1
- image: ruby:2.6
1
+ image: ruby:3.0
2
2
 
3
3
  definitions:
4
4
  caches:
5
- bundler-26: vendor/bundle
6
- bundler-27: vendor/bundle
7
5
  bundler-30: vendor/bundle
6
+ bundler-31: vendor/bundle
8
7
 
9
8
  steps:
10
9
  - step: &test
@@ -12,9 +11,12 @@ definitions:
12
11
  script:
13
12
  - apt-get install git
14
13
  - gem update --system
14
+ - gem install bundler -v $(cat Gemfile.lock | awk '/BUNDLED WITH/{ getline;print; }')
15
+ - bundle install
15
16
  - bundle config set --local path "vendor/bundle"
16
17
  - bin/setup.sh --strict
17
- - bundle exec rake lint-and-test
18
+ - bundle exec rubocop .
19
+ - RAILS_ENV=test bundle exec rspec
18
20
  - step: &release
19
21
  name: Release gem
20
22
  script:
@@ -31,24 +33,18 @@ pipelines:
31
33
  pull-requests:
32
34
  '**':
33
35
  - parallel:
34
- - step:
35
- <<: *test
36
- name: Ruby 2.6
37
- image: ruby:2.6
38
- caches:
39
- - bundler-26
40
- - step:
41
- <<: *test
42
- name: Ruby 2.7
43
- image: ruby:2.7
44
- caches:
45
- - bundler-27
46
36
  - step:
47
37
  <<: *test
48
38
  name: Ruby 3.0
49
39
  image: ruby:3.0
50
40
  caches:
51
41
  - bundler-30
42
+ - step:
43
+ <<: *test
44
+ name: Ruby 3.1
45
+ image: ruby:3.1
46
+ caches:
47
+ - bundler-31
52
48
  branches:
53
49
  master:
54
50
  - step: *release
@@ -4,8 +4,9 @@ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'json_api_toolbox/version'
6
6
 
7
+ # rubocop:disable Metrics/BlockLength
7
8
  Gem::Specification.new do |spec|
8
- spec.required_ruby_version = '>= 2.6.0'
9
+ spec.required_ruby_version = '>= 3.0'
9
10
  spec.name = 'json_api_toolbox'
10
11
  spec.version = JsonApiToolbox::VERSION
11
12
 
@@ -22,6 +23,7 @@ Gem::Specification.new do |spec|
22
23
 
23
24
  spec.add_dependency 'activerecord', '>= 5.1.0'
24
25
  spec.add_dependency 'activesupport', '>= 5.1.0'
26
+ spec.add_dependency 'elastic-apm'
25
27
  spec.add_dependency 'jsonapi-serializable'
26
28
  spec.add_dependency 'json-api-vanilla'
27
29
  spec.add_dependency 'log_toolbox'
@@ -36,3 +38,4 @@ Gem::Specification.new do |spec|
36
38
  spec.add_development_dependency 'rubocop'
37
39
  spec.add_development_dependency 'shoulda-matchers'
38
40
  end
41
+ # rubocop:enable Metrics/BlockLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonApiToolbox
4
- VERSION = '2.1.0'
4
+ VERSION = '3.0.0'
5
5
  end
@@ -11,12 +11,8 @@ module JsonApiToolbox
11
11
  end
12
12
 
13
13
  def render_any_exception(exception)
14
- if Gem.loaded_specs.key?('log_toolbox')
15
- log_critical(exception)
16
- else
17
- puts_build_log_error(exception)
18
- end
19
-
14
+ log_exception(exception)
15
+ send_to_apm(exception)
20
16
  render build_jsonapi(exception)
21
17
  end
22
18
 
@@ -32,6 +28,18 @@ module JsonApiToolbox
32
28
  }, status: :internal_server_error }
33
29
  end
34
30
 
31
+ def log_exception(exception)
32
+ if Gem.loaded_specs.key?('log_toolbox')
33
+ log_critical(exception)
34
+ else
35
+ puts_build_log_error(exception)
36
+ end
37
+ end
38
+
39
+ def send_to_apm(exception)
40
+ ElasticAPM.report(exception) if Gem.loaded_specs.key?('elastic-apm')
41
+ end
42
+
35
43
  def puts_build_log_error(error)
36
44
  puts messages: error.try(:message), trace: error.try(:backtrace)
37
45
  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: 2.1.0
4
+ version: 3.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: 2022-11-09 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 5.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: elastic-apm
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: jsonapi-serializable
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -252,14 +266,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
266
  requirements:
253
267
  - - ">="
254
268
  - !ruby/object:Gem::Version
255
- version: 2.6.0
269
+ version: '3.0'
256
270
  required_rubygems_version: !ruby/object:Gem::Requirement
257
271
  requirements:
258
272
  - - ">="
259
273
  - !ruby/object:Gem::Version
260
274
  version: '0'
261
275
  requirements: []
262
- rubygems_version: 3.3.25
276
+ rubygems_version: 3.5.11
263
277
  signing_key:
264
278
  specification_version: 4
265
279
  summary: Json API usefull tools