captive-api 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 610b0277d1e8fa73791417902e5da68398a888944d4eddec9962b203432fa7a0
4
- data.tar.gz: 701f6b9b8905044fc77ade30868f4ac37203ee181d71360df6b87bbd269caa95
3
+ metadata.gz: e72b812dfba5731acc69f880513c4d445b6cc116ba1414769b7b2a80fe2ff059
4
+ data.tar.gz: 54aa16d8fef4481576db2a1b516370425028daeafdfba386ff39d59b76a554b2
5
5
  SHA512:
6
- metadata.gz: 2582ca1e4bc6f2b6353348c352c62958ddbfb43f22f994788ad5bcf3a6efa4f4922956cdaf14c6dd46bd2c2b3396b2dd90da3e7feb5fe8d1550aa336edfe87e7
7
- data.tar.gz: 4bf48698d424366d310d97210bb2263d715a4d1257b92b21dcd041c8818848c22e14f9518bcca641a16081bc20d4667307d59dd1226a9ba79c1efd4abb854699
6
+ metadata.gz: c6ce7a15f9fe66265869f616b720d99b8adb4b2a4050db0a8cc86e61f8c8ab44dfa5de70d201a9dbac589b8f399ad909667bf605ac210347b331474253fa728b
7
+ data.tar.gz: e901f2a5e2e65a91f4f5602dd8528db230d73af5bc757eeb992c2bd7b2243c3136b56485d0f790656bf1433adb5f9342a50bbfe152c80fd328d1eab6aac65713
@@ -8,6 +8,7 @@ module Api
8
8
 
9
9
  included do
10
10
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
11
+ rescue_from ActionController::ParameterMissing, with: :handle_parameter_missing
11
12
 
12
13
  rescue_from CanCan::AccessDenied do |exception|
13
14
  render_error_from_exception(exception, status: :forbidden)
@@ -23,7 +24,7 @@ module Api
23
24
  errors = object.errors.messages
24
25
  Rails.logger.error("Impossible de sauvagarder l'objet #{object.class} : #{errors}")
25
26
  render_error(
26
- message: message, errors: errors, status: :unprocessable_entity
27
+ message: message, errors: errors, status: status
27
28
  )
28
29
  end
29
30
 
@@ -33,6 +34,10 @@ module Api
33
34
  )
34
35
  end
35
36
 
37
+ def handle_parameter_missing(exception)
38
+ render_error_from_exception(exception, status: :bad_request)
39
+ end
40
+
36
41
  def not_found(exception)
37
42
  render_error(message: "#{exception.model} not found", status: :not_found)
38
43
  end
@@ -1,5 +1,5 @@
1
1
  module Captive
2
2
  module Api
3
- VERSION = "1.1.0".freeze
3
+ VERSION = "1.2.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: captive-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Captive
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-06-30 00:00:00.000000000 Z
12
+ date: 2023-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -64,7 +64,6 @@ homepage: https://www.captive.fr/
64
64
  licenses:
65
65
  - MIT
66
66
  metadata:
67
- allowed_push_host: https://rubygems.org/
68
67
  homepage_uri: https://www.captive.fr/
69
68
  source_code_uri: https://github.com/Captive-Studio/captive-api
70
69
  post_install_message: