class VoiceIt2
Constants
- BASE_URL
- VERSION
Attributes
BASE_URL[R]
api_key[R]
api_token[R]
notification_url[R]
Public Class Methods
new(key, tok)
click to toggle source
# File VoiceIt2.rb, line 11 def initialize(key, tok) @notification_url = "" @api_key = key @api_token = tok end
Public Instance Methods
addNotificationUrl(notificationURL)
click to toggle source
# File VoiceIt2.rb, line 17 def addNotificationUrl(notificationURL) @notification_url = "?notificationURL=" + CGI.escape(notificationURL) end
addUserToGroup(groupId, userId)
click to toggle source
# File VoiceIt2.rb, line 468 def addUserToGroup(groupId, userId) return RestClient::Request.new( :method => :put, :url => BASE_URL + 'groups/addUser' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :groupId => groupId, :userId => userId }).execute rescue => e e.response end
checkUserExists(userId)
click to toggle source
# File VoiceIt2.rb, line 53 def checkUserExists(userId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'users/' + userId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
createFaceEnrollment(userId, filePath)
click to toggle source
# File VoiceIt2.rb, line 302 def createFaceEnrollment(userId, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'enrollments/face' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :userId => userId, :video => File.new(filePath, 'rb'), }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
createFaceEnrollmentByUrl(userId, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 325 def createFaceEnrollmentByUrl(userId, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'enrollments/face/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :userId => userId, :fileUrl => fileUrl, }).execute rescue => e e.response end
createGroup(description)
click to toggle source
# File VoiceIt2.rb, line 450 def createGroup(description) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'groups' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :description => description }).execute rescue => e e.response end
createManagedSubAccount(firstName, lastName, email, password, contentLanguage)
click to toggle source
# File VoiceIt2.rb, line 82 def createManagedSubAccount(firstName, lastName, email, password, contentLanguage) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'subaccount/managed' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :firstName => firstName, :lastName => lastName, :email => email, :password => password, :contentLanguage => contentLanguage, }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
createUnmanagedSubAccount(firstName, lastName, email, password, contentLanguage)
click to toggle source
# File VoiceIt2.rb, line 122 def createUnmanagedSubAccount(firstName, lastName, email, password, contentLanguage) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'subaccount/unmanaged' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :firstName => firstName, :lastName => lastName, :email => email, :password => password, :contentLanguage => contentLanguage, }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
createUser()
click to toggle source
# File VoiceIt2.rb, line 39 def createUser return RestClient::Request.new( :method => :post, :url => BASE_URL + 'users' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
createUserToken(userId, secondsToTimeout)
click to toggle source
# File VoiceIt2.rb, line 804 def createUserToken(userId, secondsToTimeout) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'users/' + userId + '/token?timeOut=' + secondsToTimeout.to_s, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
createVideoEnrollment(userId, contentLanguage, phrase, filePath)
click to toggle source
# File VoiceIt2.rb, line 344 def createVideoEnrollment(userId, contentLanguage, phrase, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'enrollments/video' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :video => File.new(filePath, 'rb'), }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
createVideoEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 369 def createVideoEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'enrollments/video/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :fileUrl => fileUrl, }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
createVoiceEnrollment(userId, contentLanguage, phrase, filePath)
click to toggle source
# File VoiceIt2.rb, line 252 def createVoiceEnrollment(userId, contentLanguage, phrase, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'enrollments/voice' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :recording => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
createVoiceEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 277 def createVoiceEnrollmentByUrl(userId, contentLanguage, phrase, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'enrollments/voice/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :fileUrl => fileUrl }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
deleteAllEnrollments(userId)
click to toggle source
# File VoiceIt2.rb, line 222 def deleteAllEnrollments(userId) return RestClient::Request.new( :method => :delete, :url => BASE_URL + 'enrollments/' + userId + '/all' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
deleteGroup(groupId)
click to toggle source
# File VoiceIt2.rb, line 506 def deleteGroup(groupId) return RestClient::Request.new( :method => :delete, :url => BASE_URL + 'groups/' + groupId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
deleteSubAccount(subAccountAPIKey)
click to toggle source
# File VoiceIt2.rb, line 162 def deleteSubAccount(subAccountAPIKey) return RestClient::Request.new( :method => :delete, :url => BASE_URL + 'subaccount/' + subAccountAPIKey + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
deleteUser(userId)
click to toggle source
# File VoiceIt2.rb, line 67 def deleteUser(userId) return RestClient::Request.new( :method => :delete, :url => BASE_URL + 'users/' + userId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
expireUserTokens(userId)
click to toggle source
# File VoiceIt2.rb, line 818 def expireUserTokens(userId) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'users/' + userId + '/expireTokens', :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
faceIdentification(groupId, filePath)
click to toggle source
# File VoiceIt2.rb, line 712 def faceIdentification(groupId, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'identification/face' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :groupId => groupId, :video => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
faceIdentificationByUrl(groupId,fileUrl)
click to toggle source
# File VoiceIt2.rb, line 735 def faceIdentificationByUrl(groupId,fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'identification/face/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :groupId => groupId, :fileUrl => fileUrl }).execute rescue => e e.response end
faceVerification(userId, filePath)
click to toggle source
# File VoiceIt2.rb, line 570 def faceVerification(userId, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'verification/face' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :userId => userId, :video => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
faceVerificationByUrl(userId, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 593 def faceVerificationByUrl(userId, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'verification/face/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :userId => userId, :fileUrl => fileUrl }).execute rescue => e e.response end
getAllFaceEnrollments(userId)
click to toggle source
# File VoiceIt2.rb, line 237 def getAllFaceEnrollments(userId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'enrollments/face/' + userId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getAllGroups()
click to toggle source
# File VoiceIt2.rb, line 394 def getAllGroups() return RestClient::Request.new( :method => :get, :url => BASE_URL + 'groups' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getAllUsers()
click to toggle source
# File VoiceIt2.rb, line 25 def getAllUsers return RestClient::Request.new( :method => :get, :url => BASE_URL + 'users' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getAllVideoEnrollments(userId)
click to toggle source
# File VoiceIt2.rb, line 207 def getAllVideoEnrollments(userId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'enrollments/video/' + userId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getAllVoiceEnrollments(userId)
click to toggle source
# File VoiceIt2.rb, line 192 def getAllVoiceEnrollments(userId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'enrollments/voice/' + userId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getGroup(groupId)
click to toggle source
# File VoiceIt2.rb, line 422 def getGroup(groupId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'groups/' + groupId + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getGroupsForUser(userId)
click to toggle source
# File VoiceIt2.rb, line 177 def getGroupsForUser(userId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'users/' + userId + '/groups' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
getPhrases(contentLanguage)
click to toggle source
# File VoiceIt2.rb, line 408 def getPhrases(contentLanguage) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'phrases/' + contentLanguage + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
groupExists(groupId)
click to toggle source
# File VoiceIt2.rb, line 436 def groupExists(groupId) return RestClient::Request.new( :method => :get, :url => BASE_URL + 'groups/' + groupId + '/exists' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
regenerateSubAccountAPIToken(subAccountAPIKey)
click to toggle source
# File VoiceIt2.rb, line 148 def regenerateSubAccountAPIToken(subAccountAPIKey) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'subaccount/' + subAccountAPIKey + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
removeNotificationUrl()
click to toggle source
# File VoiceIt2.rb, line 21 def removeNotificationUrl() @notification_url = "" end
removeUserFromGroup(groupId, userId)
click to toggle source
# File VoiceIt2.rb, line 487 def removeUserFromGroup(groupId, userId) return RestClient::Request.new( :method => :put, :url => BASE_URL + 'groups/removeUser' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :groupId => groupId, :userId => userId }).execute rescue => e e.response end
switchSubAccountType(subAccountAPIKey)
click to toggle source
# File VoiceIt2.rb, line 108 def switchSubAccountType(subAccountAPIKey) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'subaccount/' + subAccountAPIKey + '/switchType' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }).execute rescue => e e.response end
videoIdentification(groupId, contentLanguage, phrase, filePath)
click to toggle source
# File VoiceIt2.rb, line 754 def videoIdentification(groupId, contentLanguage, phrase, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'identification/video' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :groupId => groupId, :contentLanguage => contentLanguage, :video => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
videoIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 779 def videoIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'identification/video/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :groupId => groupId, :contentLanguage => contentLanguage, :fileUrl => fileUrl }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
videoVerification(userId, contentLanguage, phrase, filePath)
click to toggle source
# File VoiceIt2.rb, line 612 def videoVerification(userId, contentLanguage, phrase, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'verification/video' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :userId => userId, :phrase => phrase, :contentLanguage => contentLanguage, :video => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
videoVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 637 def videoVerificationByUrl(userId, contentLanguage, phrase, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'verification/video/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :fileUrl => fileUrl }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
voiceIdentification(groupId, contentLanguage, phrase, filePath)
click to toggle source
# File VoiceIt2.rb, line 662 def voiceIdentification(groupId, contentLanguage, phrase, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'identification/voice' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :groupId => groupId, :contentLanguage => contentLanguage, :recording => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
voiceIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 687 def voiceIdentificationByUrl(groupId, contentLanguage, phrase, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'identification/voice/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :groupId => groupId, :contentLanguage => contentLanguage, :fileUrl => fileUrl }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
voiceVerification(userId, contentLanguage, phrase, filePath)
click to toggle source
# File VoiceIt2.rb, line 520 def voiceVerification(userId, contentLanguage, phrase, filePath) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'verification/voice' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :recording => File.new(filePath, 'rb') }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end
voiceVerificationByUrl(userId, contentLanguage, phrase, fileUrl)
click to toggle source
# File VoiceIt2.rb, line 545 def voiceVerificationByUrl(userId, contentLanguage, phrase, fileUrl) return RestClient::Request.new( :method => :post, :url => BASE_URL + 'verification/voice/byUrl' + @notification_url, :user => @api_key, :password => @api_token, :headers => { platformId: '35', platformVersion: VERSION }, :payload => { :multipart => true, :phrase => phrase, :userId => userId, :contentLanguage => contentLanguage, :fileUrl => fileUrl }).execute rescue => e if e.class == Errno::ENOENT raise e.message else e.response end end