twilio-ruby 5.21.2 → 5.22.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 (55) 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.rb +2 -6
  5. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +3 -1
  6. data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +15 -9
  7. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +7 -0
  8. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +5 -5
  9. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +47 -43
  10. data/lib/twilio-ruby/rest/lookups/v1.rb +3 -1
  11. data/lib/twilio-ruby/rest/lookups.rb +3 -3
  12. data/lib/twilio-ruby/rest/messaging/v1/session/webhook.rb +448 -0
  13. data/lib/twilio-ruby/rest/messaging/v1/session.rb +26 -0
  14. data/lib/twilio-ruby/rest/messaging/v1/webhook.rb +15 -2
  15. data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +11 -7
  16. data/lib/twilio-ruby/rest/pricing/v1/messaging.rb +3 -1
  17. data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +11 -7
  18. data/lib/twilio-ruby/rest/pricing/v1/phone_number.rb +3 -1
  19. data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +11 -7
  20. data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +8 -8
  21. data/lib/twilio-ruby/rest/pricing/v1/voice.rb +4 -2
  22. data/lib/twilio-ruby/rest/pricing/v2/voice/country.rb +11 -9
  23. data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +23 -13
  24. data/lib/twilio-ruby/rest/pricing/v2/voice.rb +10 -7
  25. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb +1 -1
  26. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +343 -0
  27. data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +209 -0
  28. data/lib/twilio-ruby/rest/verify/v2/service.rb +507 -0
  29. data/lib/twilio-ruby/rest/verify/v2.rb +43 -0
  30. data/lib/twilio-ruby/rest/verify.rb +10 -3
  31. data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/bulk_country_update.rb +1 -1
  32. data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/country/highrisk_special_prefix.rb +1 -1
  33. data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/country.rb +1 -1
  34. data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/settings.rb +1 -1
  35. data/lib/twilio-ruby/rest/voice/v1/{voice_permission.rb → dialing_permissions.rb} +16 -16
  36. data/lib/twilio-ruby/rest/voice/v1.rb +4 -4
  37. data/lib/twilio-ruby/rest/voice.rb +3 -3
  38. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +15 -2
  39. data/lib/twilio-ruby/version.rb +1 -1
  40. data/spec/integration/api/v2010/account/queue/member_spec.rb +50 -9
  41. data/spec/integration/api/v2010/account/queue_spec.rb +16 -10
  42. data/spec/integration/lookups/v1/phone_number_spec.rb +263 -2
  43. data/spec/integration/messaging/v1/session/webhook_spec.rb +300 -0
  44. data/spec/integration/messaging/v1/session_spec.rb +8 -4
  45. data/spec/integration/messaging/v1/webhook_spec.rb +2 -0
  46. data/spec/integration/verify/v2/service/verification_check_spec.rb +54 -0
  47. data/spec/integration/verify/v2/service/verification_spec.rb +169 -0
  48. data/spec/integration/verify/v2/service_spec.rb +231 -0
  49. data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/bulk_country_update_spec.rb +2 -2
  50. data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/country/highrisk_special_prefix_spec.rb +3 -3
  51. data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/country_spec.rb +4 -4
  52. data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/settings_spec.rb +4 -4
  53. data/spec/integration/voice/v1/{voice_permission_spec.rb → dialing_permissions_spec.rb} +1 -1
  54. data/spec/integration/wireless/v1/sim_spec.rb +3 -0
  55. metadata +31 -18
@@ -63,8 +63,10 @@ module Twilio
63
63
  ##
64
64
  # Initialize the NumberContext
65
65
  # @param [Version] version Version that contains the resource
66
- # @param [String] destination_number This fetches the origin-based voice pricing
67
- # information for a phone number
66
+ # @param [String] destination_number The destination phone number, in
67
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to
68
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
69
+ # followed by the country code and subscriber number.
68
70
  # @return [NumberContext] NumberContext
69
71
  def initialize(version, destination_number)
70
72
  super(version)
@@ -76,7 +78,10 @@ module Twilio
76
78
 
77
79
  ##
78
80
  # Fetch a NumberInstance
79
- # @param [String] origination_number The origination_number
81
+ # @param [String] origination_number The origination phone number, in
82
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to
83
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
84
+ # followed by the country code and subscriber number.
80
85
  # @return [NumberInstance] Fetched NumberInstance
81
86
  def fetch(origination_number: :unset)
82
87
  params = Twilio::Values.of({'OriginationNumber' => origination_number, })
@@ -110,8 +115,10 @@ module Twilio
110
115
  # Initialize the NumberInstance
111
116
  # @param [Version] version Version that contains the resource
112
117
  # @param [Hash] payload payload that contains response from Twilio
113
- # @param [String] destination_number This fetches the origin-based voice pricing
114
- # information for a phone number
118
+ # @param [String] destination_number The destination phone number, in
119
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to
120
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
121
+ # followed by the country code and subscriber number.
115
122
  # @return [NumberInstance] NumberInstance
116
123
  def initialize(version, payload, destination_number: nil)
117
124
  super(version)
@@ -145,19 +152,19 @@ module Twilio
145
152
  end
146
153
 
147
154
  ##
148
- # @return [String] The destination phone number, in E.164
155
+ # @return [String] The destination phone number, in E.164 format
149
156
  def destination_number
150
157
  @properties['destination_number']
151
158
  end
152
159
 
153
160
  ##
154
- # @return [String] The origination phone number, in E.164
161
+ # @return [String] The origination phone number, in E.164 format
155
162
  def origination_number
156
163
  @properties['origination_number']
157
164
  end
158
165
 
159
166
  ##
160
- # @return [String] Name of the country
167
+ # @return [String] The name of the country
161
168
  def country
162
169
  @properties['country']
163
170
  end
@@ -169,32 +176,35 @@ module Twilio
169
176
  end
170
177
 
171
178
  ##
172
- # @return [String] List of OutboundCallPriceWithOrigin records
179
+ # @return [String] The list of OutboundCallPriceWithOrigin records
173
180
  def outbound_call_prices
174
181
  @properties['outbound_call_prices']
175
182
  end
176
183
 
177
184
  ##
178
- # @return [String] List of InboundCallPrice records
185
+ # @return [String] The InboundCallPrice record
179
186
  def inbound_call_price
180
187
  @properties['inbound_call_price']
181
188
  end
182
189
 
183
190
  ##
184
- # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
191
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
185
192
  def price_unit
186
193
  @properties['price_unit']
187
194
  end
188
195
 
189
196
  ##
190
- # @return [String] The URL of this resource.
197
+ # @return [String] The absolute URL of the resource
191
198
  def url
192
199
  @properties['url']
193
200
  end
194
201
 
195
202
  ##
196
203
  # Fetch a NumberInstance
197
- # @param [String] origination_number The origination_number
204
+ # @param [String] origination_number The origination phone number, in
205
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to
206
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
207
+ # followed by the country code and subscriber number.
198
208
  # @return [NumberInstance] Fetched NumberInstance
199
209
  def fetch(origination_number: :unset)
200
210
  context.fetch(origination_number: origination_number, )
@@ -28,8 +28,9 @@ module Twilio
28
28
 
29
29
  ##
30
30
  # Access the countries
31
- # @param [String] iso_country This fetches the origin-based voice pricing
32
- # information for a specific country
31
+ # @param [String] iso_country The [ISO country
32
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the origin-based voice
33
+ # pricing information to fetch.
33
34
  # @return [CountryList]
34
35
  # @return [CountryContext] if iso_country was passed.
35
36
  def countries(iso_country=:unset)
@@ -44,8 +45,10 @@ module Twilio
44
45
 
45
46
  ##
46
47
  # Access the numbers
47
- # @param [String] destination_number This fetches the origin-based voice pricing
48
- # information for a phone number
48
+ # @param [String] destination_number The destination phone number, in
49
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to
50
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
51
+ # followed by the country code and subscriber number.
49
52
  # @return [NumberList]
50
53
  # @return [NumberContext] if destination_number was passed.
51
54
  def numbers(destination_number=:unset)
@@ -108,19 +111,19 @@ module Twilio
108
111
  end
109
112
 
110
113
  ##
111
- # @return [String] The name
114
+ # @return [String] The resource name
112
115
  def name
113
116
  @properties['name']
114
117
  end
115
118
 
116
119
  ##
117
- # @return [String] The url
120
+ # @return [String] The absolute URL of the resource
118
121
  def url
119
122
  @properties['url']
120
123
  end
121
124
 
122
125
  ##
123
- # @return [String] The links
126
+ # @return [String] The URLs of the related Countries and Numbers resources
124
127
  def links
125
128
  @properties['links']
126
129
  end
@@ -166,7 +166,7 @@ module Twilio
166
166
  end
167
167
 
168
168
  ##
169
- # @return [String] The SID of the longest waiting Task
169
+ # @return [String] The longest_task_waiting_sid
170
170
  def longest_task_waiting_sid
171
171
  @properties['longest_task_waiting_sid']
172
172
  end
@@ -0,0 +1,343 @@
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 Verify < Domain
12
+ class V2 < Version
13
+ class ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class VerificationList < ListResource
17
+ ##
18
+ # Initialize the VerificationList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] service_sid The unique SID identifier of the Service.
21
+ # @return [VerificationList] VerificationList
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]}/Verifications"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of VerificationInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] to The To phonenumber of the phone being verified
34
+ # @param [String] channel The method in which the phone will be verified. Either
35
+ # sms or call
36
+ # @param [String] custom_message A character string containing a custom message
37
+ # for this verification
38
+ # @param [String] send_digits Digits to send when a phone call is started, same
39
+ # parameters as in Programmable Voice are supported
40
+ # @param [String] locale Supported values are af, ar, ca, cs, da, de, el, en, es,
41
+ # fi, fr, he, hi, hr, hu, id, it, ja, ko, ms, nb, nl, pl, pt, pr-BR, ro, ru, sv,
42
+ # th, tl, tr, vi, zh, zh-CN, zh-HK
43
+ # @param [String] custom_code Pass in a pre-generated code. Code length can be
44
+ # between 4-10 characters.
45
+ # @param [String] amount Amount of the associated PSD2 compliant transaction.
46
+ # Requires the PSD2 Service flag enabled.
47
+ # @param [String] payee Payee of the associated PSD2 compliant transaction.
48
+ # Requires the PSD2 Service flag enabled.
49
+ # @return [VerificationInstance] Newly created VerificationInstance
50
+ def create(to: nil, channel: nil, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset)
51
+ data = Twilio::Values.of({
52
+ 'To' => to,
53
+ 'Channel' => channel,
54
+ 'CustomMessage' => custom_message,
55
+ 'SendDigits' => send_digits,
56
+ 'Locale' => locale,
57
+ 'CustomCode' => custom_code,
58
+ 'Amount' => amount,
59
+ 'Payee' => payee,
60
+ })
61
+
62
+ payload = @version.create(
63
+ 'POST',
64
+ @uri,
65
+ data: data
66
+ )
67
+
68
+ VerificationInstance.new(@version, payload, service_sid: @solution[:service_sid], )
69
+ end
70
+
71
+ ##
72
+ # Provide a user friendly representation
73
+ def to_s
74
+ '#<Twilio.Verify.V2.VerificationList>'
75
+ end
76
+ end
77
+
78
+ ##
79
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
80
+ class VerificationPage < Page
81
+ ##
82
+ # Initialize the VerificationPage
83
+ # @param [Version] version Version that contains the resource
84
+ # @param [Response] response Response from the API
85
+ # @param [Hash] solution Path solution for the resource
86
+ # @return [VerificationPage] VerificationPage
87
+ def initialize(version, response, solution)
88
+ super(version, response)
89
+
90
+ # Path Solution
91
+ @solution = solution
92
+ end
93
+
94
+ ##
95
+ # Build an instance of VerificationInstance
96
+ # @param [Hash] payload Payload response from the API
97
+ # @return [VerificationInstance] VerificationInstance
98
+ def get_instance(payload)
99
+ VerificationInstance.new(@version, payload, service_sid: @solution[:service_sid], )
100
+ end
101
+
102
+ ##
103
+ # Provide a user friendly representation
104
+ def to_s
105
+ '<Twilio.Verify.V2.VerificationPage>'
106
+ end
107
+ end
108
+
109
+ ##
110
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
111
+ class VerificationContext < InstanceContext
112
+ ##
113
+ # Initialize the VerificationContext
114
+ # @param [Version] version Version that contains the resource
115
+ # @param [String] service_sid The unique SID identifier of the Service.
116
+ # @param [String] sid A 34 character string that uniquely identifies this
117
+ # Verification or the associated phone number.
118
+ # @return [VerificationContext] VerificationContext
119
+ def initialize(version, service_sid, sid)
120
+ super(version)
121
+
122
+ # Path Solution
123
+ @solution = {service_sid: service_sid, sid: sid, }
124
+ @uri = "/Services/#{@solution[:service_sid]}/Verifications/#{@solution[:sid]}"
125
+ end
126
+
127
+ ##
128
+ # Update the VerificationInstance
129
+ # @param [verification.Status] status New status to set for the Verification, only
130
+ # canceled is allowed at the moment.
131
+ # @return [VerificationInstance] Updated VerificationInstance
132
+ def update(status: nil)
133
+ data = Twilio::Values.of({'Status' => status, })
134
+
135
+ payload = @version.update(
136
+ 'POST',
137
+ @uri,
138
+ data: data,
139
+ )
140
+
141
+ VerificationInstance.new(
142
+ @version,
143
+ payload,
144
+ service_sid: @solution[:service_sid],
145
+ sid: @solution[:sid],
146
+ )
147
+ end
148
+
149
+ ##
150
+ # Fetch a VerificationInstance
151
+ # @return [VerificationInstance] Fetched VerificationInstance
152
+ def fetch
153
+ params = Twilio::Values.of({})
154
+
155
+ payload = @version.fetch(
156
+ 'GET',
157
+ @uri,
158
+ params,
159
+ )
160
+
161
+ VerificationInstance.new(
162
+ @version,
163
+ payload,
164
+ service_sid: @solution[:service_sid],
165
+ sid: @solution[:sid],
166
+ )
167
+ end
168
+
169
+ ##
170
+ # Provide a user friendly representation
171
+ def to_s
172
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
173
+ "#<Twilio.Verify.V2.VerificationContext #{context}>"
174
+ end
175
+
176
+ ##
177
+ # Provide a detailed, user friendly representation
178
+ def inspect
179
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
180
+ "#<Twilio.Verify.V2.VerificationContext #{context}>"
181
+ end
182
+ end
183
+
184
+ ##
185
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
186
+ class VerificationInstance < InstanceResource
187
+ ##
188
+ # Initialize the VerificationInstance
189
+ # @param [Version] version Version that contains the resource
190
+ # @param [Hash] payload payload that contains response from Twilio
191
+ # @param [String] service_sid The unique SID identifier of the Service.
192
+ # @param [String] sid A 34 character string that uniquely identifies this
193
+ # Verification or the associated phone number.
194
+ # @return [VerificationInstance] VerificationInstance
195
+ def initialize(version, payload, service_sid: nil, sid: nil)
196
+ super(version)
197
+
198
+ # Marshaled Properties
199
+ @properties = {
200
+ 'sid' => payload['sid'],
201
+ 'service_sid' => payload['service_sid'],
202
+ 'account_sid' => payload['account_sid'],
203
+ 'to' => payload['to'],
204
+ 'channel' => payload['channel'],
205
+ 'status' => payload['status'],
206
+ 'valid' => payload['valid'],
207
+ 'lookup' => payload['lookup'],
208
+ 'amount' => payload['amount'],
209
+ 'payee' => payload['payee'],
210
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
211
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
212
+ 'url' => payload['url'],
213
+ }
214
+
215
+ # Context
216
+ @instance_context = nil
217
+ @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
218
+ end
219
+
220
+ ##
221
+ # Generate an instance context for the instance, the context is capable of
222
+ # performing various actions. All instance actions are proxied to the context
223
+ # @return [VerificationContext] VerificationContext for this VerificationInstance
224
+ def context
225
+ unless @instance_context
226
+ @instance_context = VerificationContext.new(@version, @params['service_sid'], @params['sid'], )
227
+ end
228
+ @instance_context
229
+ end
230
+
231
+ ##
232
+ # @return [String] A string that uniquely identifies this Verification.
233
+ def sid
234
+ @properties['sid']
235
+ end
236
+
237
+ ##
238
+ # @return [String] Service Sid.
239
+ def service_sid
240
+ @properties['service_sid']
241
+ end
242
+
243
+ ##
244
+ # @return [String] Account Sid.
245
+ def account_sid
246
+ @properties['account_sid']
247
+ end
248
+
249
+ ##
250
+ # @return [String] To phonenumber
251
+ def to
252
+ @properties['to']
253
+ end
254
+
255
+ ##
256
+ # @return [verification.Channel] sms or call
257
+ def channel
258
+ @properties['channel']
259
+ end
260
+
261
+ ##
262
+ # @return [String] pending, approved, denied or expired
263
+ def status
264
+ @properties['status']
265
+ end
266
+
267
+ ##
268
+ # @return [Boolean] successful verification
269
+ def valid
270
+ @properties['valid']
271
+ end
272
+
273
+ ##
274
+ # @return [Hash] Info about the phone number
275
+ def lookup
276
+ @properties['lookup']
277
+ end
278
+
279
+ ##
280
+ # @return [String] Amount of the associated PSD2 compliant transaction.
281
+ def amount
282
+ @properties['amount']
283
+ end
284
+
285
+ ##
286
+ # @return [String] Payee of the associated PSD2 compliant transaction.
287
+ def payee
288
+ @properties['payee']
289
+ end
290
+
291
+ ##
292
+ # @return [Time] The date this Verification was created
293
+ def date_created
294
+ @properties['date_created']
295
+ end
296
+
297
+ ##
298
+ # @return [Time] The date this Verification was updated
299
+ def date_updated
300
+ @properties['date_updated']
301
+ end
302
+
303
+ ##
304
+ # @return [String] The URL of this resource.
305
+ def url
306
+ @properties['url']
307
+ end
308
+
309
+ ##
310
+ # Update the VerificationInstance
311
+ # @param [verification.Status] status New status to set for the Verification, only
312
+ # canceled is allowed at the moment.
313
+ # @return [VerificationInstance] Updated VerificationInstance
314
+ def update(status: nil)
315
+ context.update(status: status, )
316
+ end
317
+
318
+ ##
319
+ # Fetch a VerificationInstance
320
+ # @return [VerificationInstance] Fetched VerificationInstance
321
+ def fetch
322
+ context.fetch
323
+ end
324
+
325
+ ##
326
+ # Provide a user friendly representation
327
+ def to_s
328
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
329
+ "<Twilio.Verify.V2.VerificationInstance #{values}>"
330
+ end
331
+
332
+ ##
333
+ # Provide a detailed, user friendly representation
334
+ def inspect
335
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
336
+ "<Twilio.Verify.V2.VerificationInstance #{values}>"
337
+ end
338
+ end
339
+ end
340
+ end
341
+ end
342
+ end
343
+ end