queueit_knownuserv3 3.3.2 → 3.4.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,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODQxNjM4OTJiYzJhM2I5NjgxNmY0Yzc0MGMzOTExOTA1MGIzYTYyYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjdiMjNmNjFmNjE3NWRhNzIzYjVlMzhjOTNlMWQ1YjZhNjJjYjFmZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjM1ZGY3NDU2OWZkMGZjMThmNDkwOGI0Y2E2Y2RkZjA0MTVhNGYxMTFmNGIz
|
10
|
+
OTcwZjNiOGVmOTkzY2ZiYmY1NDc3N2E2MjJmOWVjZjI2YmRlYTIzZWRkODI4
|
11
|
+
YjdmMjMzNzE2MTJlOWFkNmIwOWEwMDQ2ZTliZGE3NDg5YzY0ZmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Zjg4MGQ4Mzg0MmU3ZDlhOTQxOTg4MmJhODVhMmVjOTIwYzIwZGExNTg1NGNh
|
14
|
+
ZDY2ZTM5Y2RkOGQ4MmJkNDEyYzAyZmVkNjAxNTAyNzdmNmRlYzk3MGYyNWY4
|
15
|
+
MTRkYjRhYzBlMTM0YmVjMzQyYWMyZDk5OTMyYWZiMTg5MDg1OTY=
|
@@ -75,14 +75,14 @@ module QueueIt
|
|
75
75
|
|
76
76
|
class UrlValidatorHelper
|
77
77
|
def self.evaluate(triggerPart, url)
|
78
|
-
if (
|
78
|
+
if (triggerPart.nil? ||
|
79
|
+
!triggerPart.key?("Operator") ||
|
79
80
|
!triggerPart.key?("IsNegative") ||
|
80
81
|
!triggerPart.key?("IsIgnoreCase") ||
|
81
|
-
!triggerPart.key?("ValueToCompare") ||
|
82
82
|
!triggerPart.key?("UrlPart"))
|
83
|
-
return false
|
83
|
+
return false
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
urlPart = UrlValidatorHelper.getUrlPart(triggerPart["UrlPart"], url)
|
87
87
|
|
88
88
|
return ComparisonOperatorHelper.evaluate(
|
@@ -90,7 +90,8 @@ module QueueIt
|
|
90
90
|
triggerPart["IsNegative"],
|
91
91
|
triggerPart["IsIgnoreCase"],
|
92
92
|
urlPart,
|
93
|
-
triggerPart["ValueToCompare"]
|
93
|
+
triggerPart["ValueToCompare"],
|
94
|
+
triggerPart["ValuesToCompare"])
|
94
95
|
end
|
95
96
|
|
96
97
|
def self.getUrlPart(urlPart, url)
|
@@ -115,12 +116,12 @@ module QueueIt
|
|
115
116
|
class CookieValidatorHelper
|
116
117
|
def self.evaluate(triggerPart, cookieJar)
|
117
118
|
begin
|
118
|
-
if (
|
119
|
+
if (triggerPart.nil? ||
|
120
|
+
!triggerPart.key?("Operator") ||
|
119
121
|
!triggerPart.key?("IsNegative") ||
|
120
122
|
!triggerPart.key?("IsIgnoreCase") ||
|
121
|
-
!triggerPart.key?("ValueToCompare") ||
|
122
123
|
!triggerPart.key?("CookieName"))
|
123
|
-
return false
|
124
|
+
return false
|
124
125
|
end
|
125
126
|
|
126
127
|
if(cookieJar.nil?)
|
@@ -137,7 +138,8 @@ module QueueIt
|
|
137
138
|
triggerPart["IsNegative"],
|
138
139
|
triggerPart["IsIgnoreCase"],
|
139
140
|
cookieValue,
|
140
|
-
triggerPart["ValueToCompare"]
|
141
|
+
triggerPart["ValueToCompare"],
|
142
|
+
triggerPart["ValuesToCompare"])
|
141
143
|
rescue
|
142
144
|
return false
|
143
145
|
end
|
@@ -147,33 +149,43 @@ module QueueIt
|
|
147
149
|
class UserAgentValidatorHelper
|
148
150
|
def self.evaluate(triggerPart, userAgent)
|
149
151
|
begin
|
150
|
-
if (
|
152
|
+
if (triggerPart.nil? ||
|
153
|
+
!triggerPart.key?("Operator") ||
|
151
154
|
!triggerPart.key?("IsNegative") ||
|
152
|
-
!triggerPart.key?("IsIgnoreCase")
|
153
|
-
|
154
|
-
return false;
|
155
|
+
!triggerPart.key?("IsIgnoreCase"))
|
156
|
+
return false
|
155
157
|
end
|
156
|
-
|
158
|
+
|
157
159
|
return ComparisonOperatorHelper.evaluate(
|
158
160
|
triggerPart["Operator"],
|
159
161
|
triggerPart["IsNegative"],
|
160
162
|
triggerPart["IsIgnoreCase"],
|
161
163
|
userAgent,
|
162
|
-
triggerPart["ValueToCompare"]
|
164
|
+
triggerPart["ValueToCompare"],
|
165
|
+
triggerPart["ValuesToCompare"])
|
163
166
|
end
|
164
167
|
end
|
165
168
|
end
|
166
169
|
|
167
170
|
class HttpHeaderValidatorHelper
|
168
171
|
def self.evaluate(triggerPart, headers)
|
169
|
-
begin
|
172
|
+
begin
|
173
|
+
if (triggerPart.nil? ||
|
174
|
+
!triggerPart.key?("Operator") ||
|
175
|
+
!triggerPart.key?("IsNegative") ||
|
176
|
+
!triggerPart.key?("IsIgnoreCase")
|
177
|
+
!triggerPart.key?("HttpHeaderName"))
|
178
|
+
return false
|
179
|
+
end
|
180
|
+
|
170
181
|
headerValue = headers[triggerPart['HttpHeaderName']]
|
171
182
|
return ComparisonOperatorHelper.evaluate(
|
172
183
|
triggerPart["Operator"],
|
173
184
|
triggerPart["IsNegative"],
|
174
185
|
triggerPart["IsIgnoreCase"],
|
175
186
|
headerValue,
|
176
|
-
triggerPart["ValueToCompare"]
|
187
|
+
triggerPart["ValueToCompare"],
|
188
|
+
triggerPart["ValuesToCompare"])
|
177
189
|
rescue
|
178
190
|
return false
|
179
191
|
end
|
@@ -181,35 +193,44 @@ module QueueIt
|
|
181
193
|
end
|
182
194
|
|
183
195
|
class ComparisonOperatorHelper
|
184
|
-
def self.evaluate(opt, isNegative, ignoreCase,
|
185
|
-
if(
|
186
|
-
|
196
|
+
def self.evaluate(opt, isNegative, ignoreCase, value, valueToCompare, valuesToCompare)
|
197
|
+
if (value.nil?)
|
198
|
+
value = ''
|
199
|
+
end
|
200
|
+
|
201
|
+
if (valueToCompare.nil?)
|
202
|
+
valueToCompare = ''
|
187
203
|
end
|
188
|
-
|
189
|
-
|
204
|
+
|
205
|
+
if (valuesToCompare.nil?)
|
206
|
+
valuesToCompare = []
|
190
207
|
end
|
191
208
|
|
192
209
|
case opt
|
193
210
|
when "Equals"
|
194
|
-
return ComparisonOperatorHelper.equals(
|
211
|
+
return ComparisonOperatorHelper.equals(value, valueToCompare, isNegative, ignoreCase)
|
195
212
|
when "Contains"
|
196
|
-
return ComparisonOperatorHelper.contains(
|
213
|
+
return ComparisonOperatorHelper.contains(value, valueToCompare, isNegative, ignoreCase)
|
197
214
|
when "StartsWith"
|
198
|
-
return ComparisonOperatorHelper.startsWith(
|
215
|
+
return ComparisonOperatorHelper.startsWith(value, valueToCompare, isNegative, ignoreCase)
|
199
216
|
when "EndsWith"
|
200
|
-
return ComparisonOperatorHelper.endsWith(
|
217
|
+
return ComparisonOperatorHelper.endsWith(value, valueToCompare, isNegative, ignoreCase)
|
201
218
|
when "MatchesWith"
|
202
|
-
return ComparisonOperatorHelper.matchesWith(
|
219
|
+
return ComparisonOperatorHelper.matchesWith(value, valueToCompare, isNegative, ignoreCase)
|
220
|
+
when "EqualsAny"
|
221
|
+
return ComparisonOperatorHelper.equalsAny(value, valuesToCompare, isNegative, ignoreCase)
|
222
|
+
when "ContainsAny"
|
223
|
+
return ComparisonOperatorHelper.containsAny(value, valuesToCompare, isNegative, ignoreCase)
|
203
224
|
else
|
204
225
|
return false
|
205
226
|
end
|
206
227
|
end
|
207
228
|
|
208
|
-
def self.equals(
|
229
|
+
def self.equals(value, valueToCompare, isNegative, ignoreCase)
|
209
230
|
if(ignoreCase)
|
210
|
-
evaluation =
|
231
|
+
evaluation = value.upcase.eql? valueToCompare.upcase
|
211
232
|
else
|
212
|
-
evaluation =
|
233
|
+
evaluation = value.eql? valueToCompare
|
213
234
|
end
|
214
235
|
|
215
236
|
if(isNegative)
|
@@ -219,17 +240,17 @@ module QueueIt
|
|
219
240
|
end
|
220
241
|
end
|
221
242
|
|
222
|
-
def self.contains(
|
223
|
-
if(
|
243
|
+
def self.contains(value, valueToCompare, isNegative, ignoreCase)
|
244
|
+
if(valueToCompare.eql? "*")
|
224
245
|
return true
|
225
246
|
end
|
226
247
|
|
227
248
|
if(ignoreCase)
|
228
|
-
|
229
|
-
|
249
|
+
value = value.upcase
|
250
|
+
valueToCompare = valueToCompare.upcase
|
230
251
|
end
|
231
252
|
|
232
|
-
evaluation =
|
253
|
+
evaluation = value.include? valueToCompare
|
233
254
|
if(isNegative)
|
234
255
|
return !evaluation
|
235
256
|
else
|
@@ -237,11 +258,11 @@ module QueueIt
|
|
237
258
|
end
|
238
259
|
end
|
239
260
|
|
240
|
-
def self.startsWith(
|
261
|
+
def self.startsWith(value, valueToCompare, isNegative, ignoreCase)
|
241
262
|
if(ignoreCase)
|
242
|
-
evaluation =
|
263
|
+
evaluation = value.upcase.start_with? valueToCompare.upcase
|
243
264
|
else
|
244
|
-
evaluation =
|
265
|
+
evaluation = value.start_with? valueToCompare
|
245
266
|
end
|
246
267
|
|
247
268
|
if(isNegative)
|
@@ -251,11 +272,11 @@ module QueueIt
|
|
251
272
|
end
|
252
273
|
end
|
253
274
|
|
254
|
-
def self.endsWith(
|
275
|
+
def self.endsWith(value, valueToCompare, isNegative, ignoreCase)
|
255
276
|
if(ignoreCase)
|
256
|
-
evaluation =
|
277
|
+
evaluation = value.upcase.end_with? valueToCompare.upcase
|
257
278
|
else
|
258
|
-
evaluation =
|
279
|
+
evaluation = value.end_with? valueToCompare
|
259
280
|
end
|
260
281
|
|
261
282
|
if(isNegative)
|
@@ -265,19 +286,37 @@ module QueueIt
|
|
265
286
|
end
|
266
287
|
end
|
267
288
|
|
268
|
-
def self.matchesWith(
|
289
|
+
def self.matchesWith(value, valueToCompare, isNegative, ignoreCase)
|
269
290
|
if(ignoreCase)
|
270
|
-
pattern = Regexp.new(
|
291
|
+
pattern = Regexp.new(valueToCompare, Regexp::IGNORECASE)
|
271
292
|
else
|
272
|
-
pattern = Regexp.new(
|
293
|
+
pattern = Regexp.new(valueToCompare)
|
273
294
|
end
|
274
295
|
|
275
|
-
evaluation = pattern.match(
|
296
|
+
evaluation = pattern.match(value) != nil
|
276
297
|
if(isNegative)
|
277
298
|
return !evaluation
|
278
299
|
else
|
279
300
|
return evaluation
|
280
301
|
end
|
281
302
|
end
|
303
|
+
|
304
|
+
def self.equalsAny(value, valuesToCompare, isNegative, ignoreCase)
|
305
|
+
valuesToCompare.each do |valueToCompare|
|
306
|
+
if (ComparisonOperatorHelper.equals(value, valueToCompare, false, ignoreCase))
|
307
|
+
return !isNegative
|
308
|
+
end
|
309
|
+
end
|
310
|
+
return isNegative
|
311
|
+
end
|
312
|
+
|
313
|
+
def self.containsAny(value, valuesToCompare, isNegative, ignoreCase)
|
314
|
+
valuesToCompare.each do |valueToCompare|
|
315
|
+
if (ComparisonOperatorHelper.contains(value, valueToCompare, false, ignoreCase))
|
316
|
+
return !isNegative
|
317
|
+
end
|
318
|
+
end
|
319
|
+
return isNegative
|
320
|
+
end
|
282
321
|
end
|
283
322
|
end
|
@@ -226,37 +226,19 @@ module QueueIt
|
|
226
226
|
return RequestValidationResult.new(nil, nil, nil, nil)
|
227
227
|
end
|
228
228
|
|
229
|
+
# unspecified or 'Queue' specified
|
229
230
|
if(!matchedConfig.key?("ActionType") || Utils.isNilOrEmpty(matchedConfig["ActionType"]) || matchedConfig["ActionType"].eql?(ActionTypes::QUEUE))
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
case matchedConfig["RedirectLogic"]
|
241
|
-
when "ForcedTargetUrl"
|
242
|
-
targetUrl = matchedConfig["ForcedTargetUrl"]
|
243
|
-
when "EventTargetUrl"
|
244
|
-
targetUrl = ''
|
245
|
-
else
|
246
|
-
targetUrl = currentUrlWithoutQueueITToken
|
247
|
-
end
|
248
|
-
|
249
|
-
return _resolveQueueRequestByLocalConfig(targetUrl, queueitToken, queueConfig, customerId, secretKey, request, debugEntries)
|
250
|
-
|
251
|
-
else # cancel action
|
252
|
-
cancelConfig = CancelEventConfig.new;
|
253
|
-
cancelConfig.eventId = matchedConfig["EventId"]
|
254
|
-
cancelConfig.queueDomain = matchedConfig["QueueDomain"]
|
255
|
-
cancelConfig.cookieDomain = matchedConfig["CookieDomain"]
|
256
|
-
cancelConfig.version = customerIntegration["Version"]
|
257
|
-
|
258
|
-
return _cancelRequestByLocalConfig(currentUrlWithoutQueueITToken, queueitToken, cancelConfig, customerId, secretKey, request, debugEntries);
|
231
|
+
handleQueueAction(currentUrlWithoutQueueITToken, queueitToken, customerIntegration, customerId, secretKey, matchedConfig, request, debugEntries)
|
232
|
+
|
233
|
+
elsif(matchedConfig["ActionType"].eql?(ActionTypes::CANCEL))
|
234
|
+
handleCancelAction(currentUrlWithoutQueueITToken, queueitToken, customerIntegration, customerId, secretKey, matchedConfig, request, debugEntries)
|
235
|
+
|
236
|
+
# for all unknown types default to 'Ignore'
|
237
|
+
else
|
238
|
+
userInQueueService = getUserInQueueService(request.cookie_jar)
|
239
|
+
userInQueueService.getIgnoreActionResult()
|
259
240
|
end
|
241
|
+
|
260
242
|
rescue StandardError => stdErr
|
261
243
|
raise KnownUserError, "integrationConfiguration text was not valid: " + stdErr.message
|
262
244
|
ensure
|
@@ -264,6 +246,39 @@ module QueueIt
|
|
264
246
|
end
|
265
247
|
end
|
266
248
|
|
249
|
+
def self.handleQueueAction(currentUrlWithoutQueueITToken, queueitToken, customerIntegration, customerId, secretKey, matchedConfig, request, debugEntries)
|
250
|
+
queueConfig = QueueEventConfig.new
|
251
|
+
queueConfig.eventId = matchedConfig["EventId"]
|
252
|
+
queueConfig.queueDomain = matchedConfig["QueueDomain"]
|
253
|
+
queueConfig.layoutName = matchedConfig["LayoutName"]
|
254
|
+
queueConfig.culture = matchedConfig["Culture"]
|
255
|
+
queueConfig.cookieDomain = matchedConfig["CookieDomain"]
|
256
|
+
queueConfig.extendCookieValidity = matchedConfig["ExtendCookieValidity"]
|
257
|
+
queueConfig.cookieValidityMinute = matchedConfig["CookieValidityMinute"]
|
258
|
+
queueConfig.version = customerIntegration["Version"]
|
259
|
+
|
260
|
+
case matchedConfig["RedirectLogic"]
|
261
|
+
when "ForcedTargetUrl"
|
262
|
+
targetUrl = matchedConfig["ForcedTargetUrl"]
|
263
|
+
when "EventTargetUrl"
|
264
|
+
targetUrl = ''
|
265
|
+
else
|
266
|
+
targetUrl = currentUrlWithoutQueueITToken
|
267
|
+
end
|
268
|
+
|
269
|
+
return _resolveQueueRequestByLocalConfig(targetUrl, queueitToken, queueConfig, customerId, secretKey, request, debugEntries)
|
270
|
+
end
|
271
|
+
|
272
|
+
def self.handleCancelAction(currentUrlWithoutQueueITToken, queueitToken, customerIntegration, customerId, secretKey, matchedConfig, request, debugEntries)
|
273
|
+
cancelConfig = CancelEventConfig.new;
|
274
|
+
cancelConfig.eventId = matchedConfig["EventId"]
|
275
|
+
cancelConfig.queueDomain = matchedConfig["QueueDomain"]
|
276
|
+
cancelConfig.cookieDomain = matchedConfig["CookieDomain"]
|
277
|
+
cancelConfig.version = customerIntegration["Version"]
|
278
|
+
|
279
|
+
return _cancelRequestByLocalConfig(currentUrlWithoutQueueITToken, queueitToken, cancelConfig, customerId, secretKey, request, debugEntries);
|
280
|
+
end
|
281
|
+
|
267
282
|
def self.cancelRequestByLocalConfig(targetUrl, queueitToken, cancelConfig, customerId, secretKey, request)
|
268
283
|
debugEntries = Hash.new
|
269
284
|
begin
|
@@ -3,7 +3,7 @@ require 'cgi'
|
|
3
3
|
|
4
4
|
module QueueIt
|
5
5
|
class UserInQueueService
|
6
|
-
SDK_VERSION = "3.
|
6
|
+
SDK_VERSION = "3.4.0"
|
7
7
|
|
8
8
|
def initialize(userInQueueStateRepository)
|
9
9
|
@userInQueueStateRepository = userInQueueStateRepository
|
@@ -70,7 +70,7 @@ module QueueIt
|
|
70
70
|
!(queueParams.cookieValidityMinute.nil?) ? queueParams.cookieValidityMinute : config.cookieValidityMinute,
|
71
71
|
!Utils::isNilOrEmpty(config.cookieDomain) ? config.cookieDomain : '',
|
72
72
|
secretKey)
|
73
|
-
return RequestValidationResult.new(ActionTypes::QUEUE, config.eventId, queueParams.queueId, nil)
|
73
|
+
return RequestValidationResult.new(ActionTypes::QUEUE, config.eventId, queueParams.queueId, nil)
|
74
74
|
end
|
75
75
|
|
76
76
|
def getVaidationErrorResult(customerId, targetUrl, config, qParams, errorCode)
|
@@ -112,5 +112,9 @@ module QueueIt
|
|
112
112
|
def extendQueueCookie(eventId, cookieValidityMinute, cookieDomain, secretKey)
|
113
113
|
@userInQueueStateRepository.extendQueueCookie(eventId, cookieValidityMinute, cookieDomain, secretKey)
|
114
114
|
end
|
115
|
+
|
116
|
+
def getIgnoreActionResult()
|
117
|
+
return RequestValidationResult.new(ActionTypes::IGNORE, nil, nil, nil)
|
118
|
+
end
|
115
119
|
end
|
116
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queueit_knownuserv3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Queue-it
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|