VoiceIt2 2.0.0 → 3.0.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 +260 -30
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 752ab1736ed419505b405091fa081dba323e928277e556a0d168420ac1c4ffa8
4
- data.tar.gz: 740d0e29bd2610bfde2290b29c91a6bfe41ed0c1adcf0208530d502f5486e4f0
3
+ metadata.gz: 00c0577eeaf883342684d80fc99f45a28181de7218f1a5a8df95dc047f2ce61a
4
+ data.tar.gz: 5be027cb7aafd01fff8f04dc1b3ba6cc381516b2bceaee964fe21184f0b9925e
5
5
  SHA512:
6
- metadata.gz: 52ab300188f443908cebb84a06678945ba368ad350347a966c006a41f0e1cc35b008cd9f79d93455bac39e0b5ccda54ba354a28fe7642dff428a60d8d7714cca
7
- data.tar.gz: 7455220d818bd206c4aa50056643ea29e6c5b171938c7a758211330d49ca4223e3161fb7b5a77ce6ba70b9241a4d1fdc4e9ce9c57125dc9dec0a6ce132a3376a
6
+ metadata.gz: 3f502c9a3533cabf1893d684f2780a78e16d697e15d032422aa8bc245beb14baa69e61f7af993c1b507175b6c129c5ff7d5767e37a730d9a6ee791a0a419dd20
7
+ data.tar.gz: 23cf3c0c6cc128dbbeaab8be5c4ff77c1c694d32685490e577d04a9c28ad5a2f08479292c62c725fcbcdcc2d1c046fd9c315b9ef0a56bb31b43789a33906b906
data/VoiceIt2.rb CHANGED
@@ -76,10 +76,10 @@ class VoiceIt2
76
76
  e.response
77
77
  end
78
78
 
79
- def getAllEnrollmentsForUser(userId)
79
+ def getAllVoiceEnrollments(userId)
80
80
  return RestClient::Request.new(
81
81
  :method => :get,
82
- :url => @BASE_URL.to_s + 'enrollments/' + userId,
82
+ :url => @BASE_URL.to_s + 'enrollments/voice/' + userId,
83
83
  :user => @api_key,
84
84
  :password => @api_token,
85
85
  :headers => {
@@ -90,7 +90,21 @@ class VoiceIt2
90
90
  e.response
91
91
  end
92
92
 
93
- def deleteAllEnrollmentsForUser(userId)
93
+ def getAllVideoEnrollments(userId)
94
+ return RestClient::Request.new(
95
+ :method => :get,
96
+ :url => @BASE_URL.to_s + 'enrollments/video/' + userId,
97
+ :user => @api_key,
98
+ :password => @api_token,
99
+ :headers => {
100
+ platformId: '35'
101
+ }).execute
102
+
103
+ rescue => e
104
+ e.response
105
+ end
106
+
107
+ def deleteAllEnrollments(userId)
94
108
  return RestClient::Request.new(
95
109
  :method => :delete,
96
110
  :url => @BASE_URL.to_s + 'enrollments/' + userId + '/all',
@@ -104,7 +118,49 @@ class VoiceIt2
104
118
  e.response
105
119
  end
106
120
 
107
- def getFaceEnrollmentsForUser(userId)
121
+ def deleteAllVoiceEnrollments(userId)
122
+ return RestClient::Request.new(
123
+ :method => :delete,
124
+ :url => @BASE_URL.to_s + 'enrollments/' + userId + '/voice',
125
+ :user => @api_key,
126
+ :password => @api_token,
127
+ :headers => {
128
+ platformId: '35'
129
+ }).execute
130
+
131
+ rescue => e
132
+ e.response
133
+ end
134
+
135
+ def deleteAllFaceEnrollments(userId)
136
+ return RestClient::Request.new(
137
+ :method => :delete,
138
+ :url => @BASE_URL.to_s + 'enrollments/' + userId + '/face',
139
+ :user => @api_key,
140
+ :password => @api_token,
141
+ :headers => {
142
+ platformId: '35'
143
+ }).execute
144
+
145
+ rescue => e
146
+ e.response
147
+ end
148
+
149
+ def deleteAllVideoEnrollments(userId)
150
+ return RestClient::Request.new(
151
+ :method => :delete,
152
+ :url => @BASE_URL.to_s + 'enrollments/' + userId + '/video',
153
+ :user => @api_key,
154
+ :password => @api_token,
155
+ :headers => {
156
+ platformId: '35'
157
+ }).execute
158
+
159
+ rescue => e
160
+ e.response
161
+ end
162
+
163
+ def getAllFaceEnrollments(userId)
108
164
  return RestClient::Request.new(
109
165
  :method => :get,
110
166
  :url => @BASE_URL.to_s + 'enrollments/face/' + userId,
@@ -118,10 +174,34 @@ class VoiceIt2
118
174
  e.response
119
175
  end
120
176
 
121
- def createVoiceEnrollment(userId, contentLanguage, filePath)
177
+ def createVoiceEnrollment(userId, contentLanguage, phrase, filePath)
178
+ return RestClient::Request.new(
179
+ :method => :post,
180
+ :url => @BASE_URL.to_s + 'enrollments/voice',
181
+ :user => @api_key,
182
+ :password => @api_token,
183
+ :headers => {
184
+ platformId: '35'
185
+ },
186
+ :payload => {
187
+ :multipart => true,
188
+ :phrase => phrase,
189
+ :userId => userId,
190
+ :contentLanguage => contentLanguage,
191
+ :recording => File.new(filePath, 'rb')
192
+ }).execute
193
+ rescue => e
194
+ if e.class == Errno::ENOENT
195
+ raise e.message
196
+ else
197
+ e.response
198
+ end
199
+ end
200
+
201
+ def createVoiceEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
122
202
  return RestClient::Request.new(
123
203
  :method => :post,
124
- :url => @BASE_URL.to_s + 'enrollments',
204
+ :url => @BASE_URL.to_s + 'enrollments/voice/byUrl',
125
205
  :user => @api_key,
126
206
  :password => @api_token,
127
207
  :headers => {
@@ -129,18 +209,23 @@ class VoiceIt2
129
209
  },
130
210
  :payload => {
131
211
  :multipart => true,
212
+ :phrase => phrase,
132
213
  :userId => userId,
133
214
  :contentLanguage => contentLanguage,
134
- :recording => File.new(filePath, 'rb')
215
+ :fileUrl => fileUrl
135
216
  }).execute
136
217
  rescue => e
218
+ if e.class == Errno::ENOENT
219
+ raise e.message
220
+ else
137
221
  e.response
222
+ end
138
223
  end
139
224
 
140
- def createVoiceEnrollmentByUrl(userId, contentLanguage, fileUrl)
225
+ def createFaceEnrollment(userId, filePath, doBlinkDetection = false)
141
226
  return RestClient::Request.new(
142
227
  :method => :post,
143
- :url => @BASE_URL.to_s + 'enrollments/byUrl',
228
+ :url => @BASE_URL.to_s + 'enrollments/face',
144
229
  :user => @api_key,
145
230
  :password => @api_token,
146
231
  :headers => {
@@ -149,17 +234,21 @@ class VoiceIt2
149
234
  :payload => {
150
235
  :multipart => true,
151
236
  :userId => userId,
152
- :contentLanguage => contentLanguage,
153
- :fileUrl => fileUrl
237
+ :video => File.new(filePath, 'rb'),
238
+ :doBlinkDetection => doBlinkDetection
154
239
  }).execute
155
240
  rescue => e
241
+ if e.class == Errno::ENOENT
242
+ raise e.message
243
+ else
156
244
  e.response
245
+ end
157
246
  end
158
247
 
159
- def createFaceEnrollment(userId, filePath, doBlinkDetection = false)
248
+ def createFaceEnrollmentByUrl(userId, fileUrl, doBlinkDetection = false)
160
249
  return RestClient::Request.new(
161
250
  :method => :post,
162
- :url => @BASE_URL.to_s + 'enrollments/face',
251
+ :url => @BASE_URL.to_s + 'enrollments/face/byUrl',
163
252
  :user => @api_key,
164
253
  :password => @api_token,
165
254
  :headers => {
@@ -168,14 +257,14 @@ class VoiceIt2
168
257
  :payload => {
169
258
  :multipart => true,
170
259
  :userId => userId,
171
- :video => File.new(filePath, 'rb'),
260
+ :fileUrl => fileUrl,
172
261
  :doBlinkDetection => doBlinkDetection
173
262
  }).execute
174
263
  rescue => e
175
264
  e.response
176
265
  end
177
266
 
178
- def createVideoEnrollment(userId, contentLanguage, filePath, doBlinkDetection = false)
267
+ def createVideoEnrollment(userId, contentLanguage, phrase, filePath,doBlinkDetection = false)
179
268
  return RestClient::Request.new(
180
269
  :method => :post,
181
270
  :url => @BASE_URL.to_s + 'enrollments/video',
@@ -186,16 +275,21 @@ class VoiceIt2
186
275
  },
187
276
  :payload => {
188
277
  :multipart => true,
278
+ :phrase => phrase,
189
279
  :userId => userId,
190
280
  :contentLanguage => contentLanguage,
191
281
  :video => File.new(filePath, 'rb'),
192
282
  :doBlinkDetection => doBlinkDetection
193
283
  }).execute
194
284
  rescue => e
285
+ if e.class == Errno::ENOENT
286
+ raise e.message
287
+ else
195
288
  e.response
289
+ end
196
290
  end
197
291
 
198
- def createVideoEnrollmentByUrl(userId, contentLanguage, fileUrl, doBlinkDetection = false)
292
+ def createVideoEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl, doBlinkDetection = false)
199
293
  return RestClient::Request.new(
200
294
  :method => :post,
201
295
  :url => @BASE_URL.to_s + 'enrollments/video/byUrl',
@@ -206,13 +300,18 @@ class VoiceIt2
206
300
  },
207
301
  :payload => {
208
302
  :multipart => true,
303
+ :phrase => phrase,
209
304
  :userId => userId,
210
305
  :contentLanguage => contentLanguage,
211
306
  :fileUrl => fileUrl,
212
307
  :doBlinkDetection => doBlinkDetection
213
308
  }).execute
214
309
  rescue => e
310
+ if e.class == Errno::ENOENT
311
+ raise e.message
312
+ else
215
313
  e.response
314
+ end
216
315
  end
217
316
 
218
317
  def deleteFaceEnrollment(userId, faceEnrollmentId)
@@ -228,10 +327,23 @@ class VoiceIt2
228
327
  e.response
229
328
  end
230
329
 
231
- def deleteEnrollmentForUser(userId, enrollmentId)
330
+ def deleteVoiceEnrollment(userId, voiceEnrollmentId)
232
331
  return RestClient::Request.new(
233
332
  :method => :delete,
234
- :url => @BASE_URL.to_s + 'enrollments/' + userId + '/' + enrollmentId.to_s,
333
+ :url => @BASE_URL.to_s + 'enrollments/voice/' + userId + '/' + voiceEnrollmentId.to_s,
334
+ :user => @api_key,
335
+ :password => @api_token,
336
+ :headers => {
337
+ platformId: '35'
338
+ }).execute
339
+ rescue => e
340
+ e.response
341
+ end
342
+
343
+ def deleteVideoEnrollment(userId, enrollmentId)
344
+ return RestClient::Request.new(
345
+ :method => :delete,
346
+ :url => @BASE_URL.to_s + 'enrollments/video/' + userId + '/' + enrollmentId.to_s,
235
347
  :user => @api_key,
236
348
  :password => @api_token,
237
349
  :headers => {
@@ -255,6 +367,19 @@ class VoiceIt2
255
367
  e.response
256
368
  end
257
369
 
370
+ def getPhrases(contentLanguage)
371
+ return RestClient::Request.new(
372
+ :method => :get,
373
+ :url => @BASE_URL.to_s + 'phrases/' + contentLanguage,
374
+ :user => @api_key,
375
+ :password => @api_token,
376
+ :headers => {
377
+ platformId: '35'
378
+ }).execute
379
+ rescue => e
380
+ e.response
381
+ end
382
+
258
383
  def getGroup(groupId)
259
384
  return RestClient::Request.new(
260
385
  :method => :get,
@@ -347,10 +472,10 @@ class VoiceIt2
347
472
  e.response
348
473
  end
349
474
 
350
- def voiceVerification(userId, contentLanguage, filePath)
475
+ def voiceVerification(userId, contentLanguage, phrase, filePath)
351
476
  return RestClient::Request.new(
352
477
  :method => :post,
353
- :url => @BASE_URL.to_s + 'verification',
478
+ :url => @BASE_URL.to_s + 'verification/voice',
354
479
  :user => @api_key,
355
480
  :password => @api_token,
356
481
  :headers => {
@@ -358,18 +483,23 @@ class VoiceIt2
358
483
  },
359
484
  :payload => {
360
485
  :multipart => true,
486
+ :phrase => phrase,
361
487
  :userId => userId,
362
488
  :contentLanguage => contentLanguage,
363
489
  :recording => File.new(filePath, 'rb')
364
490
  }).execute
365
491
  rescue => e
492
+ if e.class == Errno::ENOENT
493
+ raise e.message
494
+ else
366
495
  e.response
496
+ end
367
497
  end
368
498
 
369
- def voiceVerificationByUrl(userId, contentLanguage, fileUrl)
499
+ def voiceVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
370
500
  return RestClient::Request.new(
371
501
  :method => :post,
372
- :url => @BASE_URL.to_s + 'verification/byUrl',
502
+ :url => @BASE_URL.to_s + 'verification/voice/byUrl',
373
503
  :user => @api_key,
374
504
  :password => @api_token,
375
505
  :headers => {
@@ -377,12 +507,17 @@ class VoiceIt2
377
507
  },
378
508
  :payload => {
379
509
  :multipart => true,
510
+ :phrase => phrase,
380
511
  :userId => userId,
381
512
  :contentLanguage => contentLanguage,
382
513
  :fileUrl => fileUrl
383
514
  }).execute
384
515
  rescue => e
516
+ if e.class == Errno::ENOENT
517
+ raise e.message
518
+ else
385
519
  e.response
520
+ end
386
521
  end
387
522
 
388
523
  def faceVerification(userId, filePath, doBlinkDetection = false)
@@ -401,10 +536,33 @@ class VoiceIt2
401
536
  :video => File.new(filePath, 'rb')
402
537
  }).execute
403
538
  rescue => e
539
+ if e.class == Errno::ENOENT
540
+ raise e.message
541
+ else
404
542
  e.response
543
+ end
405
544
  end
406
545
 
407
- def videoVerification(userId, contentLanguage, filePath, doBlinkDetection = false)
546
+ def faceVerificationByUrl(userId, fileUrl, doBlinkDetection = false)
547
+ return RestClient::Request.new(
548
+ :method => :post,
549
+ :url => @BASE_URL.to_s + 'verification/face/byUrl',
550
+ :user => @api_key,
551
+ :password => @api_token,
552
+ :headers => {
553
+ platformId: '35'
554
+ },
555
+ :payload => {
556
+ :multipart => true,
557
+ :userId => userId,
558
+ :doBlinkDetection => doBlinkDetection,
559
+ :fileUrl => fileUrl
560
+ }).execute
561
+ rescue => e
562
+ e.response
563
+ end
564
+
565
+ def videoVerification(userId, contentLanguage, phrase, filePath, doBlinkDetection = false)
408
566
  return RestClient::Request.new(
409
567
  :method => :post,
410
568
  :url => @BASE_URL.to_s + 'verification/video',
@@ -416,15 +574,20 @@ class VoiceIt2
416
574
  :payload => {
417
575
  :multipart => true,
418
576
  :userId => userId,
577
+ :phrase => phrase,
419
578
  :contentLanguage => contentLanguage,
420
579
  :doBlinkDetection => doBlinkDetection,
421
580
  :video => File.new(filePath, 'rb')
422
581
  }).execute
423
582
  rescue => e
583
+ if e.class == Errno::ENOENT
584
+ raise e.message
585
+ else
424
586
  e.response
587
+ end
425
588
  end
426
589
 
427
- def videoVerificationByUrl(userId, contentLanguage, fileUrl, doBlinkDetection = false)
590
+ def videoVerificationByUrl(userId, contentLanguage, phrase, fileUrl, doBlinkDetection = false)
428
591
  return RestClient::Request.new(
429
592
  :method => :post,
430
593
  :url => @BASE_URL.to_s + 'verification/video/byUrl',
@@ -435,19 +598,24 @@ class VoiceIt2
435
598
  },
436
599
  :payload => {
437
600
  :multipart => true,
601
+ :phrase => phrase,
438
602
  :userId => userId,
439
603
  :contentLanguage => contentLanguage,
440
604
  :doBlinkDetection => doBlinkDetection,
441
605
  :fileUrl => fileUrl
442
606
  }).execute
443
607
  rescue => e
608
+ if e.class == Errno::ENOENT
609
+ raise e.message
610
+ else
444
611
  e.response
612
+ end
445
613
  end
446
614
 
447
- def voiceIdentification(groupId, contentLanguage, filePath)
615
+ def voiceIdentification(groupId, contentLanguage, phrase, filePath)
448
616
  return RestClient::Request.new(
449
617
  :method => :post,
450
- :url => @BASE_URL.to_s + 'identification',
618
+ :url => @BASE_URL.to_s + 'identification/voice',
451
619
  :user => @api_key,
452
620
  :password => @api_token,
453
621
  :headers => {
@@ -455,18 +623,23 @@ class VoiceIt2
455
623
  },
456
624
  :payload => {
457
625
  :multipart => true,
626
+ :phrase => phrase,
458
627
  :groupId => groupId,
459
628
  :contentLanguage => contentLanguage,
460
629
  :recording => File.new(filePath, 'rb')
461
630
  }).execute
462
631
  rescue => e
632
+ if e.class == Errno::ENOENT
633
+ raise e.message
634
+ else
463
635
  e.response
636
+ end
464
637
  end
465
638
 
466
- def voiceIdentificationByUrl(groupId, contentLanguage, fileUrl)
639
+ def voiceIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
467
640
  return RestClient::Request.new(
468
641
  :method => :post,
469
- :url => @BASE_URL.to_s + 'identification/byUrl',
642
+ :url => @BASE_URL.to_s + 'identification/voice/byUrl',
470
643
  :user => @api_key,
471
644
  :password => @api_token,
472
645
  :headers => {
@@ -474,15 +647,62 @@ class VoiceIt2
474
647
  },
475
648
  :payload => {
476
649
  :multipart => true,
650
+ :phrase => phrase,
477
651
  :groupId => groupId,
478
652
  :contentLanguage => contentLanguage,
479
653
  :fileUrl => fileUrl
480
654
  }).execute
655
+ rescue => e
656
+ if e.class == Errno::ENOENT
657
+ raise e.message
658
+ else
659
+ e.response
660
+ end
661
+ end
662
+
663
+ def faceIdentification(groupId, filePath, doBlinkDetection = false)
664
+ return RestClient::Request.new(
665
+ :method => :post,
666
+ :url => @BASE_URL.to_s + 'identification/face',
667
+ :user => @api_key,
668
+ :password => @api_token,
669
+ :headers => {
670
+ platformId: '35'
671
+ },
672
+ :payload => {
673
+ :multipart => true,
674
+ :groupId => groupId,
675
+ :doBlinkDetection => doBlinkDetection,
676
+ :video => File.new(filePath, 'rb')
677
+ }).execute
678
+ rescue => e
679
+ if e.class == Errno::ENOENT
680
+ raise e.message
681
+ else
682
+ e.response
683
+ end
684
+ end
685
+
686
+ def faceIdentificationByUrl(groupId,fileUrl, doBlinkDetection = false)
687
+ return RestClient::Request.new(
688
+ :method => :post,
689
+ :url => @BASE_URL.to_s + 'identification/face/byUrl',
690
+ :user => @api_key,
691
+ :password => @api_token,
692
+ :headers => {
693
+ platformId: '35'
694
+ },
695
+ :payload => {
696
+ :multipart => true,
697
+ :groupId => groupId,
698
+ :doBlinkDetection => doBlinkDetection,
699
+ :fileUrl => fileUrl
700
+ }).execute
481
701
  rescue => e
482
702
  e.response
483
703
  end
484
704
 
485
- def videoIdentification(groupId, contentLanguage, filePath, doBlinkDetection = false)
705
+ def videoIdentification(groupId, contentLanguage, phrase, filePath, doBlinkDetection = false)
486
706
  return RestClient::Request.new(
487
707
  :method => :post,
488
708
  :url => @BASE_URL.to_s + 'identification/video',
@@ -493,16 +713,21 @@ class VoiceIt2
493
713
  },
494
714
  :payload => {
495
715
  :multipart => true,
716
+ :phrase => phrase,
496
717
  :groupId => groupId,
497
718
  :contentLanguage => contentLanguage,
498
719
  :doBlinkDetection => doBlinkDetection,
499
720
  :video => File.new(filePath, 'rb')
500
721
  }).execute
501
722
  rescue => e
723
+ if e.class == Errno::ENOENT
724
+ raise e.message
725
+ else
502
726
  e.response
727
+ end
503
728
  end
504
729
 
505
- def videoIdentificationByUrl(groupId, contentLanguage, fileUrl, doBlinkDetection = false)
730
+ def videoIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl, doBlinkDetection = false)
506
731
  return RestClient::Request.new(
507
732
  :method => :post,
508
733
  :url => @BASE_URL.to_s + 'identification/video/byUrl',
@@ -513,13 +738,18 @@ class VoiceIt2
513
738
  },
514
739
  :payload => {
515
740
  :multipart => true,
741
+ :phrase => phrase,
516
742
  :groupId => groupId,
517
743
  :contentLanguage => contentLanguage,
518
744
  :doBlinkDetection => doBlinkDetection,
519
745
  :fileUrl => fileUrl
520
746
  }).execute
521
747
  rescue => e
748
+ if e.class == Errno::ENOENT
749
+ raise e.message
750
+ else
522
751
  e.response
752
+ end
523
753
  end
524
754
 
525
755
 
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: 2.0.0
4
+ version: 3.0.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-08-23 00:00:00.000000000 Z
11
+ date: 2018-09-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A wrapper for VoiceIt API 2
14
14
  email: stephen@voiceit.io