twilio-ruby 5.12.4 → 5.13.0

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +28 -13
  5. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +14 -6
  6. data/lib/twilio-ruby/rest/client.rb +7 -0
  7. data/lib/twilio-ruby/rest/preview.rb +28 -8
  8. data/lib/twilio-ruby/rest/preview/authy.rb +43 -0
  9. data/lib/twilio-ruby/rest/preview/authy/service.rb +364 -0
  10. data/lib/twilio-ruby/rest/preview/authy/service/entity.rb +326 -0
  11. data/lib/twilio-ruby/rest/preview/permissions.rb +35 -0
  12. data/lib/twilio-ruby/rest/preview/permissions/voice_permission.rb +131 -0
  13. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/bulk_country_update.rb +132 -0
  14. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/country.rb +391 -0
  15. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/country/highrisk_special_prefix.rb +192 -0
  16. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/settings.rb +197 -0
  17. data/lib/twilio-ruby/rest/preview/understand/assistant.rb +12 -6
  18. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb +13 -11
  19. data/lib/twilio-ruby/rest/pricing/v2/voice.rb +17 -0
  20. data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +214 -0
  21. data/lib/twilio-ruby/rest/verify.rb +46 -0
  22. data/lib/twilio-ruby/rest/verify/v1.rb +43 -0
  23. data/lib/twilio-ruby/rest/verify/v1/service.rb +391 -0
  24. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +185 -0
  25. data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +182 -0
  26. data/lib/twilio-ruby/version.rb +1 -1
  27. data/spec/integration/preview/authy/service/entity_spec.rb +173 -0
  28. data/spec/integration/preview/authy/service_spec.rb +201 -0
  29. data/spec/integration/preview/permissions/voice_permission/bulk_country_update_spec.rb +45 -0
  30. data/spec/integration/preview/permissions/voice_permission/country/highrisk_special_prefix_spec.rb +61 -0
  31. data/spec/integration/preview/permissions/voice_permission/country_spec.rb +112 -0
  32. data/spec/integration/preview/permissions/voice_permission/settings_spec.rb +77 -0
  33. data/spec/integration/preview/permissions/voice_permission_spec.rb +12 -0
  34. data/spec/integration/pricing/v2/voice/number_spec.rb +62 -0
  35. data/spec/integration/verify/v1/service/verification_check_spec.rb +52 -0
  36. data/spec/integration/verify/v1/service/verification_spec.rb +52 -0
  37. data/spec/integration/verify/v1/service_spec.rb +185 -0
  38. metadata +39 -2
@@ -0,0 +1,132 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Preview < Domain
12
+ class Permissions < Version
13
+ class VoicePermissionList < ListResource
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class BulkCountryUpdateList < ListResource
17
+ ##
18
+ # Initialize the BulkCountryUpdateList
19
+ # @param [Version] version Version that contains the resource
20
+ # @return [BulkCountryUpdateList] BulkCountryUpdateList
21
+ def initialize(version)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {}
26
+ @uri = "/VoicePermissions/BulkCountryUpdates"
27
+ end
28
+
29
+ ##
30
+ # Retrieve a single page of BulkCountryUpdateInstance records from the API.
31
+ # Request is executed immediately.
32
+ # @param [String] update_request Json list of update objects. eg : [ { "iso_code":
33
+ # "GB", "low_risk_numbers": "Enabled", "high_risk_special_numbers":"Enabled",
34
+ # "high_risk_irsf_numbers": "Enabled" } ]
35
+ # @return [BulkCountryUpdateInstance] Newly created BulkCountryUpdateInstance
36
+ def create(update_request: nil)
37
+ data = Twilio::Values.of({'UpdateRequest' => update_request, })
38
+
39
+ payload = @version.create(
40
+ 'POST',
41
+ @uri,
42
+ data: data
43
+ )
44
+
45
+ BulkCountryUpdateInstance.new(@version, payload, )
46
+ end
47
+
48
+ ##
49
+ # Provide a user friendly representation
50
+ def to_s
51
+ '#<Twilio.Preview.Permissions.BulkCountryUpdateList>'
52
+ end
53
+ end
54
+
55
+ ##
56
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
57
+ class BulkCountryUpdatePage < Page
58
+ ##
59
+ # Initialize the BulkCountryUpdatePage
60
+ # @param [Version] version Version that contains the resource
61
+ # @param [Response] response Response from the API
62
+ # @param [Hash] solution Path solution for the resource
63
+ # @return [BulkCountryUpdatePage] BulkCountryUpdatePage
64
+ def initialize(version, response, solution)
65
+ super(version, response)
66
+
67
+ # Path Solution
68
+ @solution = solution
69
+ end
70
+
71
+ ##
72
+ # Build an instance of BulkCountryUpdateInstance
73
+ # @param [Hash] payload Payload response from the API
74
+ # @return [BulkCountryUpdateInstance] BulkCountryUpdateInstance
75
+ def get_instance(payload)
76
+ BulkCountryUpdateInstance.new(@version, payload, )
77
+ end
78
+
79
+ ##
80
+ # Provide a user friendly representation
81
+ def to_s
82
+ '<Twilio.Preview.Permissions.BulkCountryUpdatePage>'
83
+ end
84
+ end
85
+
86
+ ##
87
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
88
+ class BulkCountryUpdateInstance < InstanceResource
89
+ ##
90
+ # Initialize the BulkCountryUpdateInstance
91
+ # @param [Version] version Version that contains the resource
92
+ # @param [Hash] payload payload that contains response from Twilio
93
+ # @return [BulkCountryUpdateInstance] BulkCountryUpdateInstance
94
+ def initialize(version, payload)
95
+ super(version)
96
+
97
+ # Marshaled Properties
98
+ @properties = {
99
+ 'update_count' => payload['update_count'].to_i,
100
+ 'update_request' => payload['update_request'],
101
+ }
102
+ end
103
+
104
+ ##
105
+ # @return [String] The number of countries successfully updated
106
+ def update_count
107
+ @properties['update_count']
108
+ end
109
+
110
+ ##
111
+ # @return [String] The update_request
112
+ def update_request
113
+ @properties['update_request']
114
+ end
115
+
116
+ ##
117
+ # Provide a user friendly representation
118
+ def to_s
119
+ "<Twilio.Preview.Permissions.BulkCountryUpdateInstance>"
120
+ end
121
+
122
+ ##
123
+ # Provide a detailed, user friendly representation
124
+ def inspect
125
+ "<Twilio.Preview.Permissions.BulkCountryUpdateInstance>"
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,391 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Preview < Domain
12
+ class Permissions < Version
13
+ class VoicePermissionList < ListResource
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class CountryList < ListResource
17
+ ##
18
+ # Initialize the CountryList
19
+ # @param [Version] version Version that contains the resource
20
+ # @return [CountryList] CountryList
21
+ def initialize(version)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {}
26
+ @uri = "/VoicePermissions/Countries"
27
+ end
28
+
29
+ ##
30
+ # Lists CountryInstance records from the API as a list.
31
+ # Unlike stream(), this operation is eager and will load `limit` records into
32
+ # memory before returning.
33
+ # @param [String] iso_code The [ISO country
34
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
35
+ # @param [String] continent Filter the results by specified continent
36
+ # @param [String] country_code Filter the results by specified [country
37
+ # codes](https://countrycode.org/)
38
+ # @param [Boolean] low_risk_numbers_enabled Filter the results by specified low
39
+ # risk special status
40
+ # @param [Boolean] high_risk_special_numbers_enabled Filter the results by
41
+ # specified the status of high risk special
42
+ # @param [Boolean] high_risk_tollfraud_numbers_enabled Filter the results by
43
+ # specified the status of high risk tollfraud special
44
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
45
+ # guarantees to never return more than limit. Default is no limit
46
+ # @param [Integer] page_size Number of records to fetch per request, when
47
+ # not set will use the default value of 50 records. If no page_size is defined
48
+ # but a limit is defined, stream() will attempt to read the limit with the most
49
+ # efficient page size, i.e. min(limit, 1000)
50
+ # @return [Array] Array of up to limit results
51
+ def list(iso_code: :unset, continent: :unset, country_code: :unset, low_risk_numbers_enabled: :unset, high_risk_special_numbers_enabled: :unset, high_risk_tollfraud_numbers_enabled: :unset, limit: nil, page_size: nil)
52
+ self.stream(
53
+ iso_code: iso_code,
54
+ continent: continent,
55
+ country_code: country_code,
56
+ low_risk_numbers_enabled: low_risk_numbers_enabled,
57
+ high_risk_special_numbers_enabled: high_risk_special_numbers_enabled,
58
+ high_risk_tollfraud_numbers_enabled: high_risk_tollfraud_numbers_enabled,
59
+ limit: limit,
60
+ page_size: page_size
61
+ ).entries
62
+ end
63
+
64
+ ##
65
+ # Streams CountryInstance records from the API as an Enumerable.
66
+ # This operation lazily loads records as efficiently as possible until the limit
67
+ # is reached.
68
+ # @param [String] iso_code The [ISO country
69
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
70
+ # @param [String] continent Filter the results by specified continent
71
+ # @param [String] country_code Filter the results by specified [country
72
+ # codes](https://countrycode.org/)
73
+ # @param [Boolean] low_risk_numbers_enabled Filter the results by specified low
74
+ # risk special status
75
+ # @param [Boolean] high_risk_special_numbers_enabled Filter the results by
76
+ # specified the status of high risk special
77
+ # @param [Boolean] high_risk_tollfraud_numbers_enabled Filter the results by
78
+ # specified the status of high risk tollfraud special
79
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
80
+ # guarantees to never return more than limit. Default is no limit.
81
+ # @param [Integer] page_size Number of records to fetch per request, when
82
+ # not set will use the default value of 50 records. If no page_size is defined
83
+ # but a limit is defined, stream() will attempt to read the limit with the most
84
+ # efficient page size, i.e. min(limit, 1000)
85
+ # @return [Enumerable] Enumerable that will yield up to limit results
86
+ def stream(iso_code: :unset, continent: :unset, country_code: :unset, low_risk_numbers_enabled: :unset, high_risk_special_numbers_enabled: :unset, high_risk_tollfraud_numbers_enabled: :unset, limit: nil, page_size: nil)
87
+ limits = @version.read_limits(limit, page_size)
88
+
89
+ page = self.page(
90
+ iso_code: iso_code,
91
+ continent: continent,
92
+ country_code: country_code,
93
+ low_risk_numbers_enabled: low_risk_numbers_enabled,
94
+ high_risk_special_numbers_enabled: high_risk_special_numbers_enabled,
95
+ high_risk_tollfraud_numbers_enabled: high_risk_tollfraud_numbers_enabled,
96
+ page_size: limits[:page_size],
97
+ )
98
+
99
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
100
+ end
101
+
102
+ ##
103
+ # When passed a block, yields CountryInstance records from the API.
104
+ # This operation lazily loads records as efficiently as possible until the limit
105
+ # is reached.
106
+ def each
107
+ limits = @version.read_limits
108
+
109
+ page = self.page(page_size: limits[:page_size], )
110
+
111
+ @version.stream(page,
112
+ limit: limits[:limit],
113
+ page_limit: limits[:page_limit]).each {|x| yield x}
114
+ end
115
+
116
+ ##
117
+ # Retrieve a single page of CountryInstance records from the API.
118
+ # Request is executed immediately.
119
+ # @param [String] iso_code The [ISO country
120
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
121
+ # @param [String] continent Filter the results by specified continent
122
+ # @param [String] country_code Filter the results by specified [country
123
+ # codes](https://countrycode.org/)
124
+ # @param [Boolean] low_risk_numbers_enabled Filter the results by specified low
125
+ # risk special status
126
+ # @param [Boolean] high_risk_special_numbers_enabled Filter the results by
127
+ # specified the status of high risk special
128
+ # @param [Boolean] high_risk_tollfraud_numbers_enabled Filter the results by
129
+ # specified the status of high risk tollfraud special
130
+ # @param [String] page_token PageToken provided by the API
131
+ # @param [Integer] page_number Page Number, this value is simply for client state
132
+ # @param [Integer] page_size Number of records to return, defaults to 50
133
+ # @return [Page] Page of CountryInstance
134
+ def page(iso_code: :unset, continent: :unset, country_code: :unset, low_risk_numbers_enabled: :unset, high_risk_special_numbers_enabled: :unset, high_risk_tollfraud_numbers_enabled: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
135
+ params = Twilio::Values.of({
136
+ 'IsoCode' => iso_code,
137
+ 'Continent' => continent,
138
+ 'CountryCode' => country_code,
139
+ 'LowRiskNumbersEnabled' => low_risk_numbers_enabled,
140
+ 'HighRiskSpecialNumbersEnabled' => high_risk_special_numbers_enabled,
141
+ 'HighRiskTollfraudNumbersEnabled' => high_risk_tollfraud_numbers_enabled,
142
+ 'PageToken' => page_token,
143
+ 'Page' => page_number,
144
+ 'PageSize' => page_size,
145
+ })
146
+ response = @version.page(
147
+ 'GET',
148
+ @uri,
149
+ params
150
+ )
151
+ CountryPage.new(@version, response, @solution)
152
+ end
153
+
154
+ ##
155
+ # Retrieve a single page of CountryInstance records from the API.
156
+ # Request is executed immediately.
157
+ # @param [String] target_url API-generated URL for the requested results page
158
+ # @return [Page] Page of CountryInstance
159
+ def get_page(target_url)
160
+ response = @version.domain.request(
161
+ 'GET',
162
+ target_url
163
+ )
164
+ CountryPage.new(@version, response, @solution)
165
+ end
166
+
167
+ ##
168
+ # Provide a user friendly representation
169
+ def to_s
170
+ '#<Twilio.Preview.Permissions.CountryList>'
171
+ end
172
+ end
173
+
174
+ ##
175
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
176
+ class CountryPage < Page
177
+ ##
178
+ # Initialize the CountryPage
179
+ # @param [Version] version Version that contains the resource
180
+ # @param [Response] response Response from the API
181
+ # @param [Hash] solution Path solution for the resource
182
+ # @return [CountryPage] CountryPage
183
+ def initialize(version, response, solution)
184
+ super(version, response)
185
+
186
+ # Path Solution
187
+ @solution = solution
188
+ end
189
+
190
+ ##
191
+ # Build an instance of CountryInstance
192
+ # @param [Hash] payload Payload response from the API
193
+ # @return [CountryInstance] CountryInstance
194
+ def get_instance(payload)
195
+ CountryInstance.new(@version, payload, )
196
+ end
197
+
198
+ ##
199
+ # Provide a user friendly representation
200
+ def to_s
201
+ '<Twilio.Preview.Permissions.CountryPage>'
202
+ end
203
+ end
204
+
205
+ ##
206
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
207
+ class CountryContext < InstanceContext
208
+ ##
209
+ # Initialize the CountryContext
210
+ # @param [Version] version Version that contains the resource
211
+ # @param [String] iso_code The [ISO country
212
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
213
+ # @return [CountryContext] CountryContext
214
+ def initialize(version, iso_code)
215
+ super(version)
216
+
217
+ # Path Solution
218
+ @solution = {iso_code: iso_code, }
219
+ @uri = "/VoicePermissions/Countries/#{@solution[:iso_code]}"
220
+
221
+ # Dependents
222
+ @highrisk_special_prefixes = nil
223
+ end
224
+
225
+ ##
226
+ # Fetch a CountryInstance
227
+ # @return [CountryInstance] Fetched CountryInstance
228
+ def fetch
229
+ params = Twilio::Values.of({})
230
+
231
+ payload = @version.fetch(
232
+ 'GET',
233
+ @uri,
234
+ params,
235
+ )
236
+
237
+ CountryInstance.new(@version, payload, iso_code: @solution[:iso_code], )
238
+ end
239
+
240
+ ##
241
+ # Access the highrisk_special_prefixes
242
+ # @return [HighriskSpecialPrefixList]
243
+ # @return [HighriskSpecialPrefixContext]
244
+ def highrisk_special_prefixes
245
+ unless @highrisk_special_prefixes
246
+ @highrisk_special_prefixes = HighriskSpecialPrefixList.new(
247
+ @version,
248
+ parent_iso_code: @solution[:iso_code],
249
+ )
250
+ end
251
+
252
+ @highrisk_special_prefixes
253
+ end
254
+
255
+ ##
256
+ # Provide a user friendly representation
257
+ def to_s
258
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
259
+ "#<Twilio.Preview.Permissions.CountryContext #{context}>"
260
+ end
261
+ end
262
+
263
+ ##
264
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
265
+ class CountryInstance < InstanceResource
266
+ ##
267
+ # Initialize the CountryInstance
268
+ # @param [Version] version Version that contains the resource
269
+ # @param [Hash] payload payload that contains response from Twilio
270
+ # @param [String] iso_code The [ISO country
271
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
272
+ # @return [CountryInstance] CountryInstance
273
+ def initialize(version, payload, iso_code: nil)
274
+ super(version)
275
+
276
+ # Marshaled Properties
277
+ @properties = {
278
+ 'iso_code' => payload['iso_code'],
279
+ 'name' => payload['name'],
280
+ 'continent' => payload['continent'],
281
+ 'country_codes' => payload['country_codes'],
282
+ 'low_risk_numbers_enabled' => payload['low_risk_numbers_enabled'],
283
+ 'high_risk_special_numbers_enabled' => payload['high_risk_special_numbers_enabled'],
284
+ 'high_risk_tollfraud_numbers_enabled' => payload['high_risk_tollfraud_numbers_enabled'],
285
+ 'url' => payload['url'],
286
+ 'links' => payload['links'],
287
+ }
288
+
289
+ # Context
290
+ @instance_context = nil
291
+ @params = {'iso_code' => iso_code || @properties['iso_code'], }
292
+ end
293
+
294
+ ##
295
+ # Generate an instance context for the instance, the context is capable of
296
+ # performing various actions. All instance actions are proxied to the context
297
+ # @return [CountryContext] CountryContext for this CountryInstance
298
+ def context
299
+ unless @instance_context
300
+ @instance_context = CountryContext.new(@version, @params['iso_code'], )
301
+ end
302
+ @instance_context
303
+ end
304
+
305
+ ##
306
+ # @return [String] The ISO country code
307
+ def iso_code
308
+ @properties['iso_code']
309
+ end
310
+
311
+ ##
312
+ # @return [String] Name of the country
313
+ def name
314
+ @properties['name']
315
+ end
316
+
317
+ ##
318
+ # @return [String] Name of the continent
319
+ def continent
320
+ @properties['continent']
321
+ end
322
+
323
+ ##
324
+ # @return [String] The list of country codes
325
+ def country_codes
326
+ @properties['country_codes']
327
+ end
328
+
329
+ ##
330
+ # @return [Boolean] True, if low risk numbers are enabled, else false
331
+ def low_risk_numbers_enabled
332
+ @properties['low_risk_numbers_enabled']
333
+ end
334
+
335
+ ##
336
+ # @return [Boolean] True, if high risk special numbers are enabled, else false
337
+ def high_risk_special_numbers_enabled
338
+ @properties['high_risk_special_numbers_enabled']
339
+ end
340
+
341
+ ##
342
+ # @return [Boolean] True, if high risk tollfraud numbers are enabled, else false
343
+ def high_risk_tollfraud_numbers_enabled
344
+ @properties['high_risk_tollfraud_numbers_enabled']
345
+ end
346
+
347
+ ##
348
+ # @return [String] The URL for this resource.
349
+ def url
350
+ @properties['url']
351
+ end
352
+
353
+ ##
354
+ # @return [String] The links
355
+ def links
356
+ @properties['links']
357
+ end
358
+
359
+ ##
360
+ # Fetch a CountryInstance
361
+ # @return [CountryInstance] Fetched CountryInstance
362
+ def fetch
363
+ context.fetch
364
+ end
365
+
366
+ ##
367
+ # Access the highrisk_special_prefixes
368
+ # @return [highrisk_special_prefixes] highrisk_special_prefixes
369
+ def highrisk_special_prefixes
370
+ context.highrisk_special_prefixes
371
+ end
372
+
373
+ ##
374
+ # Provide a user friendly representation
375
+ def to_s
376
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
377
+ "<Twilio.Preview.Permissions.CountryInstance #{values}>"
378
+ end
379
+
380
+ ##
381
+ # Provide a detailed, user friendly representation
382
+ def inspect
383
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
384
+ "<Twilio.Preview.Permissions.CountryInstance #{values}>"
385
+ end
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end