kount_complete 1.0.9 → 2.0.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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae7d7494a691a9ea03efd2d6a043989c33b9c0f515a1367ae2734ab954368594
4
- data.tar.gz: 3e7cad56158473246054a87efeaf546c17ce3107aab07135123777741f9525d5
3
+ metadata.gz: e922a5e36e327e583f752054dca2de9616ad66fa7ffd4f33b9d4d749c2ced26b
4
+ data.tar.gz: a519cbaa5397737daf744416c5e5b5ecda316cd7bd9700c000e7a397d0ffddc5
5
5
  SHA512:
6
- metadata.gz: 727537cdd538671965d3156f0b1b4b17d5028cc18e2379ec9085894420af013397c7910a019781cdec5a484be9a1cb446be277a2090ed3701aa23bcc03902274
7
- data.tar.gz: c741315e192dd9955ccb9450f6b030c63d9e36e474c3aaefa8f56a0e2ea681262e85630b73be6730996e4400867cc4914b4a99a34931a754b9d6cff820e6a2b2
6
+ metadata.gz: 59d9b02f738b98d2151ba485050ab40e8e89fd6b4e07ae8e5cd9bc299f177b98511a5ed76e91e3574521da05ba87a3c875d182abdf63b8b0a27bd3fdba929ae8
7
+ data.tar.gz: 2ab19bd5cee331b87fa43c4fb8f87635c4f6c5b14f57a5de72d6c8ac0413332d736ea3ac7b302bc95a58483638c217eb8969a57cdd4415385ed83abde31bbde4
data/lib/kount.rb CHANGED
@@ -20,7 +20,7 @@ module Kount
20
20
  # }
21
21
  # @param options Hash
22
22
  def new(options = {})
23
- fail ArgumentError, 'Config options required' if options.empty?
23
+ raise ArgumentError, 'Config options required' if options.empty?
24
24
  Client.new(options)
25
25
  end
26
26
 
@@ -1,457 +1,344 @@
1
1
  require 'json'
2
- module Response
3
2
 
3
+
4
+ module Response
4
5
  class Resp
5
6
  def initialize(paramlist)
6
7
  @paramlist = paramlist
7
8
  puts @paramlist
8
9
  end
9
10
 
10
- def getMode
11
- modes = @paramlist["MODE"].to_s()
12
- if !modes.empty?
13
- return modes
14
- end
15
-
11
+ def get_mode
12
+ modes = @paramlist['MODE'].to_s
13
+ return modes unless modes.empty?
16
14
  end
17
15
 
18
- def getVersion
19
- vers = @paramlist["VERS"].to_s()
20
- if !vers.empty?
21
- return vers
22
- end
16
+ def get_version
17
+ vers = @paramlist['VERS'].to_s
18
+ return vers unless vers.empty?
23
19
  end
24
20
 
25
- def getTransactionId
26
- tran = @paramlist["TRAN"].to_s()
27
- if !tran.empty?
28
- return tran
29
- end
21
+ def get_transaction_id
22
+ tran = @paramlist['TRAN'].to_s
23
+ return tran unless tran.empty?
30
24
  end
31
25
 
32
- def getMerchantId
33
- merchantid = @paramlist["MERC"].to_s()
34
- if !merchantid.empty?
35
- return merchantid
36
- end
26
+ def get_merchant_id
27
+ merchantid = @paramlist['MERC'].to_s
28
+ return merchantid unless merchantid.empty?
37
29
  end
38
30
 
39
- def getSessionId
40
- sessionid = @paramlist["SESS"].to_s()
41
- if !sessionid.empty?
42
- return sessionid
43
- end
31
+ def get_session_id
32
+ sessionid = @paramlist['SESS'].to_s
33
+ return sessionid unless sessionid.empty?
44
34
  end
45
35
 
46
- def getOrderNumber
47
- orderno = @paramlist["ORDR"].to_s()
48
- if !orderno.empty?
49
- return orderno
50
- end
36
+ def get_order_number
37
+ orderno = @paramlist['ORDR'].to_s
38
+ return orderno unless orderno.empty?
51
39
  end
52
40
 
53
- def getSite
54
- site = @paramlist["SITE"].to_s()
55
- if !site.empty?
56
- return site
57
- end
41
+ def get_site
42
+ site = @paramlist['SITE'].to_s
43
+ return site unless site.empty?
58
44
  end
59
45
 
60
- def getAuto
61
- auto = @paramlist["AUTO"].to_s()
62
- if !auto.empty?
63
- return auto
64
- end
46
+ def get_auto
47
+ auto = @paramlist['AUTO'].to_s
48
+ return auto unless auto.empty?
65
49
  end
66
50
 
67
- def getScore
68
- score = @paramlist["SCOR"].to_s()
69
- if !score.empty?
70
- return score
71
- end
51
+ def get_score
52
+ score = @paramlist['SCOR'].to_s
53
+ return score unless score.empty?
72
54
  end
73
55
 
74
- def getOmniscore
75
- omniscore = @paramlist['OMNISCORE'].to_s()
76
- if !omniscore.empty?
77
- return omniscore
78
- end
56
+ def get_omniscore
57
+ omniscore = @paramlist['OMNISCORE'].to_s
58
+ return omniscore unless omniscore.empty?
79
59
  end
80
60
 
81
- def getGeox
82
- geox = @paramlist["GEOX"].to_s()
83
- if !geox.empty?
84
- return geox
85
- end
61
+ def get_geox
62
+ geox = @paramlist['GEOX'].to_s
63
+ return geox unless geox.empty?
86
64
  end
87
65
 
88
- def getBrand
89
- brand = @paramlist["BRND"].to_s()
90
- if !brand.empty?
91
- return brand
92
- end
66
+ def get_brand
67
+ brand = @paramlist['BRND'].to_s
68
+ return brand unless brand.empty?
93
69
  end
94
70
 
95
- def getVelo
96
- velo = @paramlist["VELO"].to_s()
97
- if !velo.empty?
98
- return velo
99
- end
71
+ def get_velo
72
+ velo = @paramlist['VELO'].to_s
73
+ return velo unless velo.empty?
100
74
  end
101
75
 
102
- def getVmax
103
- vmax = @paramlist["VMAX"].to_s()
104
- if !vmax.empty?
105
- return vmax
106
- end
76
+ def get_vmax
77
+ vmax = @paramlist['VMAX'].to_s
78
+ return vmax unless vmax.empty?
107
79
  end
108
80
 
109
- def getNetwork
110
- network = @paramlist["NETW"].to_s()
111
- if !network.empty?
112
- return network
113
- end
81
+ def get_network
82
+ network = @paramlist['NETW'].to_s
83
+ return network unless network.empty?
114
84
  end
115
85
 
116
- def getRegion
117
- region = @paramlist["REGN"].to_s()
118
- if !region.empty?
119
- return region
120
- end
86
+ def get_region
87
+ region = @paramlist['REGN'].to_s
88
+ return region unless region.empty?
121
89
  end
122
90
 
123
- def getKaptcha
124
- kapt = @paramlist["KAPT"].to_s()
125
- if !kapt.empty?
126
- return kapt
127
- end
91
+ def get_kaptcha
92
+ kapt = @paramlist['KAPT'].to_s
93
+ return kapt unless kapt.empty?
128
94
  end
129
95
 
130
- def getProxy
131
- proxy = @paramlist["PROXY"].to_s()
132
- if !proxy.empty?
133
- return proxy
134
- end
96
+ def get_proxy
97
+ proxy = @paramlist['PROXY'].to_s
98
+ return proxy unless proxy.empty?
135
99
  end
136
100
 
137
- def getEmails
138
- email = @paramlist["EMAILS"].to_s()
139
- if !email.empty?
140
- return email
141
- end
101
+ def get_emails
102
+ email = @paramlist['EMAILS'].to_s
103
+ return email unless email.empty?
142
104
  end
143
105
 
144
- def getHttpCountry
145
- httmcountry = @paramlist["HTTP_COUNTRY"].to_s()
146
- if !httmcountry.empty?
147
- return httmcountry
148
- end
106
+ def get_http_country
107
+ httmcountry = @paramlist['HTTP_COUNTRY'].to_s
108
+ return httmcountry unless httmcountry.empty?
149
109
  end
150
110
 
151
- def getTimeZone
152
- timezone = @paramlist["TIMEZONE"].to_s()
153
- if !timezone.empty?
154
- return timezone
155
- end
111
+ def get_timezone
112
+ timezone = @paramlist['TIMEZONE'].to_s
113
+ return timezone unless timezone.empty?
156
114
  end
157
115
 
158
- def getCards
159
- cards = @paramlist["CARDS"].to_s()
160
- if !cards.empty?
161
- return cards
162
- end
116
+ def get_cards
117
+ cards = @paramlist['CARDS'].to_s
118
+ return cards unless cards.empty?
163
119
  end
164
120
 
165
- def getPcRemote
166
- pcremote = @paramlist["PC_REMOTE"].to_s()
167
- if !pcremote.empty?
168
- return pcremote
169
- end
121
+ def get_pc_remote
122
+ pcremote = @paramlist['PC_REMOTE'].to_s
123
+ return pcremote unless pcremote.empty?
170
124
  end
171
125
 
172
- def getDevices
173
- devices = @paramlist["DEVICES"].to_s()
174
- if !devices.empty?
175
- return devices
176
- end
126
+ def get_devices
127
+ devices = @paramlist['DEVICES'].to_s
128
+ return devices unless devices.empty?
177
129
  end
178
130
 
179
- def getDeviceLayers
180
- device_layers = @paramlist["DEVICE_LAYERS"].to_s()
181
- if !device_layers.empty?
182
- return device_layers
183
- end
131
+ def get_device_layers
132
+ device_layers = @paramlist['DEVICE_LAYERS'].to_s
133
+ return device_layers unless device_layers.empty?
184
134
  end
185
135
 
186
- def getMobileForwarder
187
- mobile_forwarder = @paramlist["MOBILE_FORWARDER"].to_s()
188
- if !mobile_forwarder.empty?
189
- return mobile_forwarder
190
- end
136
+ def get_mobile_forwarder
137
+ mobile_forwarder = @paramlist['MOBILE_FORWARDER'].to_s
138
+ return mobile_forwarder unless mobile_forwarder.empty?
191
139
  end
192
140
 
193
- def getVoiceDevice
194
- voicedevice = @paramlist["VOICE_DEVICE"].to_s()
195
- if !voicedevice.empty?
196
- return voicedevice
197
- end
141
+ def get_voice_device
142
+ voicedevice = @paramlist['VOICE_DEVICE'].to_s
143
+ return voicedevice unless voicedevice.empty?
198
144
  end
199
145
 
200
- def getLocalTime
201
- localtime = @paramlist["LOCALTIME"].to_s()
202
- if !localtime.empty?
203
- return localtime
204
- end
146
+ def get_local_time
147
+ localtime = @paramlist['LOCALTIME'].to_s
148
+ return localtime unless localtime.empty?
205
149
  end
206
150
 
207
- def getMobileType
208
- mobiletype = @paramlist["MOBILE_TYPE"].to_s()
209
- if !mobiletype.empty?
210
- return mobiletype
211
- end
151
+ def get_mobile_type
152
+ mobiletype = @paramlist['MOBILE_TYPE'].to_s
153
+ return mobiletype unless mobiletype.empty?
212
154
  end
213
155
 
214
- def getFingerPrint
215
- fingerprint = @paramlist["FINGERPRINT"].to_s()
216
- if !fingerprint.empty?
217
- return fingerprint
218
- end
156
+ def get_fingerprint
157
+ fingerprint = @paramlist['FINGERPRINT'].to_s
158
+ return fingerprint unless fingerprint.empty?
219
159
  end
220
160
 
221
- def getFlash
222
- flash = @paramlist["FLASH"].to_s()
223
- if !flash.empty?
224
- return flash
225
- end
161
+ def get_flash
162
+ flash = @paramlist['FLASH'].to_s
163
+ return flash unless flash.empty?
226
164
  end
227
165
 
228
- def getLanguage
229
- language = @paramlist["LANGUAGE"].to_s()
230
- if !language.empty?
231
- return language
232
- end
166
+ def get_language
167
+ language = @paramlist['LANGUAGE'].to_s
168
+ return language unless language.empty?
233
169
  end
234
170
 
235
- def getCountry
236
- country = @paramlist["COUNTRY"].to_s()
237
- if !country.empty?
238
- return country
239
- end
171
+ def get_country
172
+ country = @paramlist['COUNTRY'].to_s
173
+ return country unless country.empty?
240
174
  end
241
175
 
242
- def getJavaScript
243
- javascript = @paramlist["JAVASCRIPT"].to_s()
244
- if !javascript.empty?
245
- return javascript
246
- end
176
+ def get_javascript
177
+ javascript = @paramlist['JAVASCRIPT'].to_s
178
+ return javascript unless javascript.empty?
247
179
  end
248
180
 
249
- def getCookies
250
- cookie = @paramlist["COOKIES"].to_s()
251
- if !cookie.empty?
252
- return cookie
253
- end
181
+ def get_cookies
182
+ cookie = @paramlist['COOKIES'].to_s
183
+ return cookie unless cookie.empty?
254
184
  end
255
185
 
256
- def getMobileDevice
257
- mobiledevice = @paramlist["MOBILE_DEVICE"].to_s()
258
- if !mobiledevice.empty?
259
- return mobiledevice
260
- end
186
+ def get_mobile_device
187
+ mobiledevice = @paramlist['MOBILE_DEVICE'].to_s
188
+ return mobiledevice unless mobiledevice.empty?
261
189
  end
262
190
 
263
- def getPiercedIPAddress
264
- pip_address = @paramlist["PIP_IPAD"].to_s()
265
- if !pip_address.empty?
266
- return pip_address
267
- end
191
+ def get_pierced_ipaddress
192
+ pip_address = @paramlist['PIP_IPAD'].to_s
193
+ return pip_address unless pip_address.empty?
268
194
  end
269
195
 
270
- def getPiercedIPAddressLatitude
271
- pip_lat = @paramlist["PIP_LAT"].to_s()
272
- if !pip_lat.empty?
273
- return pip_lat
274
- end
196
+ def get_piercedipaddress_latitude
197
+ pip_lat = @paramlist['PIP_LAT'].to_s
198
+ return pip_lat unless pip_lat.empty?
275
199
  end
276
200
 
277
- def getPiercedIPAddressLongitude
278
- pip_long = @paramlist["PIP_LON"].to_s()
279
- if !pip_long.empty?
280
- return pip_long
281
- end
201
+ def get_piercedipaddress_longitude
202
+ pip_long = @paramlist['PIP_LON'].to_s
203
+ return pip_long unless pip_long.empty?
282
204
  end
283
205
 
284
- def getPiercedIPAddressCountry
285
- pip_country = @paramlist["PIP_COUNTRY"].to_s()
286
- if !pip_country.empty?
287
- return pip_country
288
- end
206
+ def get_piercedipaddress_country
207
+ pip_country = @paramlist['PIP_COUNTRY'].to_s
208
+ return pip_country unless pip_country.empty?
289
209
  end
290
210
 
291
- def getPiercedIPAddressRegion
292
- pip_region = @paramlist["PIP_REGION"].to_s()
293
- if !pip_region.empty?
294
- return pip_region
295
- end
211
+ def get_piercedipaddress_region
212
+ pip_region = @paramlist['PIP_REGION'].to_s
213
+ return pip_region unless pip_region.empty?
296
214
  end
297
215
 
298
- def getPiercedIPAddressCity
299
- pip_city = @paramlist["PIP_CITY"].to_s()
300
- if !pip_city.empty?
301
- return pip_city
302
- end
216
+ def get_piercedipaddress_city
217
+ pip_city = @paramlist['PIP_CITY'].to_s
218
+ return pip_city unless pip_city.empty?
303
219
  end
304
220
 
305
- def getPiercedIPAddressOrganization
306
- pip_org = @paramlist["PIP_ORG"].to_s()
307
- if !pip_org.empty?
308
- return pip_org
309
- end
221
+ def get_piercedipaddress_organization
222
+ pip_org = @paramlist['PIP_ORG'].to_s
223
+ return pip_org unless pip_org.empty?
310
224
  end
311
225
 
312
- def getIPAddress
313
- ip_ipad = @paramlist["IP_IPAD"].to_s()
314
- if !ip_ipad.empty?
315
- return ip_ipad
316
- end
226
+ def get_ipaddress
227
+ ip_ipad = @paramlist['IP_IPAD'].to_s
228
+ return ip_ipad unless ip_ipad.empty?
317
229
  end
318
230
 
319
- def getIPAddressLatitude
320
- ip_lat = @paramlist["IP_LAT"].to_s()
321
- if !ip_lat.empty?
322
- return ip_lat
323
- end
231
+ def get_ipaddress_latitude
232
+ ip_lat = @paramlist['IP_LAT'].to_s
233
+ return ip_lat unless ip_lat.empty?
324
234
  end
325
235
 
326
- def getIPAddressLongitude
327
- ip_long = @paramlist["IP_LON"].to_s()
328
- if !ip_long.empty?
329
- return ip_long
330
- end
236
+ def get_ipaddress_longitude
237
+ ip_long = @paramlist['IP_LON'].to_s
238
+ return ip_long unless ip_long.empty?
331
239
  end
332
240
 
333
- def getIPAddressCountry
334
- ip_country = @paramlist["IP_COUNTRY"].to_s()
335
- if !ip_country.empty?
336
- return ip_country
337
- end
241
+ def get_ipaddress_country
242
+ ip_country = @paramlist['IP_COUNTRY'].to_s
243
+ return ip_country unless ip_country.empty?
338
244
  end
339
245
 
340
- def getIPAddressRegion
341
- ip_region = @paramlist["IP_REGION"].to_s()
342
- if !ip_region.empty?
343
- return ip_region
344
- end
246
+ def get_ipaddress_region
247
+ ip_region = @paramlist['IP_REGION'].to_s
248
+ return ip_region unless ip_region.empty?
345
249
  end
346
250
 
347
- def getIPAddressCity
348
- ip_city = @paramlist["IP_CITY"].to_s()
349
- if !ip_city.empty?
350
- return ip_city
351
- end
251
+ def get_ipaddress_city
252
+ ip_city = @paramlist['IP_CITY'].to_s
253
+ return ip_city unless ip_city.empty?
352
254
  end
353
255
 
354
- def getIPAddressOrganization
355
- ip_org = @paramlist["IP_ORG"].to_s()
356
- if !ip_org.empty?
357
- return ip_org
358
- end
256
+ def get_ipaddress_organization
257
+ ip_org = @paramlist['IP_ORG'].to_s
258
+ return ip_org unless ip_org.empty?
359
259
  end
360
260
 
361
- def getDateDeviceFirstSeen
362
- ddfs = @paramlist["DDFS"].to_s()
363
- if !ddfs.empty?
364
- return ddfs
365
- end
261
+ def get_date_device_firstseen
262
+ ddfs = @paramlist['DDFS'].to_s
263
+ return ddfs unless ddfs.empty?
366
264
  end
367
265
 
368
- def getUserAgentString
369
- user_agent = @paramlist["UAS"].to_s()
370
- if !user_agent.empty?
371
- return user_agent
372
- end
266
+ def get_useragent_string
267
+ user_agent = @paramlist['UAS'].to_s
268
+ return user_agent unless user_agent.empty?
373
269
  end
374
270
 
375
- def getDeviceScreenResolution
376
- dsr = @paramlist["DSR"].to_s()
377
- if !dsr.empty?
378
- return dsr
379
- end
271
+ def get_devicescreen_resolution
272
+ dsr = @paramlist['DSR'].to_s
273
+ return dsr unless dsr.empty?
380
274
  end
381
275
 
382
- def getOS
383
- os = @paramlist["OS"].to_s()
384
- if !os.empty?
385
- return os
386
- end
276
+ def get_os
277
+ os = @paramlist['OS'].to_s
278
+ return os unless os.empty?
387
279
  end
388
280
 
389
- def getBrowser
390
- browser = @paramlist["BROWSER"].to_s()
391
- if !browser.empty?
392
- return browser
393
- end
281
+ def get_browser
282
+ browser = @paramlist['BROWSER'].to_s
283
+ return browser unless browser.empty?
394
284
  end
395
285
 
396
- def getNumberRulesTriggered
397
- no_rules_triggered = @paramlist["RULES_TRIGGERED"].to_s()
398
- return no_rules_triggered
286
+ def get_numberrules_triggered
287
+ no_rules_triggered = @paramlist['RULES_TRIGGERED'].to_s
288
+ no_rules_triggered
399
289
  end
400
290
 
401
- def getRulesTriggered
402
- rules_count = getNumberRulesTriggered()
403
- rules = Array.new
404
- for i in 0..rules_count.to_i()-1
291
+ def get_rules_triggered
292
+ rules_count = get_numberrules_triggered
293
+ rules = []
294
+ (0..rules_count.to_i - 1).each do |i|
405
295
  ruleid = @paramlist["RULE_ID_#{i}"]
406
- rules[ruleid.to_i()] = @paramlist["RULE_DESCRIPTION_#{i}"]
296
+ rules[ruleid.to_i] = @paramlist["RULE_DESCRIPTION_#{i}"]
407
297
  end
408
- return rules.compact
409
-
298
+ rules.compact
410
299
  end
411
300
 
412
- def getWarningCount
413
- warning_count = @paramlist["WARNING_COUNT"].to_s()
414
- return warning_count
301
+ def get_warning_count
302
+ warning_count = @paramlist['WARNING_COUNT'].to_s
303
+ warning_count
415
304
  end
416
305
 
417
- def getWarnings
418
- warnings = Array.new
419
- warningcount = getWarningCount()
420
- for i in 0..warningcount.to_i()-1
306
+ def get_warnings
307
+ warnings = []
308
+ warningcount = get_warning_count
309
+ (0..warningcount.to_i - 1).each do |i|
421
310
  warnings = @paramlist["WARNING_#{i}"]
422
311
  end
423
- return warnings.compact
312
+ warnings.compact
424
313
  end
425
314
 
426
- def getErrorCount
427
- errorcount = @paramlist["ERROR_COUNT"].to_s()
428
- return errorcount
315
+ def get_error_count
316
+ errorcount = @paramlist['ERROR_COUNT'].to_s
317
+ errorcount
429
318
  end
430
319
 
431
- def getErrors
432
- errors = Array.new
433
- error_count = getErrorCount()
434
- for i in 0..error_count.to_i()-1
320
+ def geterrors
321
+ errors = []
322
+ error_count = get_error_count
323
+ (0..error_count.to_i - 1).each do |i|
435
324
  errors = @paramlist["ERROR_#{i}"]
436
325
  end
437
- return errors.compact
326
+ errors.compact
438
327
  end
439
328
 
440
- def getNumberCountersTriggered
441
- count_triggered = @paramlist["COUNTERS_TRIGGERED"].to_s()
442
- return count_triggered
329
+ def get_numbercounters_triggered
330
+ count_triggered = @paramlist['COUNTERS_TRIGGERED'].to_s
331
+ count_triggered
443
332
  end
444
333
 
445
- def getCountersTriggered
446
- counters = Array.new
447
- numCounters = getCountersTriggered()
448
- for i in 0..counters.to_i()-1
334
+ def get_counters_triggered
335
+ counters = []
336
+ numCounters = get_numbercounters_triggered
337
+ (0..numCounters.to_i - 1).each do |i|
449
338
  countername = @paramlist["COUNTER_NAME_#{i}"]
450
- counters[countername.to_s()] = @paramlist["COUNTER_VALUE_#{i}"]
339
+ counters[countername.to_s] = @paramlist["COUNTER_VALUE_#{i}"]
451
340
  end
452
- return counters.compact
341
+ counters.compact
453
342
  end
454
-
455
343
  end
456
-
457
- end
344
+ end
data/lib/kount/client.rb CHANGED
@@ -7,7 +7,7 @@ require 'rest-client'
7
7
  require 'uri'
8
8
  require 'kount/utils/khash'
9
9
 
10
- # rubocop:disable Style/ClassVars
10
+
11
11
  module Kount
12
12
  ##
13
13
  # This class is where the primary interaction with
@@ -30,13 +30,15 @@ module Kount
30
30
  PROD_DEFAULT_OPTIONS = {
31
31
  endpoint: ENDPOINT_PROD,
32
32
  version: DEFAULT_VERSION,
33
- is_test: false
33
+ is_test: false,
34
+ timeout: 10
34
35
  }
35
36
 
36
37
  # Default params for test if is_test is TRUE
37
38
  TEST_DEFAULT_OPTIONS = {
38
39
  endpoint: ENDPOINT_TEST,
39
- version: DEFAULT_VERSION
40
+ version: DEFAULT_VERSION,
41
+ timeout: 10
40
42
  }
41
43
 
42
44
  # Initialize a client object
@@ -66,10 +68,11 @@ module Kount
66
68
  begin
67
69
  response = RestClient::Resource.new(
68
70
  endpoint,
69
- verify_ssl: verify_ssl_option, timeout: 1).post params, x_kount_api_key: key
71
+ verify_ssl: verify_ssl_option, timeout: timeout
72
+ ).post params, x_kount_api_key: key
70
73
 
71
74
  JSON.parse(response)
72
- rescue
75
+ rescue StandardError
73
76
  # RIS errors do not come back as JSON, so just pass them along raw.
74
77
  response
75
78
  end
data/lib/kount/request.rb CHANGED
@@ -12,7 +12,7 @@ module Kount
12
12
  #
13
13
  # @param initial_params [Hash] Initial params for request
14
14
  def initialize(initial_params = {})
15
- fail "Cannot directly instantiate a #{self.class}." if
15
+ raise "Cannot directly instantiate a #{self.class}." if
16
16
  self.class == Request
17
17
  @params = initial_params
18
18
  end
@@ -40,14 +40,14 @@ module Kount
40
40
  case params[:PTYP]
41
41
  when 'CARD', 'TOKEN'
42
42
  #ptok = Kount::SecurityMash.hash_credit_card(ptok, ksalt)
43
- ptok = Kount::Khash.HashPaymentToken(ptok, ksalt)
43
+ ptok = Kount::Khash.hash_payment_token(ptok, ksalt)
44
44
  params.merge!(PTOK: ptok, PENC: 'KHASH')
45
45
  when 'GIFT', 'OTHER'
46
46
  #ptok = Kount::SecurityMash.hash_gift_card(ptok, ksalt, merchant_id)
47
- ptok = Kount::Khash.HashGiftCard(ptok, ksalt, merchant_id)
47
+ ptok = Kount::Khash.hash_gift_card(ptok, ksalt, merchant_id)
48
48
  params.merge!(PTOK: ptok, PENC: 'KHASH')
49
49
  when 'CHEK', 'OTHER'
50
- ptok = Kount::Khash.HashCheckPayment(ptok, ksalt)
50
+ ptok = Kount::Khash.hash_check_payment(ptok, ksalt)
51
51
  params.merge!(PTOK: ptok, PENC: 'KHASH')
52
52
  when 'NONE'
53
53
  params.merge!(PTOK: nil, PENC: nil)
@@ -2,7 +2,7 @@ require 'digest/sha1'
2
2
  module Kount
3
3
  ##
4
4
  # This class implements the Kount KHASH for cards and gift cards.
5
- # rubocop:disable Style/Documentation
5
+
6
6
  class SecurityMash
7
7
  # @param plain_text [String] String to be hashed
8
8
  # @param ptyp [String] Payment type code: CARD, GIFT, or OTHER
@@ -13,7 +13,7 @@ module Kount
13
13
  end
14
14
  end
15
15
 
16
- def self.getKhash(data, len, m)
16
+ def self.getkhash(data, len, m)
17
17
  a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
18
18
  r = Digest::SHA1.hexdigest("#{data}.#{m}")
19
19
  c = ''
@@ -27,20 +27,20 @@ module Kount
27
27
  c
28
28
  end
29
29
 
30
- def self.HashPaymentToken(plain_text, ksalt)
30
+ def self.hash_payment_token(plain_text, ksalt)
31
31
  first_six = plain_text[0..5]
32
- mashed = getKhash(plain_text, 14, ksalt)
32
+ mashed = getkhash(plain_text, 14, ksalt)
33
33
  "#{first_six}#{mashed}"
34
34
  end
35
35
 
36
- def self.HashCheckPayment(plain_text, ksalt)
36
+ def self.hash_check_payment(plain_text, ksalt)
37
37
  first_six = plain_text[0..5]
38
- mashed = getKhash(plain_text, 14, ksalt)
38
+ mashed = getkhash(plain_text, 14, ksalt)
39
39
  "#{first_six}#{mashed}"
40
40
  end
41
41
 
42
- def self.HashGiftCard(plain_text, ksalt, merchant_id)
43
- mashed = getKhash(plain_text, 14, ksalt)
42
+ def self.hash_gift_card(plain_text, ksalt, merchant_id)
43
+ mashed = getkhash(plain_text, 14, ksalt)
44
44
  "#{merchant_id}#{mashed}"
45
45
  end
46
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kount_complete
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kount
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-29 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -72,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.9.3
75
+ version: '2.3'
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="