arkaan 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan/utils/controller_without_filter.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca91b0682b2c5963082d4ce0974d3695057a47e6
|
4
|
+
data.tar.gz: 8010676e37c2305d326a33d843e88f92e79d7570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e7e74877243902f1fe8c3d399657c99a93dfccab364b752c84d0e18c1fdb5b3a3df3a4866158badc8320b55a72fdf7995dd5168ac5e75fa0f3fe509fcfe2b8a
|
7
|
+
data.tar.gz: 5306f5291eafe02c5daebe629a7d5d8ee4123bbe9d7d1e433690c09b080734d64b9e2ef70032d9204848011d2cd57e9dabb67e6b272a6e08634fe04f98607943
|
@@ -70,12 +70,24 @@ module Arkaan
|
|
70
70
|
|
71
71
|
# Checks the presence of several fields given as parameters and halts the execution if it's not present.
|
72
72
|
# @param fields [Array<String>] an array of fields names to search in the parameters
|
73
|
+
# @param route [String] the name of the route you're requiring to put in the error message.
|
73
74
|
def check_presence(*fields, route:)
|
74
75
|
fields.each do |field|
|
75
76
|
custom_error(400, "#{route}.#{field}.required") if params[field].nil? || params[field] == ''
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
80
|
+
# Checks the presence of either fields given in parameters. It halts with an error only if ALL parameters are not given.
|
81
|
+
# @param fields [Array<String>] an array of fields names to search in the parameters
|
82
|
+
# @param route [String] the name of the route you're requiring to put in the error message.
|
83
|
+
# @param key [String] the key to search in the errors configuration file.
|
84
|
+
def check_either_presence(*fields, route:, key:)
|
85
|
+
fields.each do |field|
|
86
|
+
return true if !params[field].nil? && params[field] != ''
|
87
|
+
end
|
88
|
+
custom_error 400, "#{route}.#{key}.required"
|
89
|
+
end
|
90
|
+
|
79
91
|
# Checks if the session ID is given in the parameters and if the session exists.
|
80
92
|
# @param action [String] the action used to get the errors from the errors file.
|
81
93
|
# @return [Arkaan::Authentication::Session] the session when it exists.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|