twilio-ruby 5.21.2 → 5.22.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -204,6 +204,7 @@ module Twilio
204
204
  # Dependents
205
205
  @participants = nil
206
206
  @messages = nil
207
+ @webhooks = nil
207
208
  end
208
209
 
209
210
  ##
@@ -294,6 +295,24 @@ module Twilio
294
295
  @messages
295
296
  end
296
297
 
298
+ ##
299
+ # Access the webhooks
300
+ # @return [WebhookList]
301
+ # @return [WebhookContext] if sid was passed.
302
+ def webhooks(sid=:unset)
303
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
304
+
305
+ if sid != :unset
306
+ return WebhookContext.new(@version, @solution[:sid], sid, )
307
+ end
308
+
309
+ unless @webhooks
310
+ @webhooks = WebhookList.new(@version, session_sid: @solution[:sid], )
311
+ end
312
+
313
+ @webhooks
314
+ end
315
+
297
316
  ##
298
317
  # Provide a user friendly representation
299
318
  def to_s
@@ -469,6 +488,13 @@ module Twilio
469
488
  context.messages
470
489
  end
471
490
 
491
+ ##
492
+ # Access the webhooks
493
+ # @return [webhooks] webhooks
494
+ def webhooks
495
+ context.webhooks
496
+ end
497
+
472
498
  ##
473
499
  # Provide a user friendly representation
474
500
  def to_s
@@ -108,8 +108,10 @@ module Twilio
108
108
  # @param [String] post_webhook_retry_count The number of retries in case of
109
109
  # post-event webhook request failures. Maximum 3 retries are allowed, the default
110
110
  # value is 0.
111
+ # @param [webhook.Target] target The routing target of the webhook. Can be
112
+ # ordinary or route internally to Flex
111
113
  # @return [WebhookInstance] Updated WebhookInstance
112
- def update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset)
114
+ def update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, target: :unset)
113
115
  data = Twilio::Values.of({
114
116
  'WebhookMethod' => webhook_method,
115
117
  'WebhookFilters' => Twilio.serialize_list(webhook_filters) { |e| e },
@@ -117,6 +119,7 @@ module Twilio
117
119
  'PostWebhookUrl' => post_webhook_url,
118
120
  'PreWebhookRetryCount' => pre_webhook_retry_count,
119
121
  'PostWebhookRetryCount' => post_webhook_retry_count,
122
+ 'Target' => target,
120
123
  })
121
124
 
122
125
  payload = @version.update(
@@ -164,6 +167,7 @@ module Twilio
164
167
  'post_webhook_url' => payload['post_webhook_url'],
165
168
  'pre_webhook_retry_count' => payload['pre_webhook_retry_count'].to_i,
166
169
  'post_webhook_retry_count' => payload['post_webhook_retry_count'].to_i,
170
+ 'target' => payload['target'],
167
171
  'url' => payload['url'],
168
172
  }
169
173
 
@@ -231,6 +235,12 @@ module Twilio
231
235
  @properties['post_webhook_retry_count']
232
236
  end
233
237
 
238
+ ##
239
+ # @return [webhook.Target] The routing target of the webhook.
240
+ def target
241
+ @properties['target']
242
+ end
243
+
234
244
  ##
235
245
  # @return [String] An absolute URL for this webhook.
236
246
  def url
@@ -260,8 +270,10 @@ module Twilio
260
270
  # @param [String] post_webhook_retry_count The number of retries in case of
261
271
  # post-event webhook request failures. Maximum 3 retries are allowed, the default
262
272
  # value is 0.
273
+ # @param [webhook.Target] target The routing target of the webhook. Can be
274
+ # ordinary or route internally to Flex
263
275
  # @return [WebhookInstance] Updated WebhookInstance
264
- def update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset)
276
+ def update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, target: :unset)
265
277
  context.update(
266
278
  webhook_method: webhook_method,
267
279
  webhook_filters: webhook_filters,
@@ -269,6 +281,7 @@ module Twilio
269
281
  post_webhook_url: post_webhook_url,
270
282
  pre_webhook_retry_count: pre_webhook_retry_count,
271
283
  post_webhook_retry_count: post_webhook_retry_count,
284
+ target: target,
272
285
  )
273
286
  end
274
287
 
@@ -146,7 +146,9 @@ module Twilio
146
146
  ##
147
147
  # Initialize the CountryContext
148
148
  # @param [Version] version Version that contains the resource
149
- # @param [String] iso_country The iso_country
149
+ # @param [String] iso_country The [ISO country
150
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
151
+ # information to fetch.
150
152
  # @return [CountryContext] CountryContext
151
153
  def initialize(version, iso_country)
152
154
  super(version)
@@ -191,7 +193,9 @@ module Twilio
191
193
  # Initialize the CountryInstance
192
194
  # @param [Version] version Version that contains the resource
193
195
  # @param [Hash] payload payload that contains response from Twilio
194
- # @param [String] iso_country The iso_country
196
+ # @param [String] iso_country The [ISO country
197
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
198
+ # information to fetch.
195
199
  # @return [CountryInstance] CountryInstance
196
200
  def initialize(version, payload, iso_country: nil)
197
201
  super(version)
@@ -223,7 +227,7 @@ module Twilio
223
227
  end
224
228
 
225
229
  ##
226
- # @return [String] Name of the country
230
+ # @return [String] The name of the country
227
231
  def country
228
232
  @properties['country']
229
233
  end
@@ -235,25 +239,25 @@ module Twilio
235
239
  end
236
240
 
237
241
  ##
238
- # @return [String] List of OutboundSMSPrice records
242
+ # @return [String] The list of OutboundSMSPrice records
239
243
  def outbound_sms_prices
240
244
  @properties['outbound_sms_prices']
241
245
  end
242
246
 
243
247
  ##
244
- # @return [String] List of InboundPrice records
248
+ # @return [String] The list of InboundPrice records
245
249
  def inbound_sms_prices
246
250
  @properties['inbound_sms_prices']
247
251
  end
248
252
 
249
253
  ##
250
- # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
254
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
251
255
  def price_unit
252
256
  @properties['price_unit']
253
257
  end
254
258
 
255
259
  ##
256
- # @return [String] The url
260
+ # @return [String] The absolute URL of the resource
257
261
  def url
258
262
  @properties['url']
259
263
  end
@@ -27,7 +27,9 @@ module Twilio
27
27
 
28
28
  ##
29
29
  # Access the countries
30
- # @param [String] iso_country The iso_country
30
+ # @param [String] iso_country The [ISO country
31
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
32
+ # information to fetch.
31
33
  # @return [CountryList]
32
34
  # @return [CountryContext] if iso_country was passed.
33
35
  def countries(iso_country=:unset)
@@ -146,7 +146,9 @@ module Twilio
146
146
  ##
147
147
  # Initialize the CountryContext
148
148
  # @param [Version] version Version that contains the resource
149
- # @param [String] iso_country The iso_country
149
+ # @param [String] iso_country The [ISO country
150
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
151
+ # information to fetch.
150
152
  # @return [CountryContext] CountryContext
151
153
  def initialize(version, iso_country)
152
154
  super(version)
@@ -191,7 +193,9 @@ module Twilio
191
193
  # Initialize the CountryInstance
192
194
  # @param [Version] version Version that contains the resource
193
195
  # @param [Hash] payload payload that contains response from Twilio
194
- # @param [String] iso_country The iso_country
196
+ # @param [String] iso_country The [ISO country
197
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
198
+ # information to fetch.
195
199
  # @return [CountryInstance] CountryInstance
196
200
  def initialize(version, payload, iso_country: nil)
197
201
  super(version)
@@ -222,31 +226,31 @@ module Twilio
222
226
  end
223
227
 
224
228
  ##
225
- # @return [String] Name of the country
229
+ # @return [String] The name of the country
226
230
  def country
227
231
  @properties['country']
228
232
  end
229
233
 
230
234
  ##
231
- # @return [String] The ISO country code of this number
235
+ # @return [String] The ISO country code
232
236
  def iso_country
233
237
  @properties['iso_country']
234
238
  end
235
239
 
236
240
  ##
237
- # @return [String] List of PhoneNumberPrices records
241
+ # @return [String] The list of PhoneNumberPrices records
238
242
  def phone_number_prices
239
243
  @properties['phone_number_prices']
240
244
  end
241
245
 
242
246
  ##
243
- # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
247
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
244
248
  def price_unit
245
249
  @properties['price_unit']
246
250
  end
247
251
 
248
252
  ##
249
- # @return [String] The url
253
+ # @return [String] The absolute URL of the resource
250
254
  def url
251
255
  @properties['url']
252
256
  end
@@ -27,7 +27,9 @@ module Twilio
27
27
 
28
28
  ##
29
29
  # Access the countries
30
- # @param [String] iso_country The iso_country
30
+ # @param [String] iso_country The [ISO country
31
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
32
+ # information to fetch.
31
33
  # @return [CountryList]
32
34
  # @return [CountryContext] if iso_country was passed.
33
35
  def countries(iso_country=:unset)
@@ -146,7 +146,9 @@ module Twilio
146
146
  ##
147
147
  # Initialize the CountryContext
148
148
  # @param [Version] version Version that contains the resource
149
- # @param [String] iso_country The iso_country
149
+ # @param [String] iso_country The [ISO country
150
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
151
+ # information to fetch.
150
152
  # @return [CountryContext] CountryContext
151
153
  def initialize(version, iso_country)
152
154
  super(version)
@@ -191,7 +193,9 @@ module Twilio
191
193
  # Initialize the CountryInstance
192
194
  # @param [Version] version Version that contains the resource
193
195
  # @param [Hash] payload payload that contains response from Twilio
194
- # @param [String] iso_country The iso_country
196
+ # @param [String] iso_country The [ISO country
197
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
198
+ # information to fetch.
195
199
  # @return [CountryInstance] CountryInstance
196
200
  def initialize(version, payload, iso_country: nil)
197
201
  super(version)
@@ -223,7 +227,7 @@ module Twilio
223
227
  end
224
228
 
225
229
  ##
226
- # @return [String] Name of the country
230
+ # @return [String] The name of the country
227
231
  def country
228
232
  @properties['country']
229
233
  end
@@ -235,25 +239,25 @@ module Twilio
235
239
  end
236
240
 
237
241
  ##
238
- # @return [String] The outbound_prefix_prices
242
+ # @return [String] The list of OutboundPrefixPrice records
239
243
  def outbound_prefix_prices
240
244
  @properties['outbound_prefix_prices']
241
245
  end
242
246
 
243
247
  ##
244
- # @return [String] The inbound_call_prices
248
+ # @return [String] The list of InboundCallPrice records
245
249
  def inbound_call_prices
246
250
  @properties['inbound_call_prices']
247
251
  end
248
252
 
249
253
  ##
250
- # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
254
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
251
255
  def price_unit
252
256
  @properties['price_unit']
253
257
  end
254
258
 
255
259
  ##
256
- # @return [String] The url
260
+ # @return [String] The absolute URL of the resource
257
261
  def url
258
262
  @properties['url']
259
263
  end
@@ -63,7 +63,7 @@ module Twilio
63
63
  ##
64
64
  # Initialize the NumberContext
65
65
  # @param [Version] version Version that contains the resource
66
- # @param [String] number The number
66
+ # @param [String] number The phone number to fetch.
67
67
  # @return [NumberContext] NumberContext
68
68
  def initialize(version, number)
69
69
  super(version)
@@ -108,7 +108,7 @@ module Twilio
108
108
  # Initialize the NumberInstance
109
109
  # @param [Version] version Version that contains the resource
110
110
  # @param [Hash] payload payload that contains response from Twilio
111
- # @param [String] number The number
111
+ # @param [String] number The phone number to fetch.
112
112
  # @return [NumberInstance] NumberInstance
113
113
  def initialize(version, payload, number: nil)
114
114
  super(version)
@@ -141,13 +141,13 @@ module Twilio
141
141
  end
142
142
 
143
143
  ##
144
- # @return [String] The number
144
+ # @return [String] The phone number
145
145
  def number
146
146
  @properties['number']
147
147
  end
148
148
 
149
149
  ##
150
- # @return [String] Name of the country
150
+ # @return [String] The name of the country
151
151
  def country
152
152
  @properties['country']
153
153
  end
@@ -159,25 +159,25 @@ module Twilio
159
159
  end
160
160
 
161
161
  ##
162
- # @return [String] See OutboundCallPrice record
162
+ # @return [String] The OutboundCallPrice record
163
163
  def outbound_call_price
164
164
  @properties['outbound_call_price']
165
165
  end
166
166
 
167
167
  ##
168
- # @return [String] See InboundCallPrice record (returned as null if the Phone Number provided is not a Twilio number owned by this account)
168
+ # @return [String] The InboundCallPrice record
169
169
  def inbound_call_price
170
170
  @properties['inbound_call_price']
171
171
  end
172
172
 
173
173
  ##
174
- # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
174
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
175
175
  def price_unit
176
176
  @properties['price_unit']
177
177
  end
178
178
 
179
179
  ##
180
- # @return [String] The url
180
+ # @return [String] The absolute URL of the resource
181
181
  def url
182
182
  @properties['url']
183
183
  end
@@ -28,7 +28,7 @@ module Twilio
28
28
 
29
29
  ##
30
30
  # Access the numbers
31
- # @param [String] number The number
31
+ # @param [String] number The phone number to fetch.
32
32
  # @return [NumberList]
33
33
  # @return [NumberContext] if number was passed.
34
34
  def numbers(number=:unset)
@@ -43,7 +43,9 @@ module Twilio
43
43
 
44
44
  ##
45
45
  # Access the countries
46
- # @param [String] iso_country The iso_country
46
+ # @param [String] iso_country The [ISO country
47
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing
48
+ # information to fetch.
47
49
  # @return [CountryList]
48
50
  # @return [CountryContext] if iso_country was passed.
49
51
  def countries(iso_country=:unset)
@@ -146,8 +146,9 @@ module Twilio
146
146
  ##
147
147
  # Initialize the CountryContext
148
148
  # @param [Version] version Version that contains the resource
149
- # @param [String] iso_country This fetches the origin-based voice pricing
150
- # information for a specific country
149
+ # @param [String] iso_country The [ISO country
150
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the origin-based voice
151
+ # pricing information to fetch.
151
152
  # @return [CountryContext] CountryContext
152
153
  def initialize(version, iso_country)
153
154
  super(version)
@@ -192,8 +193,9 @@ module Twilio
192
193
  # Initialize the CountryInstance
193
194
  # @param [Version] version Version that contains the resource
194
195
  # @param [Hash] payload payload that contains response from Twilio
195
- # @param [String] iso_country This fetches the origin-based voice pricing
196
- # information for a specific country
196
+ # @param [String] iso_country The [ISO country
197
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the origin-based voice
198
+ # pricing information to fetch.
197
199
  # @return [CountryInstance] CountryInstance
198
200
  def initialize(version, payload, iso_country: nil)
199
201
  super(version)
@@ -225,7 +227,7 @@ module Twilio
225
227
  end
226
228
 
227
229
  ##
228
- # @return [String] Name of the country
230
+ # @return [String] The name of the country
229
231
  def country
230
232
  @properties['country']
231
233
  end
@@ -237,25 +239,25 @@ module Twilio
237
239
  end
238
240
 
239
241
  ##
240
- # @return [String] List of OutboundPrefixPriceWithOrigin records
242
+ # @return [String] The list of OutboundPrefixPriceWithOrigin records
241
243
  def outbound_prefix_prices
242
244
  @properties['outbound_prefix_prices']
243
245
  end
244
246
 
245
247
  ##
246
- # @return [String] List of InboundCallPrice records
248
+ # @return [String] The list of InboundCallPrice records
247
249
  def inbound_call_prices
248
250
  @properties['inbound_call_prices']
249
251
  end
250
252
 
251
253
  ##
252
- # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
254
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
253
255
  def price_unit
254
256
  @properties['price_unit']
255
257
  end
256
258
 
257
259
  ##
258
- # @return [String] The URL of this resource.
260
+ # @return [String] The absolute URL of the resource
259
261
  def url
260
262
  @properties['url']
261
263
  end