twilio-ruby 5.22.0 → 5.22.1

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +15 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/client.rb +7 -0
  5. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  6. data/lib/twilio-ruby/rest/messaging/v1/session.rb +1 -7
  7. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +34 -32
  8. data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +37 -35
  9. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +45 -38
  10. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +38 -34
  11. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +67 -52
  12. data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +32 -23
  13. data/lib/twilio-ruby/rest/proxy/v1/service.rb +123 -79
  14. data/lib/twilio-ruby/rest/proxy/v1.rb +2 -1
  15. data/lib/twilio-ruby/rest/proxy.rb +2 -1
  16. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +366 -0
  17. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +384 -0
  18. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +348 -0
  19. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +358 -0
  20. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +398 -0
  21. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +417 -0
  22. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +366 -0
  23. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +384 -0
  24. data/lib/twilio-ruby/rest/{verify → serverless}/v1/service.rb +139 -175
  25. data/lib/twilio-ruby/rest/{verify → serverless}/v1.rb +6 -6
  26. data/lib/twilio-ruby/rest/serverless.rb +46 -0
  27. data/lib/twilio-ruby/rest/trunking/v1/trunk/terminating_sip_domain.rb +419 -0
  28. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +26 -0
  29. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +46 -38
  30. data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +24 -20
  31. data/lib/twilio-ruby/rest/verify/v2/service.rb +59 -57
  32. data/lib/twilio-ruby/rest/verify/v2.rb +2 -1
  33. data/lib/twilio-ruby/rest/verify.rb +2 -8
  34. data/lib/twilio-ruby/version.rb +1 -1
  35. data/spec/integration/flex_api/v1/configuration_spec.rb +15 -0
  36. data/spec/integration/messaging/v1/session/participant_spec.rb +10 -10
  37. data/spec/integration/serverless/v1/service/asset/asset_version_spec.rb +144 -0
  38. data/spec/integration/serverless/v1/service/asset_spec.rb +177 -0
  39. data/spec/integration/serverless/v1/service/build_spec.rb +184 -0
  40. data/spec/integration/serverless/v1/service/environment/deployment_spec.rb +137 -0
  41. data/spec/integration/serverless/v1/service/environment/variable_spec.rb +181 -0
  42. data/spec/integration/serverless/v1/service/environment_spec.rb +143 -0
  43. data/spec/integration/serverless/v1/service/function/function_version_spec.rb +144 -0
  44. data/spec/integration/serverless/v1/service/function_spec.rb +177 -0
  45. data/spec/integration/serverless/v1/service_spec.rb +180 -0
  46. data/spec/integration/trunking/v1/trunk/terminating_sip_domain_spec.rb +231 -0
  47. data/spec/integration/trunking/v1/trunk_spec.rb +12 -6
  48. metadata +34 -12
  49. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +0 -340
  50. data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +0 -209
  51. data/spec/integration/verify/v1/service/verification_check_spec.rb +0 -54
  52. data/spec/integration/verify/v1/service/verification_spec.rb +0 -169
  53. data/spec/integration/verify/v1/service_spec.rb +0 -231
@@ -8,10 +8,10 @@
8
8
 
9
9
  module Twilio
10
10
  module REST
11
- class Verify
11
+ class Serverless
12
12
  class V1 < Version
13
13
  ##
14
- # Initialize the V1 version of Verify
14
+ # Initialize the V1 version of Serverless
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
@@ -19,9 +19,9 @@ module Twilio
19
19
  end
20
20
 
21
21
  ##
22
- # @param [String] sid The unique SID identifier of Verification Service Instance.
23
- # @return [Twilio::REST::Verify::V1::ServiceContext] if sid was passed.
24
- # @return [Twilio::REST::Verify::V1::ServiceList]
22
+ # @param [String] sid The sid
23
+ # @return [Twilio::REST::Serverless::V1::ServiceContext] if sid was passed.
24
+ # @return [Twilio::REST::Serverless::V1::ServiceList]
25
25
  def services(sid=:unset)
26
26
  if sid.nil?
27
27
  raise ArgumentError, 'sid cannot be nil'
@@ -35,7 +35,7 @@ module Twilio
35
35
  ##
36
36
  # Provide a user friendly representation
37
37
  def to_s
38
- '<Twilio::REST::Verify::V1>'
38
+ '<Twilio::REST::Serverless::V1>'
39
39
  end
40
40
  end
41
41
  end
@@ -0,0 +1,46 @@
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 Serverless < Domain
12
+ ##
13
+ # Initialize the Serverless Domain
14
+ def initialize(twilio)
15
+ super
16
+
17
+ @base_url = 'https://serverless.twilio.com'
18
+ @host = 'serverless.twilio.com'
19
+ @port = 443
20
+
21
+ # Versions
22
+ @v1 = nil
23
+ end
24
+
25
+ ##
26
+ # Version v1 of serverless
27
+ def v1
28
+ @v1 ||= V1.new self
29
+ end
30
+
31
+ ##
32
+ # @param [String] sid The sid
33
+ # @return [Twilio::REST::Serverless::V1::ServiceInstance] if sid was passed.
34
+ # @return [Twilio::REST::Serverless::V1::ServiceList]
35
+ def services(sid=:unset)
36
+ self.v1.services(sid)
37
+ end
38
+
39
+ ##
40
+ # Provide a user friendly representation
41
+ def to_s
42
+ '#<Twilio::REST::Serverless>'
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,419 @@
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 Trunking < Domain
12
+ class V1 < Version
13
+ class TrunkContext < InstanceContext
14
+ class TerminatingSipDomainList < ListResource
15
+ ##
16
+ # Initialize the TerminatingSipDomainList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] trunk_sid The 34 character sid of the Trunk Twilio should route
19
+ # calls arriving at this domain. If a `TrunkSid` is present, Twilio will ignore
20
+ # all of the voice urls present and calls will be terminated through the specified
21
+ # trunk.
22
+ # @return [TerminatingSipDomainList] TerminatingSipDomainList
23
+ def initialize(version, trunk_sid: nil)
24
+ super(version)
25
+
26
+ # Path Solution
27
+ @solution = {trunk_sid: trunk_sid}
28
+ @uri = "/Trunks/#{@solution[:trunk_sid]}/TerminatingSipDomains"
29
+ end
30
+
31
+ ##
32
+ # Retrieve a single page of TerminatingSipDomainInstance records from the API.
33
+ # Request is executed immediately.
34
+ # @param [String] sip_domain_sid The SID of the [SIP
35
+ # Domain](https://www.twilio.com/docs/voice/sip/api/sip-domain-resource) that you
36
+ # want to associate with this trunk.
37
+ # @return [TerminatingSipDomainInstance] Newly created TerminatingSipDomainInstance
38
+ def create(sip_domain_sid: nil)
39
+ data = Twilio::Values.of({'SipDomainSid' => sip_domain_sid, })
40
+
41
+ payload = @version.create(
42
+ 'POST',
43
+ @uri,
44
+ data: data
45
+ )
46
+
47
+ TerminatingSipDomainInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], )
48
+ end
49
+
50
+ ##
51
+ # Lists TerminatingSipDomainInstance records from the API as a list.
52
+ # Unlike stream(), this operation is eager and will load `limit` records into
53
+ # memory before returning.
54
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
55
+ # guarantees to never return more than limit. Default is no limit
56
+ # @param [Integer] page_size Number of records to fetch per request, when
57
+ # not set will use the default value of 50 records. If no page_size is defined
58
+ # but a limit is defined, stream() will attempt to read the limit with the most
59
+ # efficient page size, i.e. min(limit, 1000)
60
+ # @return [Array] Array of up to limit results
61
+ def list(limit: nil, page_size: nil)
62
+ self.stream(limit: limit, page_size: page_size).entries
63
+ end
64
+
65
+ ##
66
+ # Streams TerminatingSipDomainInstance records from the API as an Enumerable.
67
+ # This operation lazily loads records as efficiently as possible until the limit
68
+ # is reached.
69
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
70
+ # guarantees to never return more than limit. Default is no limit.
71
+ # @param [Integer] page_size Number of records to fetch per request, when
72
+ # not set will use the default value of 50 records. If no page_size is defined
73
+ # but a limit is defined, stream() will attempt to read the limit with the most
74
+ # efficient page size, i.e. min(limit, 1000)
75
+ # @return [Enumerable] Enumerable that will yield up to limit results
76
+ def stream(limit: nil, page_size: nil)
77
+ limits = @version.read_limits(limit, page_size)
78
+
79
+ page = self.page(page_size: limits[:page_size], )
80
+
81
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
82
+ end
83
+
84
+ ##
85
+ # When passed a block, yields TerminatingSipDomainInstance records from the API.
86
+ # This operation lazily loads records as efficiently as possible until the limit
87
+ # is reached.
88
+ def each
89
+ limits = @version.read_limits
90
+
91
+ page = self.page(page_size: limits[:page_size], )
92
+
93
+ @version.stream(page,
94
+ limit: limits[:limit],
95
+ page_limit: limits[:page_limit]).each {|x| yield x}
96
+ end
97
+
98
+ ##
99
+ # Retrieve a single page of TerminatingSipDomainInstance records from the API.
100
+ # Request is executed immediately.
101
+ # @param [String] page_token PageToken provided by the API
102
+ # @param [Integer] page_number Page Number, this value is simply for client state
103
+ # @param [Integer] page_size Number of records to return, defaults to 50
104
+ # @return [Page] Page of TerminatingSipDomainInstance
105
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
106
+ params = Twilio::Values.of({
107
+ 'PageToken' => page_token,
108
+ 'Page' => page_number,
109
+ 'PageSize' => page_size,
110
+ })
111
+ response = @version.page(
112
+ 'GET',
113
+ @uri,
114
+ params
115
+ )
116
+ TerminatingSipDomainPage.new(@version, response, @solution)
117
+ end
118
+
119
+ ##
120
+ # Retrieve a single page of TerminatingSipDomainInstance records from the API.
121
+ # Request is executed immediately.
122
+ # @param [String] target_url API-generated URL for the requested results page
123
+ # @return [Page] Page of TerminatingSipDomainInstance
124
+ def get_page(target_url)
125
+ response = @version.domain.request(
126
+ 'GET',
127
+ target_url
128
+ )
129
+ TerminatingSipDomainPage.new(@version, response, @solution)
130
+ end
131
+
132
+ ##
133
+ # Provide a user friendly representation
134
+ def to_s
135
+ '#<Twilio.Trunking.V1.TerminatingSipDomainList>'
136
+ end
137
+ end
138
+
139
+ class TerminatingSipDomainPage < Page
140
+ ##
141
+ # Initialize the TerminatingSipDomainPage
142
+ # @param [Version] version Version that contains the resource
143
+ # @param [Response] response Response from the API
144
+ # @param [Hash] solution Path solution for the resource
145
+ # @return [TerminatingSipDomainPage] TerminatingSipDomainPage
146
+ def initialize(version, response, solution)
147
+ super(version, response)
148
+
149
+ # Path Solution
150
+ @solution = solution
151
+ end
152
+
153
+ ##
154
+ # Build an instance of TerminatingSipDomainInstance
155
+ # @param [Hash] payload Payload response from the API
156
+ # @return [TerminatingSipDomainInstance] TerminatingSipDomainInstance
157
+ def get_instance(payload)
158
+ TerminatingSipDomainInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], )
159
+ end
160
+
161
+ ##
162
+ # Provide a user friendly representation
163
+ def to_s
164
+ '<Twilio.Trunking.V1.TerminatingSipDomainPage>'
165
+ end
166
+ end
167
+
168
+ class TerminatingSipDomainContext < InstanceContext
169
+ ##
170
+ # Initialize the TerminatingSipDomainContext
171
+ # @param [Version] version Version that contains the resource
172
+ # @param [String] trunk_sid A unique string that identifies the trunk.
173
+ # @param [String] sid A unique string that identifies the associated domain to
174
+ # fetch.
175
+ # @return [TerminatingSipDomainContext] TerminatingSipDomainContext
176
+ def initialize(version, trunk_sid, sid)
177
+ super(version)
178
+
179
+ # Path Solution
180
+ @solution = {trunk_sid: trunk_sid, sid: sid, }
181
+ @uri = "/Trunks/#{@solution[:trunk_sid]}/TerminatingSipDomains/#{@solution[:sid]}"
182
+ end
183
+
184
+ ##
185
+ # Fetch a TerminatingSipDomainInstance
186
+ # @return [TerminatingSipDomainInstance] Fetched TerminatingSipDomainInstance
187
+ def fetch
188
+ params = Twilio::Values.of({})
189
+
190
+ payload = @version.fetch(
191
+ 'GET',
192
+ @uri,
193
+ params,
194
+ )
195
+
196
+ TerminatingSipDomainInstance.new(
197
+ @version,
198
+ payload,
199
+ trunk_sid: @solution[:trunk_sid],
200
+ sid: @solution[:sid],
201
+ )
202
+ end
203
+
204
+ ##
205
+ # Deletes the TerminatingSipDomainInstance
206
+ # @return [Boolean] true if delete succeeds, true otherwise
207
+ def delete
208
+ @version.delete('delete', @uri)
209
+ end
210
+
211
+ ##
212
+ # Provide a user friendly representation
213
+ def to_s
214
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
215
+ "#<Twilio.Trunking.V1.TerminatingSipDomainContext #{context}>"
216
+ end
217
+
218
+ ##
219
+ # Provide a detailed, user friendly representation
220
+ def inspect
221
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
222
+ "#<Twilio.Trunking.V1.TerminatingSipDomainContext #{context}>"
223
+ end
224
+ end
225
+
226
+ class TerminatingSipDomainInstance < InstanceResource
227
+ ##
228
+ # Initialize the TerminatingSipDomainInstance
229
+ # @param [Version] version Version that contains the resource
230
+ # @param [Hash] payload payload that contains response from Twilio
231
+ # @param [String] trunk_sid The 34 character sid of the Trunk Twilio should route
232
+ # calls arriving at this domain. If a `TrunkSid` is present, Twilio will ignore
233
+ # all of the voice urls present and calls will be terminated through the specified
234
+ # trunk.
235
+ # @param [String] sid A unique string that identifies the associated domain to
236
+ # fetch.
237
+ # @return [TerminatingSipDomainInstance] TerminatingSipDomainInstance
238
+ def initialize(version, payload, trunk_sid: nil, sid: nil)
239
+ super(version)
240
+
241
+ # Marshaled Properties
242
+ @properties = {
243
+ 'account_sid' => payload['account_sid'],
244
+ 'api_version' => payload['api_version'],
245
+ 'auth_type' => payload['auth_type'],
246
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
247
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
248
+ 'domain_name' => payload['domain_name'],
249
+ 'friendly_name' => payload['friendly_name'],
250
+ 'sid' => payload['sid'],
251
+ 'url' => payload['url'],
252
+ 'voice_fallback_method' => payload['voice_fallback_method'],
253
+ 'voice_fallback_url' => payload['voice_fallback_url'],
254
+ 'voice_method' => payload['voice_method'],
255
+ 'voice_status_callback_method' => payload['voice_status_callback_method'],
256
+ 'voice_status_callback_url' => payload['voice_status_callback_url'],
257
+ 'voice_url' => payload['voice_url'],
258
+ 'sip_registration' => payload['sip_registration'],
259
+ 'trunk_sid' => payload['trunk_sid'],
260
+ 'links' => payload['links'],
261
+ }
262
+
263
+ # Context
264
+ @instance_context = nil
265
+ @params = {'trunk_sid' => trunk_sid, 'sid' => sid || @properties['sid'], }
266
+ end
267
+
268
+ ##
269
+ # Generate an instance context for the instance, the context is capable of
270
+ # performing various actions. All instance actions are proxied to the context
271
+ # @return [TerminatingSipDomainContext] TerminatingSipDomainContext for this TerminatingSipDomainInstance
272
+ def context
273
+ unless @instance_context
274
+ @instance_context = TerminatingSipDomainContext.new(@version, @params['trunk_sid'], @params['sid'], )
275
+ end
276
+ @instance_context
277
+ end
278
+
279
+ ##
280
+ # @return [String] The unique id of the account responsible for this domain
281
+ def account_sid
282
+ @properties['account_sid']
283
+ end
284
+
285
+ ##
286
+ # @return [String] The Twilio API version used to process the call
287
+ def api_version
288
+ @properties['api_version']
289
+ end
290
+
291
+ ##
292
+ # @return [String] The types of authentication mapped to the domain
293
+ def auth_type
294
+ @properties['auth_type']
295
+ end
296
+
297
+ ##
298
+ # @return [Time] The date this resource was created
299
+ def date_created
300
+ @properties['date_created']
301
+ end
302
+
303
+ ##
304
+ # @return [Time] The date this resource was last updated
305
+ def date_updated
306
+ @properties['date_updated']
307
+ end
308
+
309
+ ##
310
+ # @return [String] The unique address on Twilio to route SIP traffic
311
+ def domain_name
312
+ @properties['domain_name']
313
+ end
314
+
315
+ ##
316
+ # @return [String] A user-specified, human-readable name for the domain.
317
+ def friendly_name
318
+ @properties['friendly_name']
319
+ end
320
+
321
+ ##
322
+ # @return [String] A string that uniquely identifies the SIP Domain
323
+ def sid
324
+ @properties['sid']
325
+ end
326
+
327
+ ##
328
+ # @return [String] The url
329
+ def url
330
+ @properties['url']
331
+ end
332
+
333
+ ##
334
+ # @return [String] HTTP method used with voice_fallback_url
335
+ def voice_fallback_method
336
+ @properties['voice_fallback_method']
337
+ end
338
+
339
+ ##
340
+ # @return [String] URL Twilio will request if an error occurs in executing TwiML
341
+ def voice_fallback_url
342
+ @properties['voice_fallback_url']
343
+ end
344
+
345
+ ##
346
+ # @return [String] HTTP method to use with voice_url
347
+ def voice_method
348
+ @properties['voice_method']
349
+ end
350
+
351
+ ##
352
+ # @return [String] The HTTP method Twilio will use to make requests to the StatusCallback URL.
353
+ def voice_status_callback_method
354
+ @properties['voice_status_callback_method']
355
+ end
356
+
357
+ ##
358
+ # @return [String] URL that Twilio will request with status updates
359
+ def voice_status_callback_url
360
+ @properties['voice_status_callback_url']
361
+ end
362
+
363
+ ##
364
+ # @return [String] URL Twilio will request when receiving a call
365
+ def voice_url
366
+ @properties['voice_url']
367
+ end
368
+
369
+ ##
370
+ # @return [Boolean] If SIP registration is allowed
371
+ def sip_registration
372
+ @properties['sip_registration']
373
+ end
374
+
375
+ ##
376
+ # @return [String] Unique string to identify an associated trunk
377
+ def trunk_sid
378
+ @properties['trunk_sid']
379
+ end
380
+
381
+ ##
382
+ # @return [String] The links
383
+ def links
384
+ @properties['links']
385
+ end
386
+
387
+ ##
388
+ # Fetch a TerminatingSipDomainInstance
389
+ # @return [TerminatingSipDomainInstance] Fetched TerminatingSipDomainInstance
390
+ def fetch
391
+ context.fetch
392
+ end
393
+
394
+ ##
395
+ # Deletes the TerminatingSipDomainInstance
396
+ # @return [Boolean] true if delete succeeds, true otherwise
397
+ def delete
398
+ context.delete
399
+ end
400
+
401
+ ##
402
+ # Provide a user friendly representation
403
+ def to_s
404
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
405
+ "<Twilio.Trunking.V1.TerminatingSipDomainInstance #{values}>"
406
+ end
407
+
408
+ ##
409
+ # Provide a detailed, user friendly representation
410
+ def inspect
411
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
412
+ "<Twilio.Trunking.V1.TerminatingSipDomainInstance #{values}>"
413
+ end
414
+ end
415
+ end
416
+ end
417
+ end
418
+ end
419
+ end