VoiceIt2 3.6.0 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/VoiceIt2.rb +108 -105
  3. metadata +6 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 487e1b81faba95b374b437a23aa1d186a617d6e3b2abe6b5e98638d6be988907
4
- data.tar.gz: d5bd2751d68c50a536ef5819867cc65c6ed23151b45556809cb5641ad6031088
3
+ metadata.gz: bc3141c79ab475e4f981e2e4b0af39f36bece12e64b9befeebae062f85ff6000
4
+ data.tar.gz: 7edf0e9aa716822c66e765787a5c5a24e3dcaeffa37416eff0eda1cc5c0f4877
5
5
  SHA512:
6
- metadata.gz: 80c096ed18d8ad77c8e1175fd3669463edd628fc327c22ef18531a74ddf3d6e55ac45f3d16df1db1ae291ca540f629217cdb52b050f2d248e9b2d0f3eede19ea
7
- data.tar.gz: 76cc28e5273fe79085e1559d04a8804a1eab3f72366b9e323e0adbb095c08825013f70d7a55fdc9501b75fb751fdb3fef4be922f5569bc828e6bc551c226a79e
6
+ metadata.gz: 9ebbd6a631a98a35f2d8f522815ed8a0e49701c309364b70ff1f3f68ce9e85e1839bc1256b29a4358ad31e00a7c66135cc933004a7a4085405ba064219302a53
7
+ data.tar.gz: 1857057ff0ba575df1f1184f71dfab39585241874fb8f9645922fef98f937697c564ce3aad86dbbb6d1db1bcbbc8ef65b2da3b8363c56ec7bd731e1b75545bdd
data/VoiceIt2.rb CHANGED
@@ -5,10 +5,11 @@ require 'cgi'
5
5
 
6
6
  class VoiceIt2
7
7
 
8
- BASE_URL = 'https://api.voiceit.io/'
9
- VERSION = '3.6.0'
8
+ VERSION = '3.7.1'
9
+ PLATFORM_ID = '35'
10
10
 
11
- def initialize(key, tok)
11
+ def initialize(key, tok, custom_url='https://api.voiceit.io')
12
+ @base_url = custom_url
12
13
  @notification_url = ""
13
14
  @api_key = key
14
15
  @api_token = tok
@@ -25,11 +26,11 @@ class VoiceIt2
25
26
  def getAllUsers
26
27
  return RestClient::Request.new(
27
28
  :method => :get,
28
- :url => BASE_URL + 'users' + @notification_url,
29
+ :url => @base_url + '/users' + @notification_url,
29
30
  :user => @api_key,
30
31
  :password => @api_token,
31
32
  :headers => {
32
- platformId: '35',
33
+ platformId: PLATFORM_ID,
33
34
  platformVersion: VERSION
34
35
  }).execute
35
36
  rescue => e
@@ -39,11 +40,11 @@ class VoiceIt2
39
40
  def createUser
40
41
  return RestClient::Request.new(
41
42
  :method => :post,
42
- :url => BASE_URL + 'users' + @notification_url,
43
+ :url => @base_url + '/users' + @notification_url,
43
44
  :user => @api_key,
44
45
  :password => @api_token,
45
46
  :headers => {
46
- platformId: '35',
47
+ platformId: PLATFORM_ID,
47
48
  platformVersion: VERSION
48
49
  }).execute
49
50
  rescue => e
@@ -53,11 +54,11 @@ class VoiceIt2
53
54
  def checkUserExists(userId)
54
55
  return RestClient::Request.new(
55
56
  :method => :get,
56
- :url => BASE_URL + 'users/' + userId + @notification_url,
57
+ :url => @base_url + '/users/' + userId + @notification_url,
57
58
  :user => @api_key,
58
59
  :password => @api_token,
59
60
  :headers => {
60
- platformId: '35',
61
+ platformId: PLATFORM_ID,
61
62
  platformVersion: VERSION
62
63
  }).execute
63
64
  rescue => e
@@ -67,11 +68,11 @@ class VoiceIt2
67
68
  def deleteUser(userId)
68
69
  return RestClient::Request.new(
69
70
  :method => :delete,
70
- :url => BASE_URL + 'users/' + userId + @notification_url,
71
+ :url => @base_url + '/users/' + userId + @notification_url,
71
72
  :user => @api_key,
72
73
  :password => @api_token,
73
74
  :headers => {
74
- platformId: '35',
75
+ platformId: PLATFORM_ID,
75
76
  platformVersion: VERSION
76
77
  }).execute
77
78
 
@@ -82,11 +83,11 @@ class VoiceIt2
82
83
  def createManagedSubAccount(firstName, lastName, email, password, contentLanguage)
83
84
  return RestClient::Request.new(
84
85
  :method => :post,
85
- :url => BASE_URL + 'subaccount/managed' + @notification_url,
86
+ :url => @base_url + '/subaccount/managed' + @notification_url,
86
87
  :user => @api_key,
87
88
  :password => @api_token,
88
89
  :headers => {
89
- platformId: '35',
90
+ platformId: PLATFORM_ID,
90
91
  platformVersion: VERSION
91
92
  },
92
93
  :payload => {
@@ -108,11 +109,11 @@ class VoiceIt2
108
109
  def switchSubAccountType(subAccountAPIKey)
109
110
  return RestClient::Request.new(
110
111
  :method => :post,
111
- :url => BASE_URL + 'subaccount/' + subAccountAPIKey + '/switchType' + @notification_url,
112
+ :url => @base_url + '/subaccount/' + subAccountAPIKey + '/switchType' + @notification_url,
112
113
  :user => @api_key,
113
114
  :password => @api_token,
114
115
  :headers => {
115
- platformId: '35',
116
+ platformId: PLATFORM_ID,
116
117
  platformVersion: VERSION
117
118
  }).execute
118
119
  rescue => e
@@ -122,11 +123,11 @@ class VoiceIt2
122
123
  def createUnmanagedSubAccount(firstName, lastName, email, password, contentLanguage)
123
124
  return RestClient::Request.new(
124
125
  :method => :post,
125
- :url => BASE_URL + 'subaccount/unmanaged' + @notification_url,
126
+ :url => @base_url + '/subaccount/unmanaged' + @notification_url,
126
127
  :user => @api_key,
127
128
  :password => @api_token,
128
129
  :headers => {
129
- platformId: '35',
130
+ platformId: PLATFORM_ID,
130
131
  platformVersion: VERSION
131
132
  },
132
133
  :payload => {
@@ -148,11 +149,11 @@ class VoiceIt2
148
149
  def regenerateSubAccountAPIToken(subAccountAPIKey)
149
150
  return RestClient::Request.new(
150
151
  :method => :post,
151
- :url => BASE_URL + 'subaccount/' + subAccountAPIKey + @notification_url,
152
+ :url => @base_url + '/subaccount/' + subAccountAPIKey + @notification_url,
152
153
  :user => @api_key,
153
154
  :password => @api_token,
154
155
  :headers => {
155
- platformId: '35',
156
+ platformId: PLATFORM_ID,
156
157
  platformVersion: VERSION
157
158
  }).execute
158
159
  rescue => e
@@ -162,11 +163,11 @@ class VoiceIt2
162
163
  def deleteSubAccount(subAccountAPIKey)
163
164
  return RestClient::Request.new(
164
165
  :method => :delete,
165
- :url => BASE_URL + 'subaccount/' + subAccountAPIKey + @notification_url,
166
+ :url => @base_url + '/subaccount/' + subAccountAPIKey + @notification_url,
166
167
  :user => @api_key,
167
168
  :password => @api_token,
168
169
  :headers => {
169
- platformId: '35',
170
+ platformId: PLATFORM_ID,
170
171
  platformVersion: VERSION
171
172
  }).execute
172
173
 
@@ -177,11 +178,11 @@ class VoiceIt2
177
178
  def getGroupsForUser(userId)
178
179
  return RestClient::Request.new(
179
180
  :method => :get,
180
- :url => BASE_URL + 'users/' + userId + '/groups' + @notification_url,
181
+ :url => @base_url + '/users/' + userId + '/groups' + @notification_url,
181
182
  :user => @api_key,
182
183
  :password => @api_token,
183
184
  :headers => {
184
- platformId: '35',
185
+ platformId: PLATFORM_ID,
185
186
  platformVersion: VERSION
186
187
  }).execute
187
188
 
@@ -192,11 +193,11 @@ class VoiceIt2
192
193
  def getAllVoiceEnrollments(userId)
193
194
  return RestClient::Request.new(
194
195
  :method => :get,
195
- :url => BASE_URL + 'enrollments/voice/' + userId + @notification_url,
196
+ :url => @base_url + '/enrollments/voice/' + userId + @notification_url,
196
197
  :user => @api_key,
197
198
  :password => @api_token,
198
199
  :headers => {
199
- platformId: '35',
200
+ platformId: PLATFORM_ID,
200
201
  platformVersion: VERSION
201
202
  }).execute
202
203
 
@@ -207,11 +208,11 @@ class VoiceIt2
207
208
  def getAllVideoEnrollments(userId)
208
209
  return RestClient::Request.new(
209
210
  :method => :get,
210
- :url => BASE_URL + 'enrollments/video/' + userId + @notification_url,
211
+ :url => @base_url + '/enrollments/video/' + userId + @notification_url,
211
212
  :user => @api_key,
212
213
  :password => @api_token,
213
214
  :headers => {
214
- platformId: '35',
215
+ platformId: PLATFORM_ID,
215
216
  platformVersion: VERSION
216
217
  }).execute
217
218
 
@@ -222,11 +223,11 @@ class VoiceIt2
222
223
  def deleteAllEnrollments(userId)
223
224
  return RestClient::Request.new(
224
225
  :method => :delete,
225
- :url => BASE_URL + 'enrollments/' + userId + '/all' + @notification_url,
226
+ :url => @base_url + '/enrollments/' + userId + '/all' + @notification_url,
226
227
  :user => @api_key,
227
228
  :password => @api_token,
228
229
  :headers => {
229
- platformId: '35',
230
+ platformId: PLATFORM_ID,
230
231
  platformVersion: VERSION
231
232
  }).execute
232
233
 
@@ -237,11 +238,11 @@ class VoiceIt2
237
238
  def getAllFaceEnrollments(userId)
238
239
  return RestClient::Request.new(
239
240
  :method => :get,
240
- :url => BASE_URL + 'enrollments/face/' + userId + @notification_url,
241
+ :url => @base_url + '/enrollments/face/' + userId + @notification_url,
241
242
  :user => @api_key,
242
243
  :password => @api_token,
243
244
  :headers => {
244
- platformId: '35',
245
+ platformId: PLATFORM_ID,
245
246
  platformVersion: VERSION
246
247
  }).execute
247
248
 
@@ -250,13 +251,14 @@ class VoiceIt2
250
251
  end
251
252
 
252
253
  def createVoiceEnrollment(userId, contentLanguage, phrase, filePath)
253
- return RestClient::Request.new(
254
+ # file = File.new(filePath, 'r')
255
+ req = RestClient::Request.new(
254
256
  :method => :post,
255
- :url => BASE_URL + 'enrollments/voice' + @notification_url,
257
+ :url => @base_url + '/enrollments/voice' + @notification_url,
256
258
  :user => @api_key,
257
259
  :password => @api_token,
258
260
  :headers => {
259
- platformId: '35',
261
+ platformId: PLATFORM_ID,
260
262
  platformVersion: VERSION
261
263
  },
262
264
  :payload => {
@@ -264,24 +266,25 @@ class VoiceIt2
264
266
  :phrase => phrase,
265
267
  :userId => userId,
266
268
  :contentLanguage => contentLanguage,
267
- :recording => File.new(filePath, 'rb')
268
- }).execute
269
- rescue => e
270
- if e.class == Errno::ENOENT
271
- raise e.message
272
- else
273
- e.response
274
- end
269
+ :recording => File.new(filePath, 'r')
270
+ }).execute
271
+
272
+ rescue => e
273
+ if e.class == Errno::ENOENT
274
+ raise e.message
275
+ else
276
+ e.response
277
+ end
275
278
  end
276
279
 
277
280
  def createVoiceEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
278
281
  return RestClient::Request.new(
279
282
  :method => :post,
280
- :url => BASE_URL + 'enrollments/voice/byUrl' + @notification_url,
283
+ :url => @base_url + '/enrollments/voice/byUrl' + @notification_url,
281
284
  :user => @api_key,
282
285
  :password => @api_token,
283
286
  :headers => {
284
- platformId: '35',
287
+ platformId: PLATFORM_ID,
285
288
  platformVersion: VERSION
286
289
  },
287
290
  :payload => {
@@ -302,17 +305,17 @@ class VoiceIt2
302
305
  def createFaceEnrollment(userId, filePath)
303
306
  return RestClient::Request.new(
304
307
  :method => :post,
305
- :url => BASE_URL + 'enrollments/face' + @notification_url,
308
+ :url => @base_url + '/enrollments/face' + @notification_url,
306
309
  :user => @api_key,
307
310
  :password => @api_token,
308
311
  :headers => {
309
- platformId: '35',
312
+ platformId: PLATFORM_ID,
310
313
  platformVersion: VERSION
311
314
  },
312
315
  :payload => {
313
316
  :multipart => true,
314
317
  :userId => userId,
315
- :video => File.new(filePath, 'rb'),
318
+ :video => File.new(filePath, 'r'),
316
319
  }).execute
317
320
  rescue => e
318
321
  if e.class == Errno::ENOENT
@@ -325,11 +328,11 @@ class VoiceIt2
325
328
  def createFaceEnrollmentByUrl(userId, fileUrl)
326
329
  return RestClient::Request.new(
327
330
  :method => :post,
328
- :url => BASE_URL + 'enrollments/face/byUrl' + @notification_url,
331
+ :url => @base_url + '/enrollments/face/byUrl' + @notification_url,
329
332
  :user => @api_key,
330
333
  :password => @api_token,
331
334
  :headers => {
332
- platformId: '35',
335
+ platformId: PLATFORM_ID,
333
336
  platformVersion: VERSION
334
337
  },
335
338
  :payload => {
@@ -344,11 +347,11 @@ class VoiceIt2
344
347
  def createVideoEnrollment(userId, contentLanguage, phrase, filePath)
345
348
  return RestClient::Request.new(
346
349
  :method => :post,
347
- :url => BASE_URL + 'enrollments/video' + @notification_url,
350
+ :url => @base_url + '/enrollments/video' + @notification_url,
348
351
  :user => @api_key,
349
352
  :password => @api_token,
350
353
  :headers => {
351
- platformId: '35',
354
+ platformId: PLATFORM_ID,
352
355
  platformVersion: VERSION
353
356
  },
354
357
  :payload => {
@@ -356,7 +359,7 @@ class VoiceIt2
356
359
  :phrase => phrase,
357
360
  :userId => userId,
358
361
  :contentLanguage => contentLanguage,
359
- :video => File.new(filePath, 'rb'),
362
+ :video => File.new(filePath, 'r'),
360
363
  }).execute
361
364
  rescue => e
362
365
  if e.class == Errno::ENOENT
@@ -369,11 +372,11 @@ class VoiceIt2
369
372
  def createVideoEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
370
373
  return RestClient::Request.new(
371
374
  :method => :post,
372
- :url => BASE_URL + 'enrollments/video/byUrl' + @notification_url,
375
+ :url => @base_url + '/enrollments/video/byUrl' + @notification_url,
373
376
  :user => @api_key,
374
377
  :password => @api_token,
375
378
  :headers => {
376
- platformId: '35',
379
+ platformId: PLATFORM_ID,
377
380
  platformVersion: VERSION
378
381
  },
379
382
  :payload => {
@@ -394,11 +397,11 @@ class VoiceIt2
394
397
  def getAllGroups()
395
398
  return RestClient::Request.new(
396
399
  :method => :get,
397
- :url => BASE_URL + 'groups' + @notification_url,
400
+ :url => @base_url + '/groups' + @notification_url,
398
401
  :user => @api_key,
399
402
  :password => @api_token,
400
403
  :headers => {
401
- platformId: '35',
404
+ platformId: PLATFORM_ID,
402
405
  platformVersion: VERSION
403
406
  }).execute
404
407
  rescue => e
@@ -408,11 +411,11 @@ class VoiceIt2
408
411
  def getPhrases(contentLanguage)
409
412
  return RestClient::Request.new(
410
413
  :method => :get,
411
- :url => BASE_URL + 'phrases/' + contentLanguage + @notification_url,
414
+ :url => @base_url + '/phrases/' + contentLanguage + @notification_url,
412
415
  :user => @api_key,
413
416
  :password => @api_token,
414
417
  :headers => {
415
- platformId: '35',
418
+ platformId: PLATFORM_ID,
416
419
  platformVersion: VERSION
417
420
  }).execute
418
421
  rescue => e
@@ -422,11 +425,11 @@ class VoiceIt2
422
425
  def getGroup(groupId)
423
426
  return RestClient::Request.new(
424
427
  :method => :get,
425
- :url => BASE_URL + 'groups/' + groupId + @notification_url,
428
+ :url => @base_url + '/groups/' + groupId + @notification_url,
426
429
  :user => @api_key,
427
430
  :password => @api_token,
428
431
  :headers => {
429
- platformId: '35',
432
+ platformId: PLATFORM_ID,
430
433
  platformVersion: VERSION
431
434
  }).execute
432
435
  rescue => e
@@ -436,11 +439,11 @@ class VoiceIt2
436
439
  def groupExists(groupId)
437
440
  return RestClient::Request.new(
438
441
  :method => :get,
439
- :url => BASE_URL + 'groups/' + groupId + '/exists' + @notification_url,
442
+ :url => @base_url + '/groups/' + groupId + '/exists' + @notification_url,
440
443
  :user => @api_key,
441
444
  :password => @api_token,
442
445
  :headers => {
443
- platformId: '35',
446
+ platformId: PLATFORM_ID,
444
447
  platformVersion: VERSION
445
448
  }).execute
446
449
  rescue => e
@@ -450,11 +453,11 @@ class VoiceIt2
450
453
  def createGroup(description)
451
454
  return RestClient::Request.new(
452
455
  :method => :post,
453
- :url => BASE_URL + 'groups' + @notification_url,
456
+ :url => @base_url + '/groups' + @notification_url,
454
457
  :user => @api_key,
455
458
  :password => @api_token,
456
459
  :headers => {
457
- platformId: '35',
460
+ platformId: PLATFORM_ID,
458
461
  platformVersion: VERSION
459
462
  },
460
463
  :payload => {
@@ -468,11 +471,11 @@ class VoiceIt2
468
471
  def addUserToGroup(groupId, userId)
469
472
  return RestClient::Request.new(
470
473
  :method => :put,
471
- :url => BASE_URL + 'groups/addUser' + @notification_url,
474
+ :url => @base_url + '/groups/addUser' + @notification_url,
472
475
  :user => @api_key,
473
476
  :password => @api_token,
474
477
  :headers => {
475
- platformId: '35',
478
+ platformId: PLATFORM_ID,
476
479
  platformVersion: VERSION
477
480
  },
478
481
  :payload => {
@@ -487,11 +490,11 @@ class VoiceIt2
487
490
  def removeUserFromGroup(groupId, userId)
488
491
  return RestClient::Request.new(
489
492
  :method => :put,
490
- :url => BASE_URL + 'groups/removeUser' + @notification_url,
493
+ :url => @base_url + '/groups/removeUser' + @notification_url,
491
494
  :user => @api_key,
492
495
  :password => @api_token,
493
496
  :headers => {
494
- platformId: '35',
497
+ platformId: PLATFORM_ID,
495
498
  platformVersion: VERSION
496
499
  },
497
500
  :payload => {
@@ -506,11 +509,11 @@ class VoiceIt2
506
509
  def deleteGroup(groupId)
507
510
  return RestClient::Request.new(
508
511
  :method => :delete,
509
- :url => BASE_URL + 'groups/' + groupId + @notification_url,
512
+ :url => @base_url + '/groups/' + groupId + @notification_url,
510
513
  :user => @api_key,
511
514
  :password => @api_token,
512
515
  :headers => {
513
- platformId: '35',
516
+ platformId: PLATFORM_ID,
514
517
  platformVersion: VERSION
515
518
  }).execute
516
519
  rescue => e
@@ -520,11 +523,11 @@ class VoiceIt2
520
523
  def voiceVerification(userId, contentLanguage, phrase, filePath)
521
524
  return RestClient::Request.new(
522
525
  :method => :post,
523
- :url => BASE_URL + 'verification/voice' + @notification_url,
526
+ :url => @base_url + '/verification/voice' + @notification_url,
524
527
  :user => @api_key,
525
528
  :password => @api_token,
526
529
  :headers => {
527
- platformId: '35',
530
+ platformId: PLATFORM_ID,
528
531
  platformVersion: VERSION
529
532
  },
530
533
  :payload => {
@@ -532,7 +535,7 @@ class VoiceIt2
532
535
  :phrase => phrase,
533
536
  :userId => userId,
534
537
  :contentLanguage => contentLanguage,
535
- :recording => File.new(filePath, 'rb')
538
+ :recording => File.new(filePath, 'r')
536
539
  }).execute
537
540
  rescue => e
538
541
  if e.class == Errno::ENOENT
@@ -545,11 +548,11 @@ class VoiceIt2
545
548
  def voiceVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
546
549
  return RestClient::Request.new(
547
550
  :method => :post,
548
- :url => BASE_URL + 'verification/voice/byUrl' + @notification_url,
551
+ :url => @base_url + '/verification/voice/byUrl' + @notification_url,
549
552
  :user => @api_key,
550
553
  :password => @api_token,
551
554
  :headers => {
552
- platformId: '35',
555
+ platformId: PLATFORM_ID,
553
556
  platformVersion: VERSION
554
557
  },
555
558
  :payload => {
@@ -570,17 +573,17 @@ class VoiceIt2
570
573
  def faceVerification(userId, filePath)
571
574
  return RestClient::Request.new(
572
575
  :method => :post,
573
- :url => BASE_URL + 'verification/face' + @notification_url,
576
+ :url => @base_url + '/verification/face' + @notification_url,
574
577
  :user => @api_key,
575
578
  :password => @api_token,
576
579
  :headers => {
577
- platformId: '35',
580
+ platformId: PLATFORM_ID,
578
581
  platformVersion: VERSION
579
582
  },
580
583
  :payload => {
581
584
  :multipart => true,
582
585
  :userId => userId,
583
- :video => File.new(filePath, 'rb')
586
+ :video => File.new(filePath, 'r')
584
587
  }).execute
585
588
  rescue => e
586
589
  if e.class == Errno::ENOENT
@@ -593,11 +596,11 @@ class VoiceIt2
593
596
  def faceVerificationByUrl(userId, fileUrl)
594
597
  return RestClient::Request.new(
595
598
  :method => :post,
596
- :url => BASE_URL + 'verification/face/byUrl' + @notification_url,
599
+ :url => @base_url + '/verification/face/byUrl' + @notification_url,
597
600
  :user => @api_key,
598
601
  :password => @api_token,
599
602
  :headers => {
600
- platformId: '35',
603
+ platformId: PLATFORM_ID,
601
604
  platformVersion: VERSION
602
605
  },
603
606
  :payload => {
@@ -612,11 +615,11 @@ class VoiceIt2
612
615
  def videoVerification(userId, contentLanguage, phrase, filePath)
613
616
  return RestClient::Request.new(
614
617
  :method => :post,
615
- :url => BASE_URL + 'verification/video' + @notification_url,
618
+ :url => @base_url + '/verification/video' + @notification_url,
616
619
  :user => @api_key,
617
620
  :password => @api_token,
618
621
  :headers => {
619
- platformId: '35',
622
+ platformId: PLATFORM_ID,
620
623
  platformVersion: VERSION
621
624
  },
622
625
  :payload => {
@@ -624,7 +627,7 @@ class VoiceIt2
624
627
  :userId => userId,
625
628
  :phrase => phrase,
626
629
  :contentLanguage => contentLanguage,
627
- :video => File.new(filePath, 'rb')
630
+ :video => File.new(filePath, 'r')
628
631
  }).execute
629
632
  rescue => e
630
633
  if e.class == Errno::ENOENT
@@ -637,11 +640,11 @@ class VoiceIt2
637
640
  def videoVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
638
641
  return RestClient::Request.new(
639
642
  :method => :post,
640
- :url => BASE_URL + 'verification/video/byUrl' + @notification_url,
643
+ :url => @base_url + '/verification/video/byUrl' + @notification_url,
641
644
  :user => @api_key,
642
645
  :password => @api_token,
643
646
  :headers => {
644
- platformId: '35',
647
+ platformId: PLATFORM_ID,
645
648
  platformVersion: VERSION
646
649
  },
647
650
  :payload => {
@@ -662,11 +665,11 @@ class VoiceIt2
662
665
  def voiceIdentification(groupId, contentLanguage, phrase, filePath)
663
666
  return RestClient::Request.new(
664
667
  :method => :post,
665
- :url => BASE_URL + 'identification/voice' + @notification_url,
668
+ :url => @base_url + '/identification/voice' + @notification_url,
666
669
  :user => @api_key,
667
670
  :password => @api_token,
668
671
  :headers => {
669
- platformId: '35',
672
+ platformId: PLATFORM_ID,
670
673
  platformVersion: VERSION
671
674
  },
672
675
  :payload => {
@@ -674,7 +677,7 @@ class VoiceIt2
674
677
  :phrase => phrase,
675
678
  :groupId => groupId,
676
679
  :contentLanguage => contentLanguage,
677
- :recording => File.new(filePath, 'rb')
680
+ :recording => File.new(filePath, 'r')
678
681
  }).execute
679
682
  rescue => e
680
683
  if e.class == Errno::ENOENT
@@ -687,11 +690,11 @@ class VoiceIt2
687
690
  def voiceIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
688
691
  return RestClient::Request.new(
689
692
  :method => :post,
690
- :url => BASE_URL + 'identification/voice/byUrl' + @notification_url,
693
+ :url => @base_url + '/identification/voice/byUrl' + @notification_url,
691
694
  :user => @api_key,
692
695
  :password => @api_token,
693
696
  :headers => {
694
- platformId: '35',
697
+ platformId: PLATFORM_ID,
695
698
  platformVersion: VERSION
696
699
  },
697
700
  :payload => {
@@ -712,17 +715,17 @@ class VoiceIt2
712
715
  def faceIdentification(groupId, filePath)
713
716
  return RestClient::Request.new(
714
717
  :method => :post,
715
- :url => BASE_URL + 'identification/face' + @notification_url,
718
+ :url => @base_url + '/identification/face' + @notification_url,
716
719
  :user => @api_key,
717
720
  :password => @api_token,
718
721
  :headers => {
719
- platformId: '35',
722
+ platformId: PLATFORM_ID,
720
723
  platformVersion: VERSION
721
724
  },
722
725
  :payload => {
723
726
  :multipart => true,
724
727
  :groupId => groupId,
725
- :video => File.new(filePath, 'rb')
728
+ :video => File.new(filePath, 'r')
726
729
  }).execute
727
730
  rescue => e
728
731
  if e.class == Errno::ENOENT
@@ -735,11 +738,11 @@ class VoiceIt2
735
738
  def faceIdentificationByUrl(groupId,fileUrl)
736
739
  return RestClient::Request.new(
737
740
  :method => :post,
738
- :url => BASE_URL + 'identification/face/byUrl' + @notification_url,
741
+ :url => @base_url + '/identification/face/byUrl' + @notification_url,
739
742
  :user => @api_key,
740
743
  :password => @api_token,
741
744
  :headers => {
742
- platformId: '35',
745
+ platformId: PLATFORM_ID,
743
746
  platformVersion: VERSION
744
747
  },
745
748
  :payload => {
@@ -754,11 +757,11 @@ class VoiceIt2
754
757
  def videoIdentification(groupId, contentLanguage, phrase, filePath)
755
758
  return RestClient::Request.new(
756
759
  :method => :post,
757
- :url => BASE_URL + 'identification/video' + @notification_url,
760
+ :url => @base_url + '/identification/video' + @notification_url,
758
761
  :user => @api_key,
759
762
  :password => @api_token,
760
763
  :headers => {
761
- platformId: '35',
764
+ platformId: PLATFORM_ID,
762
765
  platformVersion: VERSION
763
766
  },
764
767
  :payload => {
@@ -766,7 +769,7 @@ class VoiceIt2
766
769
  :phrase => phrase,
767
770
  :groupId => groupId,
768
771
  :contentLanguage => contentLanguage,
769
- :video => File.new(filePath, 'rb')
772
+ :video => File.new(filePath, 'r')
770
773
  }).execute
771
774
  rescue => e
772
775
  if e.class == Errno::ENOENT
@@ -779,11 +782,11 @@ class VoiceIt2
779
782
  def videoIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
780
783
  return RestClient::Request.new(
781
784
  :method => :post,
782
- :url => BASE_URL + 'identification/video/byUrl' + @notification_url,
785
+ :url => @base_url + '/identification/video/byUrl' + @notification_url,
783
786
  :user => @api_key,
784
787
  :password => @api_token,
785
788
  :headers => {
786
- platformId: '35',
789
+ platformId: PLATFORM_ID,
787
790
  platformVersion: VERSION
788
791
  },
789
792
  :payload => {
@@ -804,11 +807,11 @@ class VoiceIt2
804
807
  def createUserToken(userId, secondsToTimeout)
805
808
  return RestClient::Request.new(
806
809
  :method => :post,
807
- :url => BASE_URL + 'users/' + userId + '/token?timeOut=' + secondsToTimeout.to_s,
810
+ :url => @base_url + '/users/' + userId + '/token?timeOut=' + secondsToTimeout.to_s,
808
811
  :user => @api_key,
809
812
  :password => @api_token,
810
813
  :headers => {
811
- platformId: '35',
814
+ platformId: PLATFORM_ID,
812
815
  platformVersion: VERSION
813
816
  }).execute
814
817
  rescue => e
@@ -818,18 +821,18 @@ class VoiceIt2
818
821
  def expireUserTokens(userId)
819
822
  return RestClient::Request.new(
820
823
  :method => :post,
821
- :url => BASE_URL + 'users/' + userId + '/expireTokens',
824
+ :url => @base_url + '/users/' + userId + '/expireTokens',
822
825
  :user => @api_key,
823
826
  :password => @api_token,
824
827
  :headers => {
825
- platformId: '35',
828
+ platformId: PLATFORM_ID,
826
829
  platformVersion: VERSION
827
830
  }).execute
828
831
  rescue => e
829
832
  e.response
830
833
  end
831
834
 
832
- attr_reader :BASE_URL
835
+ attr_reader :base_url
833
836
  attr_reader :notification_url
834
837
  attr_reader :api_key
835
838
  attr_reader :api_token
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: VoiceIt2
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - StephenAkers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-25 00:00:00.000000000 Z
11
+ date: 2023-12-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A wrapper for VoiceIt API 2
14
14
  email: stephen@voiceit.io
@@ -22,7 +22,7 @@ licenses:
22
22
  - MIT
23
23
  metadata:
24
24
  documentation_uri: https://api.voiceit.io?ruby
25
- post_install_message:
25
+ post_install_message:
26
26
  rdoc_options: []
27
27
  require_paths:
28
28
  - lib
@@ -37,9 +37,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  requirements: []
40
- rubyforge_project:
41
- rubygems_version: 2.7.6
42
- signing_key:
40
+ rubygems_version: 3.3.7
41
+ signing_key:
43
42
  specification_version: 4
44
43
  summary: VoiceIt Api 2
45
44
  test_files: []