arkaan 0.8.17 → 0.8.18
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/lib/arkaan/utils/controller.rb +5 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d798706312c3b3729c6ef04b71e8983bb12b7b07
|
4
|
+
data.tar.gz: 84119f0138ebc4bb07ae27b61f17a9c9be323733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f87d3059a16e6740444f55a454029e4c8ff74c3171bd2e06a3fba791784d881136f5b399ac0cffb2475feb205298e58c2328c4fdec26f6f6da73f601d65af460
|
7
|
+
data.tar.gz: cf96cefcf9e7526fe304ffa76418acb82f900ccba9b0fe04cb646a3d48e1e190faaf43cb2211c83f43fbb26d87abb08815039a5e03d7c495cf5d37eab18f237d
|
@@ -7,7 +7,7 @@ module Arkaan
|
|
7
7
|
|
8
8
|
before do
|
9
9
|
add_body_to_params
|
10
|
-
check_presence('token', 'app_key')
|
10
|
+
check_presence('token', 'app_key', route: 'common')
|
11
11
|
|
12
12
|
gateway = Arkaan::Monitoring::Gateway.where(token: params['token']).first
|
13
13
|
@application = Arkaan::OAuth::Application.where(key: params['app_key']).first
|
@@ -66,12 +66,9 @@ module Arkaan
|
|
66
66
|
|
67
67
|
# Checks the presence of several fields given as parameters and halts the execution if it's not present.
|
68
68
|
# @param fields [Array<String>] an array of fields names to search in the parameters
|
69
|
-
def check_presence(*fields)
|
69
|
+
def check_presence(*fields, route:)
|
70
70
|
fields.each do |field|
|
71
|
-
if params[field].nil? || params[field] == ''
|
72
|
-
url = 'https://github.com/jdr-tools/arkaan/wiki/Errors#parameter-not-given'
|
73
|
-
halt 400, {status: 400, field: field, error: 'required', docs: url}.to_json
|
74
|
-
end
|
71
|
+
custom_error(400, "#{route}.#{field}.required") if params[field].nil? || params[field] == ''
|
75
72
|
end
|
76
73
|
end
|
77
74
|
|
@@ -107,6 +104,8 @@ module Arkaan
|
|
107
104
|
field = messages.keys.first
|
108
105
|
custom_error(400, "#{route}.#{field}.#{messages[field].first}")
|
109
106
|
end
|
107
|
+
|
108
|
+
load_errors_from __FILE__
|
110
109
|
end
|
111
110
|
end
|
112
111
|
end
|