thecore_api 1.5.0 → 1.5.1

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: bee9108eb88ab9fe17f47ad56f2d55ce2f91a94a053edb6fdc2de6008001bea9
4
- data.tar.gz: b10c71bd8070afe6ed5b6819b0574adbf2e525db23c5c935b0921137df18d6d7
3
+ metadata.gz: d63cdc47901fc71b695a011afaa3ef94efa86001bd384a834445585455578334
4
+ data.tar.gz: 4cd3683e479e3c1b18a556f403bd478ac9ff28851f51d0d4295c9ea8beb1fe80
5
5
  SHA512:
6
- metadata.gz: dd1414f9643019e314678b704a94812abf938fa0d18bfa9a7098e2fea758a334df0e23d478506345c59d0bdbdc998a447ae0f0e2ab5ba4ffe9128069ca116f5f
7
- data.tar.gz: 4b34c35d419906fbdf7c3836e834861cf50cbf6febe233ce9c70fba65534c31520804b9fc525ce3d8638b7d118fd1f12fec6d044487cc76639f658d51fb6aa7e
6
+ metadata.gz: a6aa83945499df23c3bec088973b4b725e1807e2c7e8d439162f2d4c48208db5b3353d5942dba23310c7269a58cf207ed7bcce1ac59181a5617730a20eb2df04
7
+ data.tar.gz: 4df0635510e2a3777b700e65ac56e2f8a114da0cf1094192c684eda1dc18f451e42054d83b0e88bec5ac9a18681677dde5a4ef0b3f6b5c4a36666e44260c7e0b
@@ -31,9 +31,12 @@ class Api::V1::BaseController < ActionController::API
31
31
  rescue_from ActiveRecord::RecordNotFound, with: :not_found!
32
32
  rescue_from NameError, with: :not_found!
33
33
  rescue_from NoMethodError, with: :not_found!
34
+ rescue_from RubySpark::Device::ApiError, with: :fivehundred!
34
35
 
35
36
  attr_accessor :current_user
36
37
 
38
+ # JWT: https://www.pluralsight.com/guides/token-based-authentication-with-ruby-on-rails-5-api
39
+
37
40
  #Disabling Strong Parameters
38
41
  # def params
39
42
  # request.parameters
@@ -204,6 +207,10 @@ class Api::V1::BaseController < ActionController::API
204
207
  api_error status: 422, errors: exception.record.errors
205
208
  end
206
209
 
210
+ def fivehundred!
211
+ api_error status: 500, errors: [I18n.t("api.errors.fivehundred", default: "Internal Server Error")]
212
+ end
213
+
207
214
  def api_error(status: 500, errors: [])
208
215
  # puts errors.full_messages if !Rails.env.production? && errors.respond_to?(:full_messages)
209
216
  head status && return if errors.empty?
@@ -3,4 +3,5 @@ en:
3
3
  errors:
4
4
  bad_credentials: Bad Credentials
5
5
  unauthorized: Unauthorized Action
6
- not_found: Resource not found
6
+ not_found: Resource not found
7
+ fivehundred: Internal server error, please contact service provider.
@@ -3,4 +3,5 @@ it:
3
3
  errors:
4
4
  bad_credentials: Credenziali errate
5
5
  unauthorized: Operazione non autorizzata
6
- not_found: Risorsa non trovata
6
+ not_found: Risorsa non trovata
7
+ fivehundred: Errore interno del server, prego contattare il fornitore del servizio.
@@ -1,3 +1,3 @@
1
1
  module ThecoreApi
2
- VERSION = "1.5.0".freeze
2
+ VERSION = "1.5.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2019-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore