queueit_knownuserv3 3.6.1 → 3.7.1
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 +7 -0
- data/Gemfile +4 -4
- data/LICENSE +21 -0
- data/README.md +188 -0
- data/Rakefile +2 -2
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/queueit_knownuserv3/connector_diagnostics.rb +68 -68
- data/lib/queueit_knownuserv3/httpcontext_provider.rb +93 -0
- data/lib/queueit_knownuserv3/integration_config_helpers.rb +297 -272
- data/lib/queueit_knownuserv3/known_user.rb +410 -399
- data/lib/queueit_knownuserv3/models.rb +138 -126
- data/lib/queueit_knownuserv3/queue_url_params.rb +80 -80
- data/lib/queueit_knownuserv3/user_in_queue_service.rb +168 -157
- data/lib/queueit_knownuserv3/user_in_queue_state_cookie_repository.rb +191 -191
- data/lib/queueit_knownuserv3.rb +11 -10
- data/queueit_knownuserv3.gemspec +28 -28
- metadata +10 -16
- data/.devcontainer/Dockerfile +0 -43
- data/.devcontainer/devcontainer.json +0 -30
- data/.gitignore +0 -5
- data/.vscode/launch.json +0 -15
- data/ci-build.yml +0 -17
- data/license.txt +0 -165
|
@@ -1,127 +1,139 @@
|
|
|
1
|
-
require 'cgi'
|
|
2
|
-
|
|
3
|
-
module QueueIt
|
|
4
|
-
class Utils
|
|
5
|
-
def self.isNilOrEmpty(value)
|
|
6
|
-
return !value || value.to_s == ''
|
|
7
|
-
end
|
|
8
|
-
def self.toString(value)
|
|
9
|
-
if(value == nil)
|
|
10
|
-
return ''
|
|
11
|
-
end
|
|
12
|
-
return value.to_s
|
|
13
|
-
end
|
|
14
|
-
def self.urlEncode(value)
|
|
15
|
-
return CGI.escape(value).gsub("+", "%20").gsub("%7E", "~")
|
|
16
|
-
end
|
|
17
|
-
def self.urlDecode(value)
|
|
18
|
-
return CGI.unescape(value)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
class
|
|
23
|
-
attr_accessor :eventId
|
|
24
|
-
attr_accessor :
|
|
25
|
-
attr_accessor :
|
|
26
|
-
attr_accessor :
|
|
27
|
-
attr_accessor :
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
end
|
|
1
|
+
require 'cgi'
|
|
2
|
+
|
|
3
|
+
module QueueIt
|
|
4
|
+
class Utils
|
|
5
|
+
def self.isNilOrEmpty(value)
|
|
6
|
+
return !value || value.to_s == ''
|
|
7
|
+
end
|
|
8
|
+
def self.toString(value)
|
|
9
|
+
if(value == nil)
|
|
10
|
+
return ''
|
|
11
|
+
end
|
|
12
|
+
return value.to_s
|
|
13
|
+
end
|
|
14
|
+
def self.urlEncode(value)
|
|
15
|
+
return CGI.escape(value).gsub("+", "%20").gsub("%7E", "~")
|
|
16
|
+
end
|
|
17
|
+
def self.urlDecode(value)
|
|
18
|
+
return CGI.unescape(value)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class QueueEventConfig
|
|
23
|
+
attr_accessor :eventId
|
|
24
|
+
attr_accessor :layoutName
|
|
25
|
+
attr_accessor :culture
|
|
26
|
+
attr_accessor :queueDomain
|
|
27
|
+
attr_accessor :extendCookieValidity
|
|
28
|
+
attr_accessor :cookieValidityMinute
|
|
29
|
+
attr_accessor :cookieDomain
|
|
30
|
+
attr_accessor :isCookieHttpOnly
|
|
31
|
+
attr_accessor :isCookieSecure
|
|
32
|
+
attr_accessor :version
|
|
33
|
+
attr_accessor :actionName
|
|
34
|
+
|
|
35
|
+
def initialize
|
|
36
|
+
@eventId = nil
|
|
37
|
+
@layoutName = nil
|
|
38
|
+
@culture = nil
|
|
39
|
+
@queueDomain = nil
|
|
40
|
+
@extendCookieValidity = nil
|
|
41
|
+
@cookieValidityMinute = nil
|
|
42
|
+
@cookieDomain = nil
|
|
43
|
+
@isCookieHttpOnly = false
|
|
44
|
+
@isCookieSecure = false
|
|
45
|
+
@version = nil
|
|
46
|
+
@actionName = "unspecified"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def toString
|
|
50
|
+
return "EventId:" + Utils.toString(eventId) +
|
|
51
|
+
"&Version:" + Utils.toString(version) +
|
|
52
|
+
"&QueueDomain:" + Utils.toString(queueDomain) +
|
|
53
|
+
"&CookieDomain:" + Utils.toString(cookieDomain) +
|
|
54
|
+
"&IsCookieHttpOnly:" + Utils.toString(isCookieHttpOnly) +
|
|
55
|
+
"&IsCookieSecure:" + Utils.toString(isCookieSecure) +
|
|
56
|
+
"&ExtendCookieValidity:" + Utils.toString(extendCookieValidity) +
|
|
57
|
+
"&CookieValidityMinute:" + Utils.toString(cookieValidityMinute) +
|
|
58
|
+
"&LayoutName:" + Utils.toString(layoutName) +
|
|
59
|
+
"&Culture:" + Utils.toString(culture) +
|
|
60
|
+
"&ActionName:" + Utils.toString(actionName)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class CancelEventConfig
|
|
65
|
+
attr_accessor :eventId
|
|
66
|
+
attr_accessor :queueDomain
|
|
67
|
+
attr_accessor :cookieDomain
|
|
68
|
+
attr_accessor :isCookieHttpOnly
|
|
69
|
+
attr_accessor :isCookieSecure
|
|
70
|
+
attr_accessor :version
|
|
71
|
+
attr_accessor :actionName
|
|
72
|
+
|
|
73
|
+
def initialize
|
|
74
|
+
@eventId = nil
|
|
75
|
+
@queueDomain = nil
|
|
76
|
+
@cookieDomain = nil
|
|
77
|
+
@isCookieHttpOnly = false
|
|
78
|
+
@isCookieSecure = false
|
|
79
|
+
@version = nil
|
|
80
|
+
@actionName = "unspecified"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def toString
|
|
84
|
+
return "EventId:" + Utils.toString(eventId) +
|
|
85
|
+
"&Version:" + Utils.toString(version) +
|
|
86
|
+
"&QueueDomain:" + Utils.toString(queueDomain) +
|
|
87
|
+
"&CookieDomain:" + Utils.toString(cookieDomain) +
|
|
88
|
+
"&IsCookieHttpOnly:" + Utils.toString(isCookieHttpOnly) +
|
|
89
|
+
"&IsCookieSecure:" + Utils.toString(isCookieSecure) +
|
|
90
|
+
"&ActionName:" + Utils.toString(actionName)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
class RequestValidationResult
|
|
95
|
+
attr_reader :actionType
|
|
96
|
+
attr_reader :eventId
|
|
97
|
+
attr_reader :queueId
|
|
98
|
+
attr_reader :redirectUrl
|
|
99
|
+
attr_reader :redirectType
|
|
100
|
+
attr_accessor :actionName
|
|
101
|
+
attr_accessor :isAjaxResult
|
|
102
|
+
|
|
103
|
+
def initialize(actionType, eventId, queueId, redirectUrl, redirectType, actionName)
|
|
104
|
+
@actionType = actionType
|
|
105
|
+
@eventId = eventId
|
|
106
|
+
@queueId = queueId
|
|
107
|
+
@redirectUrl = redirectUrl
|
|
108
|
+
@redirectType = redirectType
|
|
109
|
+
@actionName = actionName
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def doRedirect
|
|
113
|
+
return !Utils.isNilOrEmpty(@redirectUrl)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def getAjaxQueueRedirectHeaderKey
|
|
117
|
+
return "x-queueit-redirect"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def getAjaxRedirectUrl
|
|
121
|
+
if !Utils.isNilOrEmpty(@redirectUrl)
|
|
122
|
+
return Utils.urlEncode(@redirectUrl)
|
|
123
|
+
end
|
|
124
|
+
return ""
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
class KnownUserError < StandardError
|
|
129
|
+
def initialize(message)
|
|
130
|
+
super(message)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
class ActionTypes
|
|
135
|
+
CANCEL = "Cancel"
|
|
136
|
+
QUEUE = "Queue"
|
|
137
|
+
IGNORE = "Ignore"
|
|
138
|
+
end
|
|
127
139
|
end
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
module QueueIt
|
|
2
|
-
class QueueUrlParams
|
|
3
|
-
KEY_VALUE_SEPARATOR_GROUP_CHAR = '~'
|
|
4
|
-
KEY_VALUE_SEPARATOR_CHAR = '_'
|
|
5
|
-
TIMESTAMP_KEY = "ts"
|
|
6
|
-
COOKIE_VALIDITY_MINUTES_KEY = "cv"
|
|
7
|
-
EVENT_ID_KEY = "e"
|
|
8
|
-
EXTENDABLE_COOKIE_KEY = "ce"
|
|
9
|
-
HASH_KEY = "h"
|
|
10
|
-
QUEUE_ID_KEY = "q"
|
|
11
|
-
REDIRECT_TYPE_KEY = "rt"
|
|
12
|
-
|
|
13
|
-
attr_accessor :timeStamp
|
|
14
|
-
attr_accessor :eventId
|
|
15
|
-
attr_accessor :hashCode
|
|
16
|
-
attr_accessor :extendableCookie
|
|
17
|
-
attr_accessor :cookieValidityMinutes
|
|
18
|
-
attr_accessor :queueITToken
|
|
19
|
-
attr_accessor :queueITTokenWithoutHash
|
|
20
|
-
attr_accessor :queueId
|
|
21
|
-
attr_accessor :redirectType
|
|
22
|
-
|
|
23
|
-
def initialize
|
|
24
|
-
@timeStamp = 0
|
|
25
|
-
@eventId = ""
|
|
26
|
-
@hashCode = ""
|
|
27
|
-
@extendableCookie = false
|
|
28
|
-
@cookieValidityMinutes = nil
|
|
29
|
-
@queueITToken = ""
|
|
30
|
-
@queueITTokenWithoutHash = ""
|
|
31
|
-
@queueId = ""
|
|
32
|
-
@redirectType = nil
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def self.extractQueueParams(queueitToken)
|
|
36
|
-
if(Utils.isNilOrEmpty(queueitToken))
|
|
37
|
-
return nil
|
|
38
|
-
end
|
|
39
|
-
result = QueueUrlParams.new
|
|
40
|
-
result.queueITToken = queueitToken
|
|
41
|
-
paramsNameValueList = result.queueITToken.split(KEY_VALUE_SEPARATOR_GROUP_CHAR)
|
|
42
|
-
|
|
43
|
-
paramsNameValueList.each do |pNameValue|
|
|
44
|
-
paramNameValueArr = pNameValue.split(KEY_VALUE_SEPARATOR_CHAR)
|
|
45
|
-
|
|
46
|
-
if(!paramNameValueArr.length().eql? 2)
|
|
47
|
-
next
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
case paramNameValueArr[0]
|
|
51
|
-
when HASH_KEY
|
|
52
|
-
result.hashCode = paramNameValueArr[1]
|
|
53
|
-
when TIMESTAMP_KEY
|
|
54
|
-
if paramNameValueArr[1] !~ /\D/
|
|
55
|
-
result.timeStamp = paramNameValueArr[1].to_i
|
|
56
|
-
else
|
|
57
|
-
result.timeStamp = 0
|
|
58
|
-
end
|
|
59
|
-
when COOKIE_VALIDITY_MINUTES_KEY
|
|
60
|
-
if paramNameValueArr[1] !~ /\D/
|
|
61
|
-
result.cookieValidityMinutes = paramNameValueArr[1].to_i
|
|
62
|
-
else
|
|
63
|
-
result.cookieValidityMinutes = nil
|
|
64
|
-
end
|
|
65
|
-
when EVENT_ID_KEY
|
|
66
|
-
result.eventId = paramNameValueArr[1]
|
|
67
|
-
when EXTENDABLE_COOKIE_KEY
|
|
68
|
-
if paramNameValueArr[1].upcase.eql? 'TRUE'
|
|
69
|
-
result.extendableCookie = true
|
|
70
|
-
end
|
|
71
|
-
when QUEUE_ID_KEY
|
|
72
|
-
result.queueId = paramNameValueArr[1]
|
|
73
|
-
when REDIRECT_TYPE_KEY
|
|
74
|
-
result.redirectType = paramNameValueArr[1]
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
result.queueITTokenWithoutHash = result.queueITToken.gsub((KEY_VALUE_SEPARATOR_GROUP_CHAR + HASH_KEY + KEY_VALUE_SEPARATOR_CHAR + result.hashCode), "")
|
|
78
|
-
return result
|
|
79
|
-
end
|
|
80
|
-
end
|
|
1
|
+
module QueueIt
|
|
2
|
+
class QueueUrlParams
|
|
3
|
+
KEY_VALUE_SEPARATOR_GROUP_CHAR = '~'
|
|
4
|
+
KEY_VALUE_SEPARATOR_CHAR = '_'
|
|
5
|
+
TIMESTAMP_KEY = "ts"
|
|
6
|
+
COOKIE_VALIDITY_MINUTES_KEY = "cv"
|
|
7
|
+
EVENT_ID_KEY = "e"
|
|
8
|
+
EXTENDABLE_COOKIE_KEY = "ce"
|
|
9
|
+
HASH_KEY = "h"
|
|
10
|
+
QUEUE_ID_KEY = "q"
|
|
11
|
+
REDIRECT_TYPE_KEY = "rt"
|
|
12
|
+
|
|
13
|
+
attr_accessor :timeStamp
|
|
14
|
+
attr_accessor :eventId
|
|
15
|
+
attr_accessor :hashCode
|
|
16
|
+
attr_accessor :extendableCookie
|
|
17
|
+
attr_accessor :cookieValidityMinutes
|
|
18
|
+
attr_accessor :queueITToken
|
|
19
|
+
attr_accessor :queueITTokenWithoutHash
|
|
20
|
+
attr_accessor :queueId
|
|
21
|
+
attr_accessor :redirectType
|
|
22
|
+
|
|
23
|
+
def initialize
|
|
24
|
+
@timeStamp = 0
|
|
25
|
+
@eventId = ""
|
|
26
|
+
@hashCode = ""
|
|
27
|
+
@extendableCookie = false
|
|
28
|
+
@cookieValidityMinutes = nil
|
|
29
|
+
@queueITToken = ""
|
|
30
|
+
@queueITTokenWithoutHash = ""
|
|
31
|
+
@queueId = ""
|
|
32
|
+
@redirectType = nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.extractQueueParams(queueitToken)
|
|
36
|
+
if(Utils.isNilOrEmpty(queueitToken))
|
|
37
|
+
return nil
|
|
38
|
+
end
|
|
39
|
+
result = QueueUrlParams.new
|
|
40
|
+
result.queueITToken = queueitToken
|
|
41
|
+
paramsNameValueList = result.queueITToken.split(KEY_VALUE_SEPARATOR_GROUP_CHAR)
|
|
42
|
+
|
|
43
|
+
paramsNameValueList.each do |pNameValue|
|
|
44
|
+
paramNameValueArr = pNameValue.split(KEY_VALUE_SEPARATOR_CHAR)
|
|
45
|
+
|
|
46
|
+
if(!paramNameValueArr.length().eql? 2)
|
|
47
|
+
next
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
case paramNameValueArr[0]
|
|
51
|
+
when HASH_KEY
|
|
52
|
+
result.hashCode = paramNameValueArr[1]
|
|
53
|
+
when TIMESTAMP_KEY
|
|
54
|
+
if paramNameValueArr[1] !~ /\D/
|
|
55
|
+
result.timeStamp = paramNameValueArr[1].to_i
|
|
56
|
+
else
|
|
57
|
+
result.timeStamp = 0
|
|
58
|
+
end
|
|
59
|
+
when COOKIE_VALIDITY_MINUTES_KEY
|
|
60
|
+
if paramNameValueArr[1] !~ /\D/
|
|
61
|
+
result.cookieValidityMinutes = paramNameValueArr[1].to_i
|
|
62
|
+
else
|
|
63
|
+
result.cookieValidityMinutes = nil
|
|
64
|
+
end
|
|
65
|
+
when EVENT_ID_KEY
|
|
66
|
+
result.eventId = paramNameValueArr[1]
|
|
67
|
+
when EXTENDABLE_COOKIE_KEY
|
|
68
|
+
if paramNameValueArr[1].upcase.eql? 'TRUE'
|
|
69
|
+
result.extendableCookie = true
|
|
70
|
+
end
|
|
71
|
+
when QUEUE_ID_KEY
|
|
72
|
+
result.queueId = paramNameValueArr[1]
|
|
73
|
+
when REDIRECT_TYPE_KEY
|
|
74
|
+
result.redirectType = paramNameValueArr[1]
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
result.queueITTokenWithoutHash = result.queueITToken.gsub((KEY_VALUE_SEPARATOR_GROUP_CHAR + HASH_KEY + KEY_VALUE_SEPARATOR_CHAR + result.hashCode), "")
|
|
78
|
+
return result
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
81
|
end
|