twilio-ruby 5.24.0 → 5.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +12 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +22 -2
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +7 -9
- data/lib/twilio-ruby/rest/preview/trusted_comms/cps.rb +186 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +4 -14
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +7 -0
- data/lib/twilio-ruby/rest/preview.rb +6 -0
- data/lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb +395 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +26 -0
- data/lib/twilio-ruby/rest/video/v1/room.rb +4 -2
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +2 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/message_spec.rb +129 -57
- data/spec/integration/autopilot/v1/assistant_spec.rb +8 -0
- data/spec/integration/preview/trusted_comms/cps_spec.rb +43 -0
- data/spec/integration/preview/trusted_comms/current_call_spec.rb +2 -2
- data/spec/integration/verify/v2/service/messaging_configuration_spec.rb +231 -0
- data/spec/integration/verify/v2/service/verification_check_spec.rb +3 -3
- data/spec/integration/verify/v2/service/verification_spec.rb +10 -10
- data/spec/integration/verify/v2/service_spec.rb +8 -4
- data/spec/integration/wireless/v1/sim/usage_record_spec.rb +51 -3
- metadata +8 -2
@@ -203,6 +203,7 @@ module Twilio
|
|
203
203
|
@verifications = nil
|
204
204
|
@verification_checks = nil
|
205
205
|
@rate_limits = nil
|
206
|
+
@messaging_configurations = nil
|
206
207
|
end
|
207
208
|
|
208
209
|
##
|
@@ -312,6 +313,24 @@ module Twilio
|
|
312
313
|
@rate_limits
|
313
314
|
end
|
314
315
|
|
316
|
+
##
|
317
|
+
# Access the messaging_configurations
|
318
|
+
# @return [MessagingConfigurationList]
|
319
|
+
# @return [MessagingConfigurationContext] if country was passed.
|
320
|
+
def messaging_configurations(country=:unset)
|
321
|
+
raise ArgumentError, 'country cannot be nil' if country.nil?
|
322
|
+
|
323
|
+
if country != :unset
|
324
|
+
return MessagingConfigurationContext.new(@version, @solution[:sid], country, )
|
325
|
+
end
|
326
|
+
|
327
|
+
unless @messaging_configurations
|
328
|
+
@messaging_configurations = MessagingConfigurationList.new(@version, service_sid: @solution[:sid], )
|
329
|
+
end
|
330
|
+
|
331
|
+
@messaging_configurations
|
332
|
+
end
|
333
|
+
|
315
334
|
##
|
316
335
|
# Provide a user friendly representation
|
317
336
|
def to_s
|
@@ -515,6 +534,13 @@ module Twilio
|
|
515
534
|
context.rate_limits
|
516
535
|
end
|
517
536
|
|
537
|
+
##
|
538
|
+
# Access the messaging_configurations
|
539
|
+
# @return [messaging_configurations] messaging_configurations
|
540
|
+
def messaging_configurations
|
541
|
+
context.messaging_configurations
|
542
|
+
end
|
543
|
+
|
518
544
|
##
|
519
545
|
# Provide a user friendly representation
|
520
546
|
def to_s
|
@@ -26,8 +26,10 @@ module Twilio
|
|
26
26
|
##
|
27
27
|
# Retrieve a single page of RoomInstance records from the API.
|
28
28
|
# Request is executed immediately.
|
29
|
-
# @param [Boolean] enable_turn
|
30
|
-
#
|
29
|
+
# @param [Boolean] enable_turn Deprecated. Enable [Twilio's Network Traversal
|
30
|
+
# TURN service](https://www.twilio.com/stun-turn). TURN service is used when
|
31
|
+
# direct peer-to-peer media connections cannot be established due to firewall
|
32
|
+
# restrictions. This setting only applies to Rooms with type `peer-to-peer`.
|
31
33
|
# @param [room.RoomType] type Type of room, either `peer-to-peer`, `group-small`
|
32
34
|
# or `group`. Will be `group` by default.
|
33
35
|
# @param [String] unique_name Name of the Room. This is unique for `in-progress`
|
@@ -232,8 +232,7 @@ module Twilio
|
|
232
232
|
# resource. Non-unique.
|
233
233
|
# @param [String] rate_plan The Sid or UniqueName of the
|
234
234
|
# [RatePlan](https://www.twilio.com/docs/api/wireless/rest-api/rate-plan) that
|
235
|
-
# this Sim should use.
|
236
|
-
# Sim has a `suspended` or `deactivated` status.
|
235
|
+
# this Sim should use.
|
237
236
|
# @param [sim.Status] status A string representing the status of the Sim. Valid
|
238
237
|
# options depend on the current state of the Sim, but may include `ready`,
|
239
238
|
# `active`, `suspended` or `deactivated`.
|
@@ -563,8 +562,7 @@ module Twilio
|
|
563
562
|
# resource. Non-unique.
|
564
563
|
# @param [String] rate_plan The Sid or UniqueName of the
|
565
564
|
# [RatePlan](https://www.twilio.com/docs/api/wireless/rest-api/rate-plan) that
|
566
|
-
# this Sim should use.
|
567
|
-
# Sim has a `suspended` or `deactivated` status.
|
565
|
+
# this Sim should use.
|
568
566
|
# @param [sim.Status] status A string representing the status of the Sim. Valid
|
569
567
|
# options depend on the current state of the Sim, but may include `ready`,
|
570
568
|
# `active`, `suspended` or `deactivated`.
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -161,6 +161,81 @@ describe 'Message' do
|
|
161
161
|
))).to eq(true)
|
162
162
|
end
|
163
163
|
|
164
|
+
it "receives read_full_page1 responses" do
|
165
|
+
@holodeck.mock(Twilio::Response.new(
|
166
|
+
200,
|
167
|
+
%q[
|
168
|
+
{
|
169
|
+
"end": 1,
|
170
|
+
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=2008-01-02&PageSize=2&Page=0",
|
171
|
+
"next_page_uri": null,
|
172
|
+
"page": 0,
|
173
|
+
"page_size": 2,
|
174
|
+
"previous_page_uri": null,
|
175
|
+
"messages": [
|
176
|
+
{
|
177
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
178
|
+
"api_version": "2010-04-01",
|
179
|
+
"body": "testing",
|
180
|
+
"date_created": "Fri, 24 May 2019 17:44:46 +0000",
|
181
|
+
"date_sent": "Fri, 24 May 2019 17:44:50 +0000",
|
182
|
+
"date_updated": "Fri, 24 May 2019 17:44:50 +0000",
|
183
|
+
"direction": "outbound-api",
|
184
|
+
"error_code": null,
|
185
|
+
"error_message": null,
|
186
|
+
"from": "+12019235161",
|
187
|
+
"messaging_service_sid": null,
|
188
|
+
"num_media": "0",
|
189
|
+
"num_segments": "1",
|
190
|
+
"price": "-0.00750",
|
191
|
+
"price_unit": "USD",
|
192
|
+
"sid": "SMded05904ccb347238880ca9264e8fe1c",
|
193
|
+
"status": "sent",
|
194
|
+
"subresource_uris": {
|
195
|
+
"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMded05904ccb347238880ca9264e8fe1c/Media.json",
|
196
|
+
"feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMded05904ccb347238880ca9264e8fe1c/Feedback.json"
|
197
|
+
},
|
198
|
+
"to": "+18182008801",
|
199
|
+
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMded05904ccb347238880ca9264e8fe1c.json"
|
200
|
+
},
|
201
|
+
{
|
202
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
203
|
+
"api_version": "2010-04-01",
|
204
|
+
"body": "look mom I have media!",
|
205
|
+
"date_created": "Fri, 24 May 2019 17:44:46 +0000",
|
206
|
+
"date_sent": "Fri, 24 May 2019 17:44:49 +0000",
|
207
|
+
"date_updated": "Fri, 24 May 2019 17:44:49 +0000",
|
208
|
+
"direction": "inbound",
|
209
|
+
"error_code": 30004,
|
210
|
+
"error_message": "Message blocked",
|
211
|
+
"from": "+12019235161",
|
212
|
+
"messaging_service_sid": null,
|
213
|
+
"num_media": "3",
|
214
|
+
"num_segments": "1",
|
215
|
+
"price": "-0.00750",
|
216
|
+
"price_unit": "USD",
|
217
|
+
"sid": "MMc26223853f8c46b4ab7dfaa6abba0a26",
|
218
|
+
"status": "received",
|
219
|
+
"subresource_uris": {
|
220
|
+
"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/MMc26223853f8c46b4ab7dfaa6abba0a26/Media.json",
|
221
|
+
"feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/MMc26223853f8c46b4ab7dfaa6abba0a26/Feedback.json"
|
222
|
+
},
|
223
|
+
"to": "+18182008801",
|
224
|
+
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/MMc26223853f8c46b4ab7dfaa6abba0a26.json"
|
225
|
+
}
|
226
|
+
],
|
227
|
+
"start": 0,
|
228
|
+
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=2008-01-02&PageSize=2&Page=0"
|
229
|
+
}
|
230
|
+
]
|
231
|
+
))
|
232
|
+
|
233
|
+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
234
|
+
.messages.list()
|
235
|
+
|
236
|
+
expect(actual).to_not eq(nil)
|
237
|
+
end
|
238
|
+
|
164
239
|
it "receives read_empty_sentdate_less responses" do
|
165
240
|
@holodeck.mock(Twilio::Response.new(
|
166
241
|
200,
|
@@ -233,71 +308,68 @@ describe 'Message' do
|
|
233
308
|
expect(actual).to_not eq(nil)
|
234
309
|
end
|
235
310
|
|
236
|
-
it "receives
|
311
|
+
it "receives read_empty_sentdate_greater_format1 responses" do
|
237
312
|
@holodeck.mock(Twilio::Response.new(
|
238
313
|
200,
|
239
314
|
%q[
|
240
315
|
{
|
241
|
-
"end":
|
242
|
-
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=
|
316
|
+
"end": 0,
|
317
|
+
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=06%2F11%2F2019+22%3A05%3A25+MST&PageSize=25&Page=0",
|
243
318
|
"next_page_uri": null,
|
244
319
|
"page": 0,
|
245
|
-
"page_size":
|
320
|
+
"page_size": 25,
|
246
321
|
"previous_page_uri": null,
|
247
|
-
"messages": [
|
248
|
-
{
|
249
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
250
|
-
"api_version": "2010-04-01",
|
251
|
-
"body": "testing",
|
252
|
-
"date_created": "Fri, 24 May 2019 17:44:46 +0000",
|
253
|
-
"date_sent": "Fri, 24 May 2019 17:44:50 +0000",
|
254
|
-
"date_updated": "Fri, 24 May 2019 17:44:50 +0000",
|
255
|
-
"direction": "outbound-api",
|
256
|
-
"error_code": null,
|
257
|
-
"error_message": null,
|
258
|
-
"from": "+12019235161",
|
259
|
-
"messaging_service_sid": null,
|
260
|
-
"num_media": "0",
|
261
|
-
"num_segments": "1",
|
262
|
-
"price": "-0.00750",
|
263
|
-
"price_unit": "USD",
|
264
|
-
"sid": "SMded05904ccb347238880ca9264e8fe1c",
|
265
|
-
"status": "sent",
|
266
|
-
"subresource_uris": {
|
267
|
-
"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMded05904ccb347238880ca9264e8fe1c/Media.json",
|
268
|
-
"feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMded05904ccb347238880ca9264e8fe1c/Feedback.json"
|
269
|
-
},
|
270
|
-
"to": "+18182008801",
|
271
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMded05904ccb347238880ca9264e8fe1c.json"
|
272
|
-
},
|
273
|
-
{
|
274
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
275
|
-
"api_version": "2010-04-01",
|
276
|
-
"body": "look mom I have media!",
|
277
|
-
"date_created": "Fri, 24 May 2019 17:44:46 +0000",
|
278
|
-
"date_sent": "Fri, 24 May 2019 17:44:49 +0000",
|
279
|
-
"date_updated": "Fri, 24 May 2019 17:44:49 +0000",
|
280
|
-
"direction": "inbound",
|
281
|
-
"error_code": 30004,
|
282
|
-
"error_message": "Message blocked",
|
283
|
-
"from": "+12019235161",
|
284
|
-
"messaging_service_sid": null,
|
285
|
-
"num_media": "3",
|
286
|
-
"num_segments": "1",
|
287
|
-
"price": "-0.00750",
|
288
|
-
"price_unit": "USD",
|
289
|
-
"sid": "MMc26223853f8c46b4ab7dfaa6abba0a26",
|
290
|
-
"status": "received",
|
291
|
-
"subresource_uris": {
|
292
|
-
"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/MMc26223853f8c46b4ab7dfaa6abba0a26/Media.json",
|
293
|
-
"feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/MMc26223853f8c46b4ab7dfaa6abba0a26/Feedback.json"
|
294
|
-
},
|
295
|
-
"to": "+18182008801",
|
296
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/MMc26223853f8c46b4ab7dfaa6abba0a26.json"
|
297
|
-
}
|
298
|
-
],
|
322
|
+
"messages": [],
|
299
323
|
"start": 0,
|
300
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=
|
324
|
+
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=06%2F11%2F2019+22%3A05%3A25+MST&PageSize=25&Page=0"
|
325
|
+
}
|
326
|
+
]
|
327
|
+
))
|
328
|
+
|
329
|
+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
330
|
+
.messages.list()
|
331
|
+
|
332
|
+
expect(actual).to_not eq(nil)
|
333
|
+
end
|
334
|
+
|
335
|
+
it "receives read_empty_sentdate_greater_format2 responses" do
|
336
|
+
@holodeck.mock(Twilio::Response.new(
|
337
|
+
200,
|
338
|
+
%q[
|
339
|
+
{
|
340
|
+
"end": 0,
|
341
|
+
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=2019-06-11+22%3A05%3A25.000&PageSize=25&Page=0",
|
342
|
+
"next_page_uri": null,
|
343
|
+
"page": 0,
|
344
|
+
"page_size": 25,
|
345
|
+
"previous_page_uri": null,
|
346
|
+
"messages": [],
|
347
|
+
"start": 0,
|
348
|
+
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=2019-06-11+22%3A05%3A25.000&PageSize=25&Page=0"
|
349
|
+
}
|
350
|
+
]
|
351
|
+
))
|
352
|
+
|
353
|
+
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
354
|
+
.messages.list()
|
355
|
+
|
356
|
+
expect(actual).to_not eq(nil)
|
357
|
+
end
|
358
|
+
|
359
|
+
it "receives read_empty_sentdate_greater_format3 responses" do
|
360
|
+
@holodeck.mock(Twilio::Response.new(
|
361
|
+
200,
|
362
|
+
%q[
|
363
|
+
{
|
364
|
+
"end": 0,
|
365
|
+
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=Wed%2C+19+Jun+2019+22%3A04%3A00+-0000&PageSize=25&Page=0",
|
366
|
+
"next_page_uri": null,
|
367
|
+
"page": 0,
|
368
|
+
"page_size": 25,
|
369
|
+
"previous_page_uri": null,
|
370
|
+
"messages": [],
|
371
|
+
"start": 0,
|
372
|
+
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json?To=%2B123456789&From=%2B987654321&DateSent%3E=Wed%2C+19+Jun+2019+22%3A04%3A00+-0000&PageSize=25&Page=0"
|
301
373
|
}
|
302
374
|
]
|
303
375
|
))
|
@@ -35,6 +35,8 @@ describe 'Assistant' do
|
|
35
35
|
"friendly_name": "so so friendly",
|
36
36
|
"latest_model_build_sid": null,
|
37
37
|
"log_queries": true,
|
38
|
+
"development_stage": "in-development",
|
39
|
+
"needs_model_build": false,
|
38
40
|
"sid": "UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
39
41
|
"unique_name": "so-so-unique",
|
40
42
|
"links": {
|
@@ -111,6 +113,8 @@ describe 'Assistant' do
|
|
111
113
|
"friendly_name": "so so friendly",
|
112
114
|
"latest_model_build_sid": null,
|
113
115
|
"log_queries": true,
|
116
|
+
"development_stage": "in-development",
|
117
|
+
"needs_model_build": false,
|
114
118
|
"sid": "UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
115
119
|
"unique_name": "so-so-unique",
|
116
120
|
"links": {
|
@@ -172,6 +176,8 @@ describe 'Assistant' do
|
|
172
176
|
"friendly_name": "so so friendly",
|
173
177
|
"latest_model_build_sid": null,
|
174
178
|
"log_queries": true,
|
179
|
+
"development_stage": "in-development",
|
180
|
+
"needs_model_build": false,
|
175
181
|
"sid": "UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
176
182
|
"unique_name": "so-so-unique",
|
177
183
|
"links": {
|
@@ -222,6 +228,8 @@ describe 'Assistant' do
|
|
222
228
|
"friendly_name": "so so friendly",
|
223
229
|
"latest_model_build_sid": null,
|
224
230
|
"log_queries": true,
|
231
|
+
"development_stage": "in-development",
|
232
|
+
"needs_model_build": false,
|
225
233
|
"sid": "UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
226
234
|
"unique_name": "so-so-unique",
|
227
235
|
"links": {
|
@@ -0,0 +1,43 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
require 'spec_helper.rb'
|
10
|
+
|
11
|
+
describe 'Cps' do
|
12
|
+
it "can fetch" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.preview.trusted_comms.cps().fetch()
|
17
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
18
|
+
|
19
|
+
values = {}
|
20
|
+
expect(
|
21
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
22
|
+
method: 'get',
|
23
|
+
url: 'https://preview.twilio.com/TrustedComms/CPS',
|
24
|
+
))).to eq(true)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "receives fetch responses" do
|
28
|
+
@holodeck.mock(Twilio::Response.new(
|
29
|
+
200,
|
30
|
+
%q[
|
31
|
+
{
|
32
|
+
"phone_number": "+1500123",
|
33
|
+
"cps_url": "https://preview.twilio.com/TrustedComms/CurrentCall",
|
34
|
+
"url": "https://preview.twilio.com/TrustedComms/CPS"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
))
|
38
|
+
|
39
|
+
actual = @client.preview.trusted_comms.cps().fetch()
|
40
|
+
|
41
|
+
expect(actual).to_not eq(nil)
|
42
|
+
end
|
43
|
+
end
|
@@ -30,8 +30,8 @@ describe 'CurrentCall' do
|
|
30
30
|
%q[
|
31
31
|
{
|
32
32
|
"sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
33
|
-
"from": "+
|
34
|
-
"to": "+
|
33
|
+
"from": "+1500123",
|
34
|
+
"to": "+1500456",
|
35
35
|
"status": "ringing",
|
36
36
|
"reason": "Hello Jhon, your bank appointment has been confirmed.",
|
37
37
|
"created_at": "2019-05-01T20:00:00Z",
|
@@ -0,0 +1,231 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
require 'spec_helper.rb'
|
10
|
+
|
11
|
+
describe 'MessagingConfiguration' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.messaging_configurations.create(country: 'country', messaging_service_sid: 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {'Country' => 'country', 'MessagingServiceSid' => 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', }
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations',
|
25
|
+
data: values,
|
26
|
+
))).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "receives create responses" do
|
30
|
+
@holodeck.mock(Twilio::Response.new(
|
31
|
+
201,
|
32
|
+
%q[
|
33
|
+
{
|
34
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"country": "CA",
|
37
|
+
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"date_created": "2015-07-30T20:00:00Z",
|
39
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
40
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations/CA"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
))
|
44
|
+
|
45
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
46
|
+
.messaging_configurations.create(country: 'country', messaging_service_sid: 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
|
47
|
+
|
48
|
+
expect(actual).to_not eq(nil)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "can update" do
|
52
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
53
|
+
|
54
|
+
expect {
|
55
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
56
|
+
.messaging_configurations('country').update(messaging_service_sid: 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
|
57
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
58
|
+
|
59
|
+
values = {'MessagingServiceSid' => 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', }
|
60
|
+
expect(
|
61
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
62
|
+
method: 'post',
|
63
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations/country',
|
64
|
+
data: values,
|
65
|
+
))).to eq(true)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "receives update responses" do
|
69
|
+
@holodeck.mock(Twilio::Response.new(
|
70
|
+
200,
|
71
|
+
%q[
|
72
|
+
{
|
73
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
74
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
75
|
+
"country": "CA",
|
76
|
+
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
77
|
+
"date_created": "2015-07-30T20:00:00Z",
|
78
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
79
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations/CA"
|
80
|
+
}
|
81
|
+
]
|
82
|
+
))
|
83
|
+
|
84
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
85
|
+
.messaging_configurations('country').update(messaging_service_sid: 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
|
86
|
+
|
87
|
+
expect(actual).to_not eq(nil)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "can fetch" do
|
91
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
92
|
+
|
93
|
+
expect {
|
94
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
95
|
+
.messaging_configurations('country').fetch()
|
96
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
97
|
+
|
98
|
+
values = {}
|
99
|
+
expect(
|
100
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
101
|
+
method: 'get',
|
102
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations/country',
|
103
|
+
))).to eq(true)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "receives fetch responses" do
|
107
|
+
@holodeck.mock(Twilio::Response.new(
|
108
|
+
200,
|
109
|
+
%q[
|
110
|
+
{
|
111
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
112
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
113
|
+
"country": "CA",
|
114
|
+
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
115
|
+
"date_created": "2015-07-30T20:00:00Z",
|
116
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
117
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations/CA"
|
118
|
+
}
|
119
|
+
]
|
120
|
+
))
|
121
|
+
|
122
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
123
|
+
.messaging_configurations('country').fetch()
|
124
|
+
|
125
|
+
expect(actual).to_not eq(nil)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "can read" do
|
129
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
130
|
+
|
131
|
+
expect {
|
132
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
133
|
+
.messaging_configurations.list()
|
134
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
135
|
+
|
136
|
+
values = {}
|
137
|
+
expect(
|
138
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
139
|
+
method: 'get',
|
140
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations',
|
141
|
+
))).to eq(true)
|
142
|
+
end
|
143
|
+
|
144
|
+
it "receives read_empty responses" do
|
145
|
+
@holodeck.mock(Twilio::Response.new(
|
146
|
+
200,
|
147
|
+
%q[
|
148
|
+
{
|
149
|
+
"messaging_configurations": [],
|
150
|
+
"meta": {
|
151
|
+
"page": 0,
|
152
|
+
"page_size": 50,
|
153
|
+
"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations?PageSize=50&Page=0",
|
154
|
+
"previous_page_url": null,
|
155
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations?PageSize=50&Page=0",
|
156
|
+
"next_page_url": null,
|
157
|
+
"key": "messaging_configurations"
|
158
|
+
}
|
159
|
+
}
|
160
|
+
]
|
161
|
+
))
|
162
|
+
|
163
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
164
|
+
.messaging_configurations.list()
|
165
|
+
|
166
|
+
expect(actual).to_not eq(nil)
|
167
|
+
end
|
168
|
+
|
169
|
+
it "receives read_full responses" do
|
170
|
+
@holodeck.mock(Twilio::Response.new(
|
171
|
+
200,
|
172
|
+
%q[
|
173
|
+
{
|
174
|
+
"messaging_configurations": [
|
175
|
+
{
|
176
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
177
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
178
|
+
"country": "CA",
|
179
|
+
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
180
|
+
"date_created": "2015-07-30T20:00:00Z",
|
181
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
182
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations/CA"
|
183
|
+
}
|
184
|
+
],
|
185
|
+
"meta": {
|
186
|
+
"page": 0,
|
187
|
+
"page_size": 50,
|
188
|
+
"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations?PageSize=50&Page=0",
|
189
|
+
"previous_page_url": null,
|
190
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations?PageSize=50&Page=0",
|
191
|
+
"next_page_url": null,
|
192
|
+
"key": "messaging_configurations"
|
193
|
+
}
|
194
|
+
}
|
195
|
+
]
|
196
|
+
))
|
197
|
+
|
198
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
199
|
+
.messaging_configurations.list()
|
200
|
+
|
201
|
+
expect(actual).to_not eq(nil)
|
202
|
+
end
|
203
|
+
|
204
|
+
it "can delete" do
|
205
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
206
|
+
|
207
|
+
expect {
|
208
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
209
|
+
.messaging_configurations('country').delete()
|
210
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
211
|
+
|
212
|
+
values = {}
|
213
|
+
expect(
|
214
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
215
|
+
method: 'delete',
|
216
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations/country',
|
217
|
+
))).to eq(true)
|
218
|
+
end
|
219
|
+
|
220
|
+
it "receives delete responses" do
|
221
|
+
@holodeck.mock(Twilio::Response.new(
|
222
|
+
204,
|
223
|
+
nil,
|
224
|
+
))
|
225
|
+
|
226
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
227
|
+
.messaging_configurations('country').delete()
|
228
|
+
|
229
|
+
expect(actual).to eq(true)
|
230
|
+
end
|
231
|
+
end
|