VoiceIt2 3.3.0 → 3.6.1

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 +72 -65
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5acc67b867b14f9320d0a4a957d364dadfc2b8e0bf0bb301831ab78afd87b445
4
- data.tar.gz: 2cae849bb8d6cf2df35bb3d64eca39398880ab546c884e5015d28e4ebf21d05f
3
+ metadata.gz: 5a36e37eb709330d0f78784975ee1a0917e0d6b95597469b21929043e6d66040
4
+ data.tar.gz: 49db9d62907a6f20b8237cc60d324d1189458db6fbe5cc1093d0f17f264c63fc
5
5
  SHA512:
6
- metadata.gz: c8b183db0b76c5693e10acc61b168b75af5806ae118641f3945e85aba18215024839af9e5dc55a595395fb45d4af343a0f3dcc6720ae957601be97a20a38e932
7
- data.tar.gz: 124bd8354fda97f16115845fb589dd0a50499484d85454cec9ed9d76794330c61e5a19f19b34b12cd543e09370560c3e1f01c2793d7d82fe3ecb897aee7eab16
6
+ metadata.gz: 9f7c9d72c372c67d7a53352501e35688c5bb3745c909f84bd944b7acd3fd204798ca08c91106b69c32ce8e27d5c8018f2bf8ed769fbea33d457c0e307373299b
7
+ data.tar.gz: 7a48acd275f894fda42a72de7ae8992177809a6d68e5dc6982c752b24994052f6b1e3b4e350ca70357aab688c6b73237168d6105a545d6d952c691e11695a2d4
data/VoiceIt2.rb CHANGED
@@ -6,7 +6,7 @@ require 'cgi'
6
6
  class VoiceIt2
7
7
 
8
8
  BASE_URL = 'https://api.voiceit.io/'
9
- VERSION = '3.3.0'
9
+ VERSION = '3.6.1'
10
10
 
11
11
  def initialize(key, tok)
12
12
  @notification_url = ""
@@ -79,40 +79,90 @@ class VoiceIt2
79
79
  e.response
80
80
  end
81
81
 
82
- def getGroupsForUser(userId)
82
+ def createManagedSubAccount(firstName, lastName, email, password, contentLanguage)
83
+ return RestClient::Request.new(
84
+ :method => :post,
85
+ :url => BASE_URL + 'subaccount/managed' + @notification_url,
86
+ :user => @api_key,
87
+ :password => @api_token,
88
+ :headers => {
89
+ platformId: '35',
90
+ platformVersion: VERSION
91
+ },
92
+ :payload => {
93
+ :multipart => true,
94
+ :firstName => firstName,
95
+ :lastName => lastName,
96
+ :email => email,
97
+ :password => password,
98
+ :contentLanguage => contentLanguage,
99
+ }).execute
100
+ rescue => e
101
+ if e.class == Errno::ENOENT
102
+ raise e.message
103
+ else
104
+ e.response
105
+ end
106
+ end
107
+
108
+ def switchSubAccountType(subAccountAPIKey)
83
109
  return RestClient::Request.new(
84
- :method => :get,
85
- :url => BASE_URL + 'users/' + userId + '/groups' + @notification_url,
110
+ :method => :post,
111
+ :url => BASE_URL + 'subaccount/' + subAccountAPIKey + '/switchType' + @notification_url,
86
112
  :user => @api_key,
87
113
  :password => @api_token,
88
114
  :headers => {
89
115
  platformId: '35',
90
116
  platformVersion: VERSION
91
117
  }).execute
118
+ rescue => e
119
+ e.response
120
+ end
92
121
 
122
+ def createUnmanagedSubAccount(firstName, lastName, email, password, contentLanguage)
123
+ return RestClient::Request.new(
124
+ :method => :post,
125
+ :url => BASE_URL + 'subaccount/unmanaged' + @notification_url,
126
+ :user => @api_key,
127
+ :password => @api_token,
128
+ :headers => {
129
+ platformId: '35',
130
+ platformVersion: VERSION
131
+ },
132
+ :payload => {
133
+ :multipart => true,
134
+ :firstName => firstName,
135
+ :lastName => lastName,
136
+ :email => email,
137
+ :password => password,
138
+ :contentLanguage => contentLanguage,
139
+ }).execute
93
140
  rescue => e
141
+ if e.class == Errno::ENOENT
142
+ raise e.message
143
+ else
94
144
  e.response
145
+ end
95
146
  end
96
147
 
97
- def getAllVoiceEnrollments(userId)
148
+ def regenerateSubAccountAPIToken(subAccountAPIKey)
98
149
  return RestClient::Request.new(
99
- :method => :get,
100
- :url => BASE_URL + 'enrollments/voice/' + userId + @notification_url,
150
+ :method => :post,
151
+ :url => BASE_URL + 'subaccount/' + subAccountAPIKey + @notification_url,
101
152
  :user => @api_key,
102
153
  :password => @api_token,
103
154
  :headers => {
104
155
  platformId: '35',
105
156
  platformVersion: VERSION
106
157
  }).execute
107
-
108
158
  rescue => e
109
159
  e.response
110
160
  end
111
161
 
112
- def getAllVideoEnrollments(userId)
162
+ def deleteSubAccount(subAccountAPIKey)
113
163
  return RestClient::Request.new(
114
- :method => :get,
115
- :url => BASE_URL + 'enrollments/video/' + userId + @notification_url,
164
+ :method => :delete,
165
+ :url => BASE_URL + 'subaccount/' + subAccountAPIKey + @notification_url,
116
166
  :user => @api_key,
117
167
  :password => @api_token,
118
168
  :headers => {
@@ -124,10 +174,10 @@ class VoiceIt2
124
174
  e.response
125
175
  end
126
176
 
127
- def deleteAllEnrollments(userId)
177
+ def getGroupsForUser(userId)
128
178
  return RestClient::Request.new(
129
- :method => :delete,
130
- :url => BASE_URL + 'enrollments/' + userId + '/all' + @notification_url,
179
+ :method => :get,
180
+ :url => BASE_URL + 'users/' + userId + '/groups' + @notification_url,
131
181
  :user => @api_key,
132
182
  :password => @api_token,
133
183
  :headers => {
@@ -139,10 +189,10 @@ class VoiceIt2
139
189
  e.response
140
190
  end
141
191
 
142
- def deleteAllVoiceEnrollments(userId)
192
+ def getAllVoiceEnrollments(userId)
143
193
  return RestClient::Request.new(
144
- :method => :delete,
145
- :url => BASE_URL + 'enrollments/' + userId + '/voice' + @notification_url,
194
+ :method => :get,
195
+ :url => BASE_URL + 'enrollments/voice/' + userId + @notification_url,
146
196
  :user => @api_key,
147
197
  :password => @api_token,
148
198
  :headers => {
@@ -154,10 +204,10 @@ class VoiceIt2
154
204
  e.response
155
205
  end
156
206
 
157
- def deleteAllFaceEnrollments(userId)
207
+ def getAllVideoEnrollments(userId)
158
208
  return RestClient::Request.new(
159
- :method => :delete,
160
- :url => BASE_URL + 'enrollments/' + userId + '/face' + @notification_url,
209
+ :method => :get,
210
+ :url => BASE_URL + 'enrollments/video/' + userId + @notification_url,
161
211
  :user => @api_key,
162
212
  :password => @api_token,
163
213
  :headers => {
@@ -169,10 +219,10 @@ class VoiceIt2
169
219
  e.response
170
220
  end
171
221
 
172
- def deleteAllVideoEnrollments(userId)
222
+ def deleteAllEnrollments(userId)
173
223
  return RestClient::Request.new(
174
224
  :method => :delete,
175
- :url => BASE_URL + 'enrollments/' + userId + '/video' + @notification_url,
225
+ :url => BASE_URL + 'enrollments/' + userId + '/all' + @notification_url,
176
226
  :user => @api_key,
177
227
  :password => @api_token,
178
228
  :headers => {
@@ -341,49 +391,6 @@ class VoiceIt2
341
391
  end
342
392
  end
343
393
 
344
- def deleteFaceEnrollment(userId, faceEnrollmentId)
345
- return RestClient::Request.new(
346
- :method => :delete,
347
- :url => BASE_URL + 'enrollments/face/' + userId + '/' + faceEnrollmentId.to_s + @notification_url,
348
- :user => @api_key,
349
- :password => @api_token,
350
- :headers => {
351
- platformId: '35',
352
- platformVersion: VERSION
353
- }).execute
354
- rescue => e
355
- e.response
356
- end
357
-
358
- def deleteVoiceEnrollment(userId, voiceEnrollmentId)
359
- return RestClient::Request.new(
360
- :method => :delete,
361
- :url => BASE_URL + 'enrollments/voice/' + userId + '/' + voiceEnrollmentId.to_s + @notification_url,
362
- :user => @api_key,
363
- :password => @api_token,
364
- :headers => {
365
- platformId: '35',
366
- platformVersion: VERSION
367
- }).execute
368
- rescue => e
369
- e.response
370
- end
371
-
372
- def deleteVideoEnrollment(userId, enrollmentId)
373
- return RestClient::Request.new(
374
- :method => :delete,
375
- :url => BASE_URL + 'enrollments/video/' + userId + '/' + enrollmentId.to_s + @notification_url,
376
- :user => @api_key,
377
- :password => @api_token,
378
- :headers => {
379
- platformId: '35',
380
- platformVersion: VERSION
381
- }).execute
382
-
383
- rescue => e
384
- e.response
385
- end
386
-
387
394
  def getAllGroups()
388
395
  return RestClient::Request.new(
389
396
  :method => :get,
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.3.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - StephenAkers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-18 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A wrapper for VoiceIt API 2
14
14
  email: stephen@voiceit.io
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  version: '0'
39
39
  requirements: []
40
40
  rubyforge_project:
41
- rubygems_version: 2.7.7
41
+ rubygems_version: 2.7.6
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: VoiceIt Api 2