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.
@@ -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 CancelEventConfig
23
- attr_accessor :eventId
24
- attr_accessor :queueDomain
25
- attr_accessor :cookieDomain
26
- attr_accessor :version
27
- attr_accessor :actionName
28
-
29
- def initialize
30
- @eventId = nil
31
- @queueDomain = nil
32
- @cookieDomain = nil
33
- @version = nil
34
- @actionName = "unspecified"
35
- end
36
-
37
- def toString
38
- return "EventId:" + Utils.toString(eventId) +
39
- "&Version:" + Utils.toString(version) +
40
- "&QueueDomain:" + Utils.toString(queueDomain) +
41
- "&CookieDomain:" + Utils.toString(cookieDomain) +
42
- "&ActionName:" + Utils.toString(actionName)
43
- end
44
- end
45
-
46
- class QueueEventConfig
47
- attr_accessor :eventId
48
- attr_accessor :layoutName
49
- attr_accessor :culture
50
- attr_accessor :queueDomain
51
- attr_accessor :extendCookieValidity
52
- attr_accessor :cookieValidityMinute
53
- attr_accessor :cookieDomain
54
- attr_accessor :version
55
- attr_accessor :actionName
56
-
57
- def initialize
58
- @eventId = nil
59
- @layoutName = nil
60
- @culture = nil
61
- @queueDomain = nil
62
- @extendCookieValidity = nil
63
- @cookieValidityMinute = nil
64
- @cookieDomain = nil
65
- @version = nil
66
- @actionName = "unspecified"
67
- end
68
-
69
- def toString
70
- return "EventId:" + Utils.toString(eventId) +
71
- "&Version:" + Utils.toString(version) +
72
- "&QueueDomain:" + Utils.toString(queueDomain) +
73
- "&CookieDomain:" + Utils.toString(cookieDomain) +
74
- "&ExtendCookieValidity:" + Utils.toString(extendCookieValidity) +
75
- "&CookieValidityMinute:" + Utils.toString(cookieValidityMinute) +
76
- "&LayoutName:" + Utils.toString(layoutName) +
77
- "&Culture:" + Utils.toString(culture) +
78
- "&ActionName:" + Utils.toString(actionName)
79
- end
80
- end
81
-
82
- class RequestValidationResult
83
- attr_reader :actionType
84
- attr_reader :eventId
85
- attr_reader :queueId
86
- attr_reader :redirectUrl
87
- attr_reader :redirectType
88
- attr_accessor :actionName
89
- attr_accessor :isAjaxResult
90
-
91
- def initialize(actionType, eventId, queueId, redirectUrl, redirectType, actionName)
92
- @actionType = actionType
93
- @eventId = eventId
94
- @queueId = queueId
95
- @redirectUrl = redirectUrl
96
- @redirectType = redirectType
97
- @actionName = actionName
98
- end
99
-
100
- def doRedirect
101
- return !Utils.isNilOrEmpty(@redirectUrl)
102
- end
103
-
104
- def getAjaxQueueRedirectHeaderKey
105
- return "x-queueit-redirect"
106
- end
107
-
108
- def getAjaxRedirectUrl
109
- if !Utils.isNilOrEmpty(@redirectUrl)
110
- return Utils.urlEncode(@redirectUrl)
111
- end
112
- return ""
113
- end
114
- end
115
-
116
- class KnownUserError < StandardError
117
- def initialize(message)
118
- super(message)
119
- end
120
- end
121
-
122
- class ActionTypes
123
- CANCEL = "Cancel"
124
- QUEUE = "Queue"
125
- IGNORE = "Ignore"
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