VoiceIt2 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/VoiceIt2.rb +146 -86
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8278a824804474f2c47ecbbc8e8a352b89149dfda4618d67f363bd61806947a
4
- data.tar.gz: 0fa42e68e65e077a39600a5f6bb00ecb133db7633bcd1cfe3c85dc96912bc1ac
3
+ metadata.gz: 89e8809efb84e01b992459c2e063adb27cf8f90e3e77dc9bff66c95b3ab237c8
4
+ data.tar.gz: cdf5fcc763c49c3637d99b2a339fc4f95b95760f55802fed4f855be49a38da68
5
5
  SHA512:
6
- metadata.gz: fc0041fb5a237411d89ffca61975aeffbddf6b51efcd15c2dcab19b332a0a68843354fb5509822b9bafe221046590c07653c2f17541c82977bacc7ed3805351c
7
- data.tar.gz: 4e449fdbddd84fd2999a2b2a438c01714835d7e355a5fd9ba41c7b7b4ce953669ec3130c6fef6ab497e29c98352d17b178229c041d88c65c7820730cbf6b569b
6
+ metadata.gz: eff308a3a150d416231f13773f3e6934792fa7275a3d15a1ef2d98623a8d4c34db1510526cc17bd0fba864cf1fc0adecee572a854095e49ad776ef5cd5100dc3
7
+ data.tar.gz: 1ceb5dad3e9a0fe882792b2ec65284928880752787cac95215a820089c11f195fab67c2b7d8245385f6eab2386572884ddc13c9c4a417989664c0f4faa5a3bac
data/VoiceIt2.rb CHANGED
@@ -1,22 +1,36 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rest-client'
3
+ require 'cgi'
4
+
3
5
 
4
6
  class VoiceIt2
5
7
 
8
+ BASE_URL = 'https://api.voiceit.io/'
9
+ VERSION = '3.2.0'
10
+
6
11
  def initialize(key, tok)
7
- @BASE_URL = URI('https://api.voiceit.io/')
12
+ @notification_url = ""
8
13
  @api_key = key
9
14
  @api_token = tok
10
15
  end
11
16
 
17
+ def addNotificationUrl(notificationURL)
18
+ @notification_url = "?notificationURL=" + CGI.escape(notificationURL)
19
+ end
20
+
21
+ def removeNotificationUrl()
22
+ @notification_url = ""
23
+ end
24
+
12
25
  def getAllUsers
13
26
  return RestClient::Request.new(
14
27
  :method => :get,
15
- :url => @BASE_URL.to_s + 'users',
28
+ :url => BASE_URL + 'users' + @notification_url,
16
29
  :user => @api_key,
17
30
  :password => @api_token,
18
31
  :headers => {
19
- platformId: '35'
32
+ platformId: '35',
33
+ platformVersion: VERSION
20
34
  }).execute
21
35
  rescue => e
22
36
  e.response
@@ -25,11 +39,12 @@ class VoiceIt2
25
39
  def createUser
26
40
  return RestClient::Request.new(
27
41
  :method => :post,
28
- :url => @BASE_URL.to_s + 'users',
42
+ :url => BASE_URL + 'users' + @notification_url,
29
43
  :user => @api_key,
30
44
  :password => @api_token,
31
45
  :headers => {
32
- platformId: '35'
46
+ platformId: '35',
47
+ platformVersion: VERSION
33
48
  }).execute
34
49
  rescue => e
35
50
  e.response
@@ -38,11 +53,12 @@ class VoiceIt2
38
53
  def checkUserExists(userId)
39
54
  return RestClient::Request.new(
40
55
  :method => :get,
41
- :url => @BASE_URL.to_s + 'users/' + userId,
56
+ :url => BASE_URL + 'users/' + userId + @notification_url,
42
57
  :user => @api_key,
43
58
  :password => @api_token,
44
59
  :headers => {
45
- platformId: '35'
60
+ platformId: '35',
61
+ platformVersion: VERSION
46
62
  }).execute
47
63
  rescue => e
48
64
  e.response
@@ -51,11 +67,12 @@ class VoiceIt2
51
67
  def deleteUser(userId)
52
68
  return RestClient::Request.new(
53
69
  :method => :delete,
54
- :url => @BASE_URL.to_s + 'users/' + userId,
70
+ :url => BASE_URL + 'users/' + userId + @notification_url,
55
71
  :user => @api_key,
56
72
  :password => @api_token,
57
73
  :headers => {
58
- platformId: '35'
74
+ platformId: '35',
75
+ platformVersion: VERSION
59
76
  }).execute
60
77
 
61
78
  rescue => e
@@ -65,11 +82,12 @@ class VoiceIt2
65
82
  def getGroupsForUser(userId)
66
83
  return RestClient::Request.new(
67
84
  :method => :get,
68
- :url => @BASE_URL.to_s + 'users/' + userId + '/groups',
85
+ :url => BASE_URL + 'users/' + userId + '/groups' + @notification_url,
69
86
  :user => @api_key,
70
87
  :password => @api_token,
71
88
  :headers => {
72
- platformId: '35'
89
+ platformId: '35',
90
+ platformVersion: VERSION
73
91
  }).execute
74
92
 
75
93
  rescue => e
@@ -79,11 +97,12 @@ class VoiceIt2
79
97
  def getAllVoiceEnrollments(userId)
80
98
  return RestClient::Request.new(
81
99
  :method => :get,
82
- :url => @BASE_URL.to_s + 'enrollments/voice/' + userId,
100
+ :url => BASE_URL + 'enrollments/voice/' + userId + @notification_url,
83
101
  :user => @api_key,
84
102
  :password => @api_token,
85
103
  :headers => {
86
- platformId: '35'
104
+ platformId: '35',
105
+ platformVersion: VERSION
87
106
  }).execute
88
107
 
89
108
  rescue => e
@@ -93,11 +112,12 @@ class VoiceIt2
93
112
  def getAllVideoEnrollments(userId)
94
113
  return RestClient::Request.new(
95
114
  :method => :get,
96
- :url => @BASE_URL.to_s + 'enrollments/video/' + userId,
115
+ :url => BASE_URL + 'enrollments/video/' + userId + @notification_url,
97
116
  :user => @api_key,
98
117
  :password => @api_token,
99
118
  :headers => {
100
- platformId: '35'
119
+ platformId: '35',
120
+ platformVersion: VERSION
101
121
  }).execute
102
122
 
103
123
  rescue => e
@@ -107,11 +127,12 @@ class VoiceIt2
107
127
  def deleteAllEnrollments(userId)
108
128
  return RestClient::Request.new(
109
129
  :method => :delete,
110
- :url => @BASE_URL.to_s + 'enrollments/' + userId + '/all',
130
+ :url => BASE_URL + 'enrollments/' + userId + '/all' + @notification_url,
111
131
  :user => @api_key,
112
132
  :password => @api_token,
113
133
  :headers => {
114
- platformId: '35'
134
+ platformId: '35',
135
+ platformVersion: VERSION
115
136
  }).execute
116
137
 
117
138
  rescue => e
@@ -121,11 +142,12 @@ class VoiceIt2
121
142
  def deleteAllVoiceEnrollments(userId)
122
143
  return RestClient::Request.new(
123
144
  :method => :delete,
124
- :url => @BASE_URL.to_s + 'enrollments/' + userId + '/voice',
145
+ :url => BASE_URL + 'enrollments/' + userId + '/voice' + @notification_url,
125
146
  :user => @api_key,
126
147
  :password => @api_token,
127
148
  :headers => {
128
- platformId: '35'
149
+ platformId: '35',
150
+ platformVersion: VERSION
129
151
  }).execute
130
152
 
131
153
  rescue => e
@@ -135,11 +157,12 @@ class VoiceIt2
135
157
  def deleteAllFaceEnrollments(userId)
136
158
  return RestClient::Request.new(
137
159
  :method => :delete,
138
- :url => @BASE_URL.to_s + 'enrollments/' + userId + '/face',
160
+ :url => BASE_URL + 'enrollments/' + userId + '/face' + @notification_url,
139
161
  :user => @api_key,
140
162
  :password => @api_token,
141
163
  :headers => {
142
- platformId: '35'
164
+ platformId: '35',
165
+ platformVersion: VERSION
143
166
  }).execute
144
167
 
145
168
  rescue => e
@@ -149,11 +172,12 @@ class VoiceIt2
149
172
  def deleteAllVideoEnrollments(userId)
150
173
  return RestClient::Request.new(
151
174
  :method => :delete,
152
- :url => @BASE_URL.to_s + 'enrollments/' + userId + '/video',
175
+ :url => BASE_URL + 'enrollments/' + userId + '/video' + @notification_url,
153
176
  :user => @api_key,
154
177
  :password => @api_token,
155
178
  :headers => {
156
- platformId: '35'
179
+ platformId: '35',
180
+ platformVersion: VERSION
157
181
  }).execute
158
182
 
159
183
  rescue => e
@@ -163,11 +187,12 @@ class VoiceIt2
163
187
  def getAllFaceEnrollments(userId)
164
188
  return RestClient::Request.new(
165
189
  :method => :get,
166
- :url => @BASE_URL.to_s + 'enrollments/face/' + userId,
190
+ :url => BASE_URL + 'enrollments/face/' + userId + @notification_url,
167
191
  :user => @api_key,
168
192
  :password => @api_token,
169
193
  :headers => {
170
- platformId: '35'
194
+ platformId: '35',
195
+ platformVersion: VERSION
171
196
  }).execute
172
197
 
173
198
  rescue => e
@@ -177,11 +202,12 @@ class VoiceIt2
177
202
  def createVoiceEnrollment(userId, contentLanguage, phrase, filePath)
178
203
  return RestClient::Request.new(
179
204
  :method => :post,
180
- :url => @BASE_URL.to_s + 'enrollments/voice',
205
+ :url => BASE_URL + 'enrollments/voice' + @notification_url,
181
206
  :user => @api_key,
182
207
  :password => @api_token,
183
208
  :headers => {
184
- platformId: '35'
209
+ platformId: '35',
210
+ platformVersion: VERSION
185
211
  },
186
212
  :payload => {
187
213
  :multipart => true,
@@ -201,11 +227,12 @@ class VoiceIt2
201
227
  def createVoiceEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
202
228
  return RestClient::Request.new(
203
229
  :method => :post,
204
- :url => @BASE_URL.to_s + 'enrollments/voice/byUrl',
230
+ :url => BASE_URL + 'enrollments/voice/byUrl' + @notification_url,
205
231
  :user => @api_key,
206
232
  :password => @api_token,
207
233
  :headers => {
208
- platformId: '35'
234
+ platformId: '35',
235
+ platformVersion: VERSION
209
236
  },
210
237
  :payload => {
211
238
  :multipart => true,
@@ -225,11 +252,12 @@ class VoiceIt2
225
252
  def createFaceEnrollment(userId, filePath)
226
253
  return RestClient::Request.new(
227
254
  :method => :post,
228
- :url => @BASE_URL.to_s + 'enrollments/face',
255
+ :url => BASE_URL + 'enrollments/face' + @notification_url,
229
256
  :user => @api_key,
230
257
  :password => @api_token,
231
258
  :headers => {
232
- platformId: '35'
259
+ platformId: '35',
260
+ platformVersion: VERSION
233
261
  },
234
262
  :payload => {
235
263
  :multipart => true,
@@ -247,11 +275,12 @@ class VoiceIt2
247
275
  def createFaceEnrollmentByUrl(userId, fileUrl)
248
276
  return RestClient::Request.new(
249
277
  :method => :post,
250
- :url => @BASE_URL.to_s + 'enrollments/face/byUrl',
278
+ :url => BASE_URL + 'enrollments/face/byUrl' + @notification_url,
251
279
  :user => @api_key,
252
280
  :password => @api_token,
253
281
  :headers => {
254
- platformId: '35'
282
+ platformId: '35',
283
+ platformVersion: VERSION
255
284
  },
256
285
  :payload => {
257
286
  :multipart => true,
@@ -265,11 +294,12 @@ class VoiceIt2
265
294
  def createVideoEnrollment(userId, contentLanguage, phrase, filePath)
266
295
  return RestClient::Request.new(
267
296
  :method => :post,
268
- :url => @BASE_URL.to_s + 'enrollments/video',
297
+ :url => BASE_URL + 'enrollments/video' + @notification_url,
269
298
  :user => @api_key,
270
299
  :password => @api_token,
271
300
  :headers => {
272
- platformId: '35'
301
+ platformId: '35',
302
+ platformVersion: VERSION
273
303
  },
274
304
  :payload => {
275
305
  :multipart => true,
@@ -289,11 +319,12 @@ class VoiceIt2
289
319
  def createVideoEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
290
320
  return RestClient::Request.new(
291
321
  :method => :post,
292
- :url => @BASE_URL.to_s + 'enrollments/video/byUrl',
322
+ :url => BASE_URL + 'enrollments/video/byUrl' + @notification_url,
293
323
  :user => @api_key,
294
324
  :password => @api_token,
295
325
  :headers => {
296
- platformId: '35'
326
+ platformId: '35',
327
+ platformVersion: VERSION
297
328
  },
298
329
  :payload => {
299
330
  :multipart => true,
@@ -313,11 +344,12 @@ class VoiceIt2
313
344
  def deleteFaceEnrollment(userId, faceEnrollmentId)
314
345
  return RestClient::Request.new(
315
346
  :method => :delete,
316
- :url => @BASE_URL.to_s + 'enrollments/face/' + userId + '/' + faceEnrollmentId.to_s,
347
+ :url => BASE_URL + 'enrollments/face/' + userId + '/' + faceEnrollmentId.to_s + @notification_url,
317
348
  :user => @api_key,
318
349
  :password => @api_token,
319
350
  :headers => {
320
- platformId: '35'
351
+ platformId: '35',
352
+ platformVersion: VERSION
321
353
  }).execute
322
354
  rescue => e
323
355
  e.response
@@ -326,11 +358,12 @@ class VoiceIt2
326
358
  def deleteVoiceEnrollment(userId, voiceEnrollmentId)
327
359
  return RestClient::Request.new(
328
360
  :method => :delete,
329
- :url => @BASE_URL.to_s + 'enrollments/voice/' + userId + '/' + voiceEnrollmentId.to_s,
361
+ :url => BASE_URL + 'enrollments/voice/' + userId + '/' + voiceEnrollmentId.to_s + @notification_url,
330
362
  :user => @api_key,
331
363
  :password => @api_token,
332
364
  :headers => {
333
- platformId: '35'
365
+ platformId: '35',
366
+ platformVersion: VERSION
334
367
  }).execute
335
368
  rescue => e
336
369
  e.response
@@ -339,11 +372,12 @@ class VoiceIt2
339
372
  def deleteVideoEnrollment(userId, enrollmentId)
340
373
  return RestClient::Request.new(
341
374
  :method => :delete,
342
- :url => @BASE_URL.to_s + 'enrollments/video/' + userId + '/' + enrollmentId.to_s,
375
+ :url => BASE_URL + 'enrollments/video/' + userId + '/' + enrollmentId.to_s + @notification_url,
343
376
  :user => @api_key,
344
377
  :password => @api_token,
345
378
  :headers => {
346
- platformId: '35'
379
+ platformId: '35',
380
+ platformVersion: VERSION
347
381
  }).execute
348
382
 
349
383
  rescue => e
@@ -353,11 +387,12 @@ class VoiceIt2
353
387
  def getAllGroups()
354
388
  return RestClient::Request.new(
355
389
  :method => :get,
356
- :url => @BASE_URL.to_s + 'groups',
390
+ :url => BASE_URL + 'groups' + @notification_url,
357
391
  :user => @api_key,
358
392
  :password => @api_token,
359
393
  :headers => {
360
- platformId: '35'
394
+ platformId: '35',
395
+ platformVersion: VERSION
361
396
  }).execute
362
397
  rescue => e
363
398
  e.response
@@ -366,11 +401,12 @@ class VoiceIt2
366
401
  def getPhrases(contentLanguage)
367
402
  return RestClient::Request.new(
368
403
  :method => :get,
369
- :url => @BASE_URL.to_s + 'phrases/' + contentLanguage,
404
+ :url => BASE_URL + 'phrases/' + contentLanguage + @notification_url,
370
405
  :user => @api_key,
371
406
  :password => @api_token,
372
407
  :headers => {
373
- platformId: '35'
408
+ platformId: '35',
409
+ platformVersion: VERSION
374
410
  }).execute
375
411
  rescue => e
376
412
  e.response
@@ -379,11 +415,12 @@ class VoiceIt2
379
415
  def getGroup(groupId)
380
416
  return RestClient::Request.new(
381
417
  :method => :get,
382
- :url => @BASE_URL.to_s + 'groups/' + groupId,
418
+ :url => BASE_URL + 'groups/' + groupId + @notification_url,
383
419
  :user => @api_key,
384
420
  :password => @api_token,
385
421
  :headers => {
386
- platformId: '35'
422
+ platformId: '35',
423
+ platformVersion: VERSION
387
424
  }).execute
388
425
  rescue => e
389
426
  e.response
@@ -392,11 +429,12 @@ class VoiceIt2
392
429
  def groupExists(groupId)
393
430
  return RestClient::Request.new(
394
431
  :method => :get,
395
- :url => @BASE_URL.to_s + 'groups/' + groupId + '/exists',
432
+ :url => BASE_URL + 'groups/' + groupId + '/exists' + @notification_url,
396
433
  :user => @api_key,
397
434
  :password => @api_token,
398
435
  :headers => {
399
- platformId: '35'
436
+ platformId: '35',
437
+ platformVersion: VERSION
400
438
  }).execute
401
439
  rescue => e
402
440
  e.response
@@ -405,11 +443,12 @@ class VoiceIt2
405
443
  def createGroup(description)
406
444
  return RestClient::Request.new(
407
445
  :method => :post,
408
- :url => @BASE_URL.to_s + 'groups',
446
+ :url => BASE_URL + 'groups' + @notification_url,
409
447
  :user => @api_key,
410
448
  :password => @api_token,
411
449
  :headers => {
412
- platformId: '35'
450
+ platformId: '35',
451
+ platformVersion: VERSION
413
452
  },
414
453
  :payload => {
415
454
  :multipart => true,
@@ -422,11 +461,12 @@ class VoiceIt2
422
461
  def addUserToGroup(groupId, userId)
423
462
  return RestClient::Request.new(
424
463
  :method => :put,
425
- :url => @BASE_URL.to_s + 'groups/addUser',
464
+ :url => BASE_URL + 'groups/addUser' + @notification_url,
426
465
  :user => @api_key,
427
466
  :password => @api_token,
428
467
  :headers => {
429
- platformId: '35'
468
+ platformId: '35',
469
+ platformVersion: VERSION
430
470
  },
431
471
  :payload => {
432
472
  :multipart => true,
@@ -440,11 +480,12 @@ class VoiceIt2
440
480
  def removeUserFromGroup(groupId, userId)
441
481
  return RestClient::Request.new(
442
482
  :method => :put,
443
- :url => @BASE_URL.to_s + 'groups/removeUser',
483
+ :url => BASE_URL + 'groups/removeUser' + @notification_url,
444
484
  :user => @api_key,
445
485
  :password => @api_token,
446
486
  :headers => {
447
- platformId: '35'
487
+ platformId: '35',
488
+ platformVersion: VERSION
448
489
  },
449
490
  :payload => {
450
491
  :multipart => true,
@@ -458,11 +499,12 @@ class VoiceIt2
458
499
  def deleteGroup(groupId)
459
500
  return RestClient::Request.new(
460
501
  :method => :delete,
461
- :url => @BASE_URL.to_s + 'groups/' + groupId,
502
+ :url => BASE_URL + 'groups/' + groupId + @notification_url,
462
503
  :user => @api_key,
463
504
  :password => @api_token,
464
505
  :headers => {
465
- platformId: '35'
506
+ platformId: '35',
507
+ platformVersion: VERSION
466
508
  }).execute
467
509
  rescue => e
468
510
  e.response
@@ -471,11 +513,12 @@ class VoiceIt2
471
513
  def voiceVerification(userId, contentLanguage, phrase, filePath)
472
514
  return RestClient::Request.new(
473
515
  :method => :post,
474
- :url => @BASE_URL.to_s + 'verification/voice',
516
+ :url => BASE_URL + 'verification/voice' + @notification_url,
475
517
  :user => @api_key,
476
518
  :password => @api_token,
477
519
  :headers => {
478
- platformId: '35'
520
+ platformId: '35',
521
+ platformVersion: VERSION
479
522
  },
480
523
  :payload => {
481
524
  :multipart => true,
@@ -495,11 +538,12 @@ class VoiceIt2
495
538
  def voiceVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
496
539
  return RestClient::Request.new(
497
540
  :method => :post,
498
- :url => @BASE_URL.to_s + 'verification/voice/byUrl',
541
+ :url => BASE_URL + 'verification/voice/byUrl' + @notification_url,
499
542
  :user => @api_key,
500
543
  :password => @api_token,
501
544
  :headers => {
502
- platformId: '35'
545
+ platformId: '35',
546
+ platformVersion: VERSION
503
547
  },
504
548
  :payload => {
505
549
  :multipart => true,
@@ -519,11 +563,12 @@ class VoiceIt2
519
563
  def faceVerification(userId, filePath)
520
564
  return RestClient::Request.new(
521
565
  :method => :post,
522
- :url => @BASE_URL.to_s + 'verification/face',
566
+ :url => BASE_URL + 'verification/face' + @notification_url,
523
567
  :user => @api_key,
524
568
  :password => @api_token,
525
569
  :headers => {
526
- platformId: '35'
570
+ platformId: '35',
571
+ platformVersion: VERSION
527
572
  },
528
573
  :payload => {
529
574
  :multipart => true,
@@ -541,11 +586,12 @@ class VoiceIt2
541
586
  def faceVerificationByUrl(userId, fileUrl)
542
587
  return RestClient::Request.new(
543
588
  :method => :post,
544
- :url => @BASE_URL.to_s + 'verification/face/byUrl',
589
+ :url => BASE_URL + 'verification/face/byUrl' + @notification_url,
545
590
  :user => @api_key,
546
591
  :password => @api_token,
547
592
  :headers => {
548
- platformId: '35'
593
+ platformId: '35',
594
+ platformVersion: VERSION
549
595
  },
550
596
  :payload => {
551
597
  :multipart => true,
@@ -559,11 +605,12 @@ class VoiceIt2
559
605
  def videoVerification(userId, contentLanguage, phrase, filePath)
560
606
  return RestClient::Request.new(
561
607
  :method => :post,
562
- :url => @BASE_URL.to_s + 'verification/video',
608
+ :url => BASE_URL + 'verification/video' + @notification_url,
563
609
  :user => @api_key,
564
610
  :password => @api_token,
565
611
  :headers => {
566
- platformId: '35'
612
+ platformId: '35',
613
+ platformVersion: VERSION
567
614
  },
568
615
  :payload => {
569
616
  :multipart => true,
@@ -583,11 +630,12 @@ class VoiceIt2
583
630
  def videoVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
584
631
  return RestClient::Request.new(
585
632
  :method => :post,
586
- :url => @BASE_URL.to_s + 'verification/video/byUrl',
633
+ :url => BASE_URL + 'verification/video/byUrl' + @notification_url,
587
634
  :user => @api_key,
588
635
  :password => @api_token,
589
636
  :headers => {
590
- platformId: '35'
637
+ platformId: '35',
638
+ platformVersion: VERSION
591
639
  },
592
640
  :payload => {
593
641
  :multipart => true,
@@ -607,11 +655,12 @@ class VoiceIt2
607
655
  def voiceIdentification(groupId, contentLanguage, phrase, filePath)
608
656
  return RestClient::Request.new(
609
657
  :method => :post,
610
- :url => @BASE_URL.to_s + 'identification/voice',
658
+ :url => BASE_URL + 'identification/voice' + @notification_url,
611
659
  :user => @api_key,
612
660
  :password => @api_token,
613
661
  :headers => {
614
- platformId: '35'
662
+ platformId: '35',
663
+ platformVersion: VERSION
615
664
  },
616
665
  :payload => {
617
666
  :multipart => true,
@@ -631,11 +680,12 @@ class VoiceIt2
631
680
  def voiceIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
632
681
  return RestClient::Request.new(
633
682
  :method => :post,
634
- :url => @BASE_URL.to_s + 'identification/voice/byUrl',
683
+ :url => BASE_URL + 'identification/voice/byUrl' + @notification_url,
635
684
  :user => @api_key,
636
685
  :password => @api_token,
637
686
  :headers => {
638
- platformId: '35'
687
+ platformId: '35',
688
+ platformVersion: VERSION
639
689
  },
640
690
  :payload => {
641
691
  :multipart => true,
@@ -655,11 +705,12 @@ class VoiceIt2
655
705
  def faceIdentification(groupId, filePath)
656
706
  return RestClient::Request.new(
657
707
  :method => :post,
658
- :url => @BASE_URL.to_s + 'identification/face',
708
+ :url => BASE_URL + 'identification/face' + @notification_url,
659
709
  :user => @api_key,
660
710
  :password => @api_token,
661
711
  :headers => {
662
- platformId: '35'
712
+ platformId: '35',
713
+ platformVersion: VERSION
663
714
  },
664
715
  :payload => {
665
716
  :multipart => true,
@@ -677,11 +728,12 @@ class VoiceIt2
677
728
  def faceIdentificationByUrl(groupId,fileUrl)
678
729
  return RestClient::Request.new(
679
730
  :method => :post,
680
- :url => @BASE_URL.to_s + 'identification/face/byUrl',
731
+ :url => BASE_URL + 'identification/face/byUrl' + @notification_url,
681
732
  :user => @api_key,
682
733
  :password => @api_token,
683
734
  :headers => {
684
- platformId: '35'
735
+ platformId: '35',
736
+ platformVersion: VERSION
685
737
  },
686
738
  :payload => {
687
739
  :multipart => true,
@@ -695,11 +747,12 @@ class VoiceIt2
695
747
  def videoIdentification(groupId, contentLanguage, phrase, filePath)
696
748
  return RestClient::Request.new(
697
749
  :method => :post,
698
- :url => @BASE_URL.to_s + 'identification/video',
750
+ :url => BASE_URL + 'identification/video' + @notification_url,
699
751
  :user => @api_key,
700
752
  :password => @api_token,
701
753
  :headers => {
702
- platformId: '35'
754
+ platformId: '35',
755
+ platformVersion: VERSION
703
756
  },
704
757
  :payload => {
705
758
  :multipart => true,
@@ -719,11 +772,12 @@ class VoiceIt2
719
772
  def videoIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
720
773
  return RestClient::Request.new(
721
774
  :method => :post,
722
- :url => @BASE_URL.to_s + 'identification/video/byUrl',
775
+ :url => BASE_URL + 'identification/video/byUrl' + @notification_url,
723
776
  :user => @api_key,
724
777
  :password => @api_token,
725
778
  :headers => {
726
- platformId: '35'
779
+ platformId: '35',
780
+ platformVersion: VERSION
727
781
  },
728
782
  :payload => {
729
783
  :multipart => true,
@@ -740,17 +794,23 @@ class VoiceIt2
740
794
  end
741
795
  end
742
796
 
743
- def createUserToken(userId)
797
+ def createUserToken(userId, timeOut)
744
798
  return RestClient::Request.new(
745
799
  :method => :post,
746
- :url => @BASE_URL.to_s + 'users/' + userId + '/token',
800
+ :url => BASE_URL + 'users/' + userId + '/token?timeOut=' + timeOut.to_s,
747
801
  :user => @api_key,
748
802
  :password => @api_token,
749
803
  :headers => {
750
- platformId: '35'
804
+ platformId: '35',
805
+ platformVersion: VERSION
751
806
  }).execute
752
807
  rescue => e
753
808
  e.response
754
809
  end
755
810
 
811
+ attr_reader :BASE_URL
812
+ attr_reader :notification_url
813
+ attr_reader :api_key
814
+ attr_reader :api_token
815
+
756
816
  end
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.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - StephenAkers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2019-01-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A wrapper for VoiceIt API 2
14
14
  email: stephen@voiceit.io
@@ -17,10 +17,11 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - "./VoiceIt2.rb"
20
- homepage: http://rubygems.org/gems/hola
20
+ homepage: https://voiceit.io
21
21
  licenses:
22
22
  - MIT
23
- metadata: {}
23
+ metadata:
24
+ documentation_uri: https://api.voiceit.io?ruby
24
25
  post_install_message:
25
26
  rdoc_options: []
26
27
  require_paths: