twilio-ruby 5.12.4 → 5.13.0

Sign up to get free protection for your applications and to get access to all the features.
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,326 @@
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 Authy < Version
13
+ class ServiceContext < InstanceContext
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 EntityList < ListResource
17
+ ##
18
+ # Initialize the EntityList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] service_sid The unique SID identifier of the Service.
21
+ # @return [EntityList] EntityList
22
+ def initialize(version, service_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {service_sid: service_sid}
27
+ @uri = "/Services/#{@solution[:service_sid]}/Entities"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of EntityInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] identity Customer unique identity for the Entity of the Service
34
+ # @return [EntityInstance] Newly created EntityInstance
35
+ def create(identity: nil)
36
+ data = Twilio::Values.of({'Identity' => identity, })
37
+
38
+ payload = @version.create(
39
+ 'POST',
40
+ @uri,
41
+ data: data
42
+ )
43
+
44
+ EntityInstance.new(@version, payload, service_sid: @solution[:service_sid], )
45
+ end
46
+
47
+ ##
48
+ # Lists EntityInstance records from the API as a list.
49
+ # Unlike stream(), this operation is eager and will load `limit` records into
50
+ # memory before returning.
51
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
52
+ # guarantees to never return more than limit. Default is no limit
53
+ # @param [Integer] page_size Number of records to fetch per request, when
54
+ # not set will use the default value of 50 records. If no page_size is defined
55
+ # but a limit is defined, stream() will attempt to read the limit with the most
56
+ # efficient page size, i.e. min(limit, 1000)
57
+ # @return [Array] Array of up to limit results
58
+ def list(limit: nil, page_size: nil)
59
+ self.stream(limit: limit, page_size: page_size).entries
60
+ end
61
+
62
+ ##
63
+ # Streams EntityInstance records from the API as an Enumerable.
64
+ # This operation lazily loads records as efficiently as possible until the limit
65
+ # is reached.
66
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
67
+ # guarantees to never return more than limit. Default is no limit.
68
+ # @param [Integer] page_size Number of records to fetch per request, when
69
+ # not set will use the default value of 50 records. If no page_size is defined
70
+ # but a limit is defined, stream() will attempt to read the limit with the most
71
+ # efficient page size, i.e. min(limit, 1000)
72
+ # @return [Enumerable] Enumerable that will yield up to limit results
73
+ def stream(limit: nil, page_size: nil)
74
+ limits = @version.read_limits(limit, page_size)
75
+
76
+ page = self.page(page_size: limits[:page_size], )
77
+
78
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
79
+ end
80
+
81
+ ##
82
+ # When passed a block, yields EntityInstance records from the API.
83
+ # This operation lazily loads records as efficiently as possible until the limit
84
+ # is reached.
85
+ def each
86
+ limits = @version.read_limits
87
+
88
+ page = self.page(page_size: limits[:page_size], )
89
+
90
+ @version.stream(page,
91
+ limit: limits[:limit],
92
+ page_limit: limits[:page_limit]).each {|x| yield x}
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of EntityInstance records from the API.
97
+ # Request is executed immediately.
98
+ # @param [String] page_token PageToken provided by the API
99
+ # @param [Integer] page_number Page Number, this value is simply for client state
100
+ # @param [Integer] page_size Number of records to return, defaults to 50
101
+ # @return [Page] Page of EntityInstance
102
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
103
+ params = Twilio::Values.of({
104
+ 'PageToken' => page_token,
105
+ 'Page' => page_number,
106
+ 'PageSize' => page_size,
107
+ })
108
+ response = @version.page(
109
+ 'GET',
110
+ @uri,
111
+ params
112
+ )
113
+ EntityPage.new(@version, response, @solution)
114
+ end
115
+
116
+ ##
117
+ # Retrieve a single page of EntityInstance records from the API.
118
+ # Request is executed immediately.
119
+ # @param [String] target_url API-generated URL for the requested results page
120
+ # @return [Page] Page of EntityInstance
121
+ def get_page(target_url)
122
+ response = @version.domain.request(
123
+ 'GET',
124
+ target_url
125
+ )
126
+ EntityPage.new(@version, response, @solution)
127
+ end
128
+
129
+ ##
130
+ # Provide a user friendly representation
131
+ def to_s
132
+ '#<Twilio.Preview.Authy.EntityList>'
133
+ end
134
+ end
135
+
136
+ ##
137
+ # 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.
138
+ class EntityPage < Page
139
+ ##
140
+ # Initialize the EntityPage
141
+ # @param [Version] version Version that contains the resource
142
+ # @param [Response] response Response from the API
143
+ # @param [Hash] solution Path solution for the resource
144
+ # @return [EntityPage] EntityPage
145
+ def initialize(version, response, solution)
146
+ super(version, response)
147
+
148
+ # Path Solution
149
+ @solution = solution
150
+ end
151
+
152
+ ##
153
+ # Build an instance of EntityInstance
154
+ # @param [Hash] payload Payload response from the API
155
+ # @return [EntityInstance] EntityInstance
156
+ def get_instance(payload)
157
+ EntityInstance.new(@version, payload, service_sid: @solution[:service_sid], )
158
+ end
159
+
160
+ ##
161
+ # Provide a user friendly representation
162
+ def to_s
163
+ '<Twilio.Preview.Authy.EntityPage>'
164
+ end
165
+ end
166
+
167
+ ##
168
+ # 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.
169
+ class EntityContext < InstanceContext
170
+ ##
171
+ # Initialize the EntityContext
172
+ # @param [Version] version Version that contains the resource
173
+ # @param [String] service_sid The unique SID identifier of the Service.
174
+ # @param [String] identity Customer unique identity for the Entity of the Service
175
+ # @return [EntityContext] EntityContext
176
+ def initialize(version, service_sid, identity)
177
+ super(version)
178
+
179
+ # Path Solution
180
+ @solution = {service_sid: service_sid, identity: identity, }
181
+ @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}"
182
+ end
183
+
184
+ ##
185
+ # Fetch a EntityInstance
186
+ # @return [EntityInstance] Fetched EntityInstance
187
+ def fetch
188
+ params = Twilio::Values.of({})
189
+
190
+ payload = @version.fetch(
191
+ 'GET',
192
+ @uri,
193
+ params,
194
+ )
195
+
196
+ EntityInstance.new(
197
+ @version,
198
+ payload,
199
+ service_sid: @solution[:service_sid],
200
+ identity: @solution[:identity],
201
+ )
202
+ end
203
+
204
+ ##
205
+ # Provide a user friendly representation
206
+ def to_s
207
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
208
+ "#<Twilio.Preview.Authy.EntityContext #{context}>"
209
+ end
210
+ end
211
+
212
+ ##
213
+ # 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.
214
+ class EntityInstance < InstanceResource
215
+ ##
216
+ # Initialize the EntityInstance
217
+ # @param [Version] version Version that contains the resource
218
+ # @param [Hash] payload payload that contains response from Twilio
219
+ # @param [String] service_sid The unique SID identifier of the Service.
220
+ # @param [String] identity Customer unique identity for the Entity of the Service
221
+ # @return [EntityInstance] EntityInstance
222
+ def initialize(version, payload, service_sid: nil, identity: nil)
223
+ super(version)
224
+
225
+ # Marshaled Properties
226
+ @properties = {
227
+ 'sid' => payload['sid'],
228
+ 'identity' => payload['identity'],
229
+ 'account_sid' => payload['account_sid'],
230
+ 'service_sid' => payload['service_sid'],
231
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
232
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
233
+ 'url' => payload['url'],
234
+ 'links' => payload['links'],
235
+ }
236
+
237
+ # Context
238
+ @instance_context = nil
239
+ @params = {'service_sid' => service_sid, 'identity' => identity || @properties['identity'], }
240
+ end
241
+
242
+ ##
243
+ # Generate an instance context for the instance, the context is capable of
244
+ # performing various actions. All instance actions are proxied to the context
245
+ # @return [EntityContext] EntityContext for this EntityInstance
246
+ def context
247
+ unless @instance_context
248
+ @instance_context = EntityContext.new(@version, @params['service_sid'], @params['identity'], )
249
+ end
250
+ @instance_context
251
+ end
252
+
253
+ ##
254
+ # @return [String] A string that uniquely identifies this Entity.
255
+ def sid
256
+ @properties['sid']
257
+ end
258
+
259
+ ##
260
+ # @return [String] Unique identity of the Entity
261
+ def identity
262
+ @properties['identity']
263
+ end
264
+
265
+ ##
266
+ # @return [String] Account Sid.
267
+ def account_sid
268
+ @properties['account_sid']
269
+ end
270
+
271
+ ##
272
+ # @return [String] Service Sid.
273
+ def service_sid
274
+ @properties['service_sid']
275
+ end
276
+
277
+ ##
278
+ # @return [Time] The date this Entity was created
279
+ def date_created
280
+ @properties['date_created']
281
+ end
282
+
283
+ ##
284
+ # @return [Time] The date this Entity was updated
285
+ def date_updated
286
+ @properties['date_updated']
287
+ end
288
+
289
+ ##
290
+ # @return [String] The URL of this resource.
291
+ def url
292
+ @properties['url']
293
+ end
294
+
295
+ ##
296
+ # @return [String] Nested resource URLs.
297
+ def links
298
+ @properties['links']
299
+ end
300
+
301
+ ##
302
+ # Fetch a EntityInstance
303
+ # @return [EntityInstance] Fetched EntityInstance
304
+ def fetch
305
+ context.fetch
306
+ end
307
+
308
+ ##
309
+ # Provide a user friendly representation
310
+ def to_s
311
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
312
+ "<Twilio.Preview.Authy.EntityInstance #{values}>"
313
+ end
314
+
315
+ ##
316
+ # Provide a detailed, user friendly representation
317
+ def inspect
318
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
319
+ "<Twilio.Preview.Authy.EntityInstance #{values}>"
320
+ end
321
+ end
322
+ end
323
+ end
324
+ end
325
+ end
326
+ end
@@ -0,0 +1,35 @@
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
12
+ class Permissions < Version
13
+ ##
14
+ # Initialize the Permissions version of Preview
15
+ def initialize(domain)
16
+ super
17
+ @version = 'permissions'
18
+ @voice_permissions = nil
19
+ end
20
+
21
+ ##
22
+ # @return [Twilio::REST::Preview::Permissions::VoicePermissionContext]
23
+ def voice_permissions
24
+ @voice_permissions ||= VoicePermissionList.new self
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '<Twilio::REST::Preview::Permissions>'
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,131 @@
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
+ ##
14
+ # 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.
15
+ class VoicePermissionList < ListResource
16
+ ##
17
+ # Initialize the VoicePermissionList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [VoicePermissionList] VoicePermissionList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+
26
+ # Components
27
+ @countries = nil
28
+ @settings = nil
29
+ @bulk_country_updates = nil
30
+ end
31
+
32
+ ##
33
+ # Access the countries
34
+ # @param [String] iso_code The [ISO country
35
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
36
+ # @return [CountryList]
37
+ # @return [CountryContext] if iso_code was passed.
38
+ def countries(iso_code=:unset)
39
+ raise ArgumentError, 'iso_code cannot be nil' if iso_code.nil?
40
+
41
+ if iso_code != :unset
42
+ return CountryContext.new(@version, iso_code, )
43
+ end
44
+
45
+ @countries ||= CountryList.new(@version, )
46
+ end
47
+
48
+ ##
49
+ # Access the settings
50
+ # @return [SettingsList]
51
+ # @return [SettingsContext]
52
+ def settings
53
+ return SettingsContext.new(@version, )
54
+
55
+ @settings ||= SettingsList.new(@version, )
56
+ end
57
+
58
+ ##
59
+ # Access the bulk_country_updates
60
+ # @return [BulkCountryUpdateList]
61
+ # @return [BulkCountryUpdateContext]
62
+ def bulk_country_updates
63
+ @bulk_country_updates ||= BulkCountryUpdateList.new(@version, )
64
+ end
65
+
66
+ ##
67
+ # Provide a user friendly representation
68
+ def to_s
69
+ '#<Twilio.Preview.Permissions.VoicePermissionList>'
70
+ end
71
+ end
72
+
73
+ ##
74
+ # 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.
75
+ class VoicePermissionPage < Page
76
+ ##
77
+ # Initialize the VoicePermissionPage
78
+ # @param [Version] version Version that contains the resource
79
+ # @param [Response] response Response from the API
80
+ # @param [Hash] solution Path solution for the resource
81
+ # @return [VoicePermissionPage] VoicePermissionPage
82
+ def initialize(version, response, solution)
83
+ super(version, response)
84
+
85
+ # Path Solution
86
+ @solution = solution
87
+ end
88
+
89
+ ##
90
+ # Build an instance of VoicePermissionInstance
91
+ # @param [Hash] payload Payload response from the API
92
+ # @return [VoicePermissionInstance] VoicePermissionInstance
93
+ def get_instance(payload)
94
+ VoicePermissionInstance.new(@version, payload, )
95
+ end
96
+
97
+ ##
98
+ # Provide a user friendly representation
99
+ def to_s
100
+ '<Twilio.Preview.Permissions.VoicePermissionPage>'
101
+ end
102
+ end
103
+
104
+ ##
105
+ # 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.
106
+ class VoicePermissionInstance < InstanceResource
107
+ ##
108
+ # Initialize the VoicePermissionInstance
109
+ # @param [Version] version Version that contains the resource
110
+ # @param [Hash] payload payload that contains response from Twilio
111
+ # @return [VoicePermissionInstance] VoicePermissionInstance
112
+ def initialize(version, payload)
113
+ super(version)
114
+ end
115
+
116
+ ##
117
+ # Provide a user friendly representation
118
+ def to_s
119
+ "<Twilio.Preview.Permissions.VoicePermissionInstance>"
120
+ end
121
+
122
+ ##
123
+ # Provide a detailed, user friendly representation
124
+ def inspect
125
+ "<Twilio.Preview.Permissions.VoicePermissionInstance>"
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end