twilio-ruby 5.33.0 → 5.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/.rubocop_todo.yml +5 -26
  4. data/.travis.yml +9 -1
  5. data/CHANGES.md +110 -0
  6. data/README.md +17 -2
  7. data/lib/twilio-ruby.rb +4 -12
  8. data/lib/twilio-ruby/framework/error.rb +3 -3
  9. data/lib/twilio-ruby/jwt/jwt.rb +6 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +90 -90
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
  12. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +75 -72
  13. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +29 -29
  14. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +38 -3
  15. data/lib/twilio-ruby/rest/autopilot.rb +6 -0
  16. data/lib/twilio-ruby/rest/autopilot/v1.rb +7 -0
  17. data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
  18. data/lib/twilio-ruby/rest/client.rb +35 -8
  19. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +19 -3
  20. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +27 -4
  21. data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +2 -1
  22. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
  23. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +20 -11
  24. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +26 -0
  25. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +324 -0
  26. data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +26 -0
  27. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand.rb +239 -0
  28. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +266 -0
  29. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +197 -0
  30. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
  31. data/lib/twilio-ruby/rest/studio.rb +2 -2
  32. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +26 -0
  33. data/lib/twilio-ruby/rest/studio/v2.rb +3 -3
  34. data/lib/twilio-ruby/rest/studio/v2/flow.rb +7 -0
  35. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +71 -24
  36. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +12 -11
  37. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +21 -20
  38. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +18 -15
  39. data/lib/twilio-ruby/rest/supersim.rb +18 -0
  40. data/lib/twilio-ruby/rest/supersim/v1.rb +30 -0
  41. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +53 -10
  42. data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
  43. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +378 -0
  44. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +352 -0
  45. data/lib/twilio-ruby/rest/verify.rb +9 -0
  46. data/lib/twilio-ruby/rest/verify/v2.rb +16 -0
  47. data/lib/twilio-ruby/rest/verify/v2/form.rb +197 -0
  48. data/lib/twilio-ruby/rest/verify/v2/service.rb +48 -3
  49. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +379 -0
  50. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +500 -0
  51. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor/challenge.rb +494 -0
  52. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
  53. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -12
  54. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -12
  55. data/lib/twilio-ruby/rest/voice.rb +36 -0
  56. data/lib/twilio-ruby/rest/voice/v1.rb +64 -0
  57. data/lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb +513 -0
  58. data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +379 -0
  59. data/lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb +458 -0
  60. data/lib/twilio-ruby/rest/voice/v1/ip_record.rb +366 -0
  61. data/lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb +346 -0
  62. data/lib/twilio-ruby/twiml/twiml.rb +4 -0
  63. data/lib/twilio-ruby/twiml/voice_response.rb +3 -2
  64. data/lib/twilio-ruby/util/configuration.rb +9 -1
  65. data/lib/twilio-ruby/version.rb +1 -1
  66. data/spec/integration/api/v2010/account/call_spec.rb +5 -5
  67. data/spec/integration/api/v2010/account/conference_spec.rb +42 -14
  68. data/spec/integration/api/v2010/account/sip/domain_spec.rb +12 -4
  69. data/spec/integration/api/v2010/account/token_spec.rb +23 -11
  70. data/spec/integration/autopilot/v1/restore_assistant_spec.rb +53 -0
  71. data/spec/integration/bulkexports/v1/export/day_spec.rb +1 -1
  72. data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
  73. data/spec/integration/conversations/v1/conversation_spec.rb +4 -0
  74. data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
  75. data/spec/integration/numbers/v2/regulatory_compliance/bundle/evaluation_spec.rb +623 -0
  76. data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +4 -0
  77. data/spec/integration/preview/bulk_exports/export/day_spec.rb +1 -1
  78. data/spec/integration/preview/trusted_comms/business/brand/branded_channel/channel_spec.rb +54 -0
  79. data/spec/integration/preview/trusted_comms/business/brand/branded_channel_spec.rb +52 -0
  80. data/spec/integration/preview/trusted_comms/business/brand_spec.rb +49 -0
  81. data/spec/integration/preview/trusted_comms/business_spec.rb +1 -0
  82. data/spec/integration/serverless/v1/service/asset/asset_version_spec.rb +1 -1
  83. data/spec/integration/serverless/v1/service/build_spec.rb +4 -4
  84. data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
  85. data/spec/integration/serverless/v1/service/function/function_version_spec.rb +1 -1
  86. data/spec/integration/studio/v1/flow/execution_spec.rb +46 -0
  87. data/spec/integration/studio/v2/flow/execution_spec.rb +45 -0
  88. data/spec/integration/studio/v2/flow_spec.rb +4 -0
  89. data/spec/integration/studio/v2/flow_validate_spec.rb +2 -2
  90. data/spec/integration/supersim/v1/fleet_spec.rb +12 -4
  91. data/spec/integration/supersim/v1/network_access_profile/network_access_profile_network_spec.rb +179 -0
  92. data/spec/integration/supersim/v1/network_access_profile_spec.rb +223 -0
  93. data/spec/integration/supersim/v1/network_spec.rb +139 -0
  94. data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +13 -13
  95. data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +23 -23
  96. data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +28 -28
  97. data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +17 -17
  98. data/spec/integration/trunking/v1/trunk_spec.rb +33 -33
  99. data/spec/integration/verify/v2/form_spec.rb +48 -0
  100. data/spec/integration/verify/v2/service/entity/factor/challenge_spec.rb +353 -0
  101. data/spec/integration/verify/v2/service/entity/factor_spec.rb +298 -0
  102. data/spec/integration/verify/v2/service/entity_spec.rb +201 -0
  103. data/spec/integration/verify/v2/service_spec.rb +28 -4
  104. data/spec/integration/video/v1/composition_settings_spec.rb +2 -2
  105. data/spec/integration/video/v1/recording_settings_spec.rb +2 -2
  106. data/spec/integration/video/v1/recording_spec.rb +2 -2
  107. data/spec/integration/video/v1/room/recording_spec.rb +2 -2
  108. data/spec/integration/voice/v1/byoc_trunk_spec.rb +250 -0
  109. data/spec/integration/voice/v1/connection_policy/connection_policy_target_spec.rb +246 -0
  110. data/spec/integration/voice/v1/connection_policy_spec.rb +226 -0
  111. data/spec/integration/voice/v1/ip_record_spec.rb +223 -0
  112. data/spec/integration/voice/v1/source_ip_mapping_spec.rb +219 -0
  113. data/spec/rest/client_spec.rb +173 -23
  114. data/spec/util/configuration_spec.rb +12 -0
  115. data/twilio-ruby.gemspec +4 -4
  116. metadata +67 -10
@@ -41,6 +41,11 @@ describe 'Service' do
41
41
  "tts_name": "name",
42
42
  "mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
43
43
  "do_not_share_warning_enabled": false,
44
+ "custom_code_enabled": true,
45
+ "push": {
46
+ "include_date": true,
47
+ "notify_service_sid": null
48
+ },
44
49
  "date_created": "2015-07-30T20:00:00Z",
45
50
  "date_updated": "2015-07-30T20:00:00Z",
46
51
  "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -48,7 +53,8 @@ describe 'Service' do
48
53
  "verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
49
54
  "verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
50
55
  "rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
51
- "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations"
56
+ "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
57
+ "entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities"
52
58
  }
53
59
  }
54
60
  ]
@@ -90,6 +96,11 @@ describe 'Service' do
90
96
  "tts_name": "name",
91
97
  "mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
92
98
  "do_not_share_warning_enabled": false,
99
+ "custom_code_enabled": true,
100
+ "push": {
101
+ "include_date": true,
102
+ "notify_service_sid": null
103
+ },
93
104
  "date_created": "2015-07-30T20:00:00Z",
94
105
  "date_updated": "2015-07-30T20:00:00Z",
95
106
  "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -97,7 +108,8 @@ describe 'Service' do
97
108
  "verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
98
109
  "verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
99
110
  "rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
100
- "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations"
111
+ "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
112
+ "entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities"
101
113
  }
102
114
  }
103
115
  ]
@@ -176,6 +188,11 @@ describe 'Service' do
176
188
  "tts_name": "name",
177
189
  "mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
178
190
  "do_not_share_warning_enabled": false,
191
+ "custom_code_enabled": true,
192
+ "push": {
193
+ "include_date": true,
194
+ "notify_service_sid": null
195
+ },
179
196
  "date_created": "2015-07-30T20:00:00Z",
180
197
  "date_updated": "2015-07-30T20:00:00Z",
181
198
  "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -183,7 +200,8 @@ describe 'Service' do
183
200
  "verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
184
201
  "verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
185
202
  "rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
186
- "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations"
203
+ "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
204
+ "entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities"
187
205
  }
188
206
  }
189
207
  ]
@@ -227,6 +245,11 @@ describe 'Service' do
227
245
  "tts_name": "name",
228
246
  "mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
229
247
  "do_not_share_warning_enabled": false,
248
+ "custom_code_enabled": true,
249
+ "push": {
250
+ "include_date": true,
251
+ "notify_service_sid": null
252
+ },
230
253
  "date_created": "2015-07-30T20:00:00Z",
231
254
  "date_updated": "2015-07-30T20:00:00Z",
232
255
  "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -234,7 +257,8 @@ describe 'Service' do
234
257
  "verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
235
258
  "verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
236
259
  "rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
237
- "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations"
260
+ "messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
261
+ "entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities"
238
262
  }
239
263
  }
240
264
  ]
@@ -33,7 +33,7 @@ describe 'CompositionSettings' do
33
33
  "friendly_name": "string",
34
34
  "aws_credentials_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
35
  "encryption_key_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
- "aws_s3_url": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
36
+ "aws_s3_url": "https://www.twilio.com",
37
37
  "aws_storage_enabled": true,
38
38
  "encryption_enabled": true,
39
39
  "url": "https://video.twilio.com/v1/CompositionSettings/Default"
@@ -71,7 +71,7 @@ describe 'CompositionSettings' do
71
71
  "friendly_name": "friendly_name",
72
72
  "aws_credentials_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
73
73
  "encryption_key_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
74
- "aws_s3_url": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
74
+ "aws_s3_url": "https://www.twilio.com",
75
75
  "aws_storage_enabled": true,
76
76
  "encryption_enabled": true,
77
77
  "url": "https://video.twilio.com/v1/CompositionSettings/Default"
@@ -33,7 +33,7 @@ describe 'RecordingSettings' do
33
33
  "friendly_name": "string",
34
34
  "aws_credentials_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
35
  "encryption_key_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
- "aws_s3_url": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
36
+ "aws_s3_url": "https://www.twilio.com",
37
37
  "aws_storage_enabled": true,
38
38
  "encryption_enabled": true,
39
39
  "url": "https://video.twilio.com/v1/RecordingSettings/Default"
@@ -71,7 +71,7 @@ describe 'RecordingSettings' do
71
71
  "friendly_name": "friendly_name",
72
72
  "aws_credentials_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
73
73
  "encryption_key_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
74
- "aws_s3_url": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
74
+ "aws_s3_url": "https://www.twilio.com",
75
75
  "aws_storage_enabled": true,
76
76
  "encryption_enabled": true,
77
77
  "url": "https://video.twilio.com/v1/RecordingSettings/Default"
@@ -47,7 +47,7 @@ describe 'Recording' do
47
47
  "grouping_sids": {
48
48
  "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
49
49
  },
50
- "media_external_location": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
50
+ "media_external_location": "https://www.twilio.com",
51
51
  "encryption_key": "public_key",
52
52
  "links": {
53
53
  "media": "https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
@@ -125,7 +125,7 @@ describe 'Recording' do
125
125
  "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
126
126
  "participant_sid": "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
127
127
  },
128
- "media_external_location": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
128
+ "media_external_location": "https://www.twilio.com",
129
129
  "encryption_key": "public_key",
130
130
  "url": "https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
131
131
  "links": {
@@ -47,7 +47,7 @@ describe 'RoomRecording' do
47
47
  "grouping_sids": {
48
48
  "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
49
49
  },
50
- "media_external_location": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
50
+ "media_external_location": "https://www.twilio.com",
51
51
  "encryption_key": "public_key",
52
52
  "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
53
53
  "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -130,7 +130,7 @@ describe 'RoomRecording' do
130
130
  "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
131
131
  "participant_sid": "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
132
132
  },
133
- "media_external_location": "https://my-super-duper-bucket.s3.amazonaws.com/my/path/",
133
+ "media_external_location": "https://www.twilio.com",
134
134
  "encryption_key": "public_key",
135
135
  "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
136
136
  "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -0,0 +1,250 @@
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 'ByocTrunk' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.voice.v1.byoc_trunks.create()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'post',
23
+ url: 'https://voice.twilio.com/v1/ByocTrunks',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives create responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 201,
30
+ %q[
31
+ {
32
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "friendly_name": "friendly_name",
35
+ "voice_url": "https://byoc.example.com/twilio/app",
36
+ "voice_method": "POST",
37
+ "voice_fallback_method": "POST",
38
+ "voice_fallback_url": "https://byoc.example.com/twilio/fallback",
39
+ "status_callback_method": "POST",
40
+ "status_callback_url": "https://byoc.example.com/twilio/status_callback",
41
+ "cnam_lookup_enabled": false,
42
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
43
+ "from_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
44
+ "date_created": "2020-03-18T23:31:36Z",
45
+ "date_updated": "2020-03-18T23:31:36Z",
46
+ "url": "https://voice.twilio.com/v1/ByocTrunks/BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
47
+ }
48
+ ]
49
+ ))
50
+
51
+ actual = @client.voice.v1.byoc_trunks.create()
52
+
53
+ expect(actual).to_not eq(nil)
54
+ end
55
+
56
+ it "can fetch" do
57
+ @holodeck.mock(Twilio::Response.new(500, ''))
58
+
59
+ expect {
60
+ @client.voice.v1.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
61
+ }.to raise_exception(Twilio::REST::TwilioError)
62
+
63
+ values = {}
64
+ expect(
65
+ @holodeck.has_request?(Holodeck::Request.new(
66
+ method: 'get',
67
+ url: 'https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
68
+ ))).to eq(true)
69
+ end
70
+
71
+ it "receives fetch responses" do
72
+ @holodeck.mock(Twilio::Response.new(
73
+ 200,
74
+ %q[
75
+ {
76
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
77
+ "sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78
+ "friendly_name": "friendly_name",
79
+ "voice_url": "https://byoc.example.com/twilio/app",
80
+ "voice_method": "POST",
81
+ "voice_fallback_method": "POST",
82
+ "voice_fallback_url": "https://byoc.example.com/twilio/fallback",
83
+ "status_callback_method": "POST",
84
+ "status_callback_url": "https://byoc.example.com/twilio/status_callback",
85
+ "cnam_lookup_enabled": false,
86
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
87
+ "from_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
88
+ "date_created": "2020-03-18T23:31:36Z",
89
+ "date_updated": "2020-03-18T23:31:37Z",
90
+ "url": "https://voice.twilio.com/v1/ByocTrunks/BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
91
+ }
92
+ ]
93
+ ))
94
+
95
+ actual = @client.voice.v1.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
96
+
97
+ expect(actual).to_not eq(nil)
98
+ end
99
+
100
+ it "can read" do
101
+ @holodeck.mock(Twilio::Response.new(500, ''))
102
+
103
+ expect {
104
+ @client.voice.v1.byoc_trunks.list()
105
+ }.to raise_exception(Twilio::REST::TwilioError)
106
+
107
+ values = {}
108
+ expect(
109
+ @holodeck.has_request?(Holodeck::Request.new(
110
+ method: 'get',
111
+ url: 'https://voice.twilio.com/v1/ByocTrunks',
112
+ ))).to eq(true)
113
+ end
114
+
115
+ it "receives read_full responses" do
116
+ @holodeck.mock(Twilio::Response.new(
117
+ 200,
118
+ %q[
119
+ {
120
+ "meta": {
121
+ "page": 0,
122
+ "page_size": 50,
123
+ "first_page_url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
124
+ "previous_page_url": null,
125
+ "url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
126
+ "next_page_url": null,
127
+ "key": "byoc_trunks"
128
+ },
129
+ "byoc_trunks": [
130
+ {
131
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
132
+ "sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
133
+ "friendly_name": "friendly_name",
134
+ "voice_url": "https://byoc.example.com/twilio/app",
135
+ "voice_method": "POST",
136
+ "voice_fallback_method": "POST",
137
+ "voice_fallback_url": "https://byoc.example.com/twilio/fallback",
138
+ "status_callback_method": "POST",
139
+ "status_callback_url": "https://byoc.example.com/twilio/status_callback",
140
+ "cnam_lookup_enabled": false,
141
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
142
+ "from_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
143
+ "date_created": "2020-03-18T23:31:36Z",
144
+ "date_updated": "2020-03-18T23:31:37Z",
145
+ "url": "https://voice.twilio.com/v1/ByocTrunks/BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
146
+ }
147
+ ]
148
+ }
149
+ ]
150
+ ))
151
+
152
+ actual = @client.voice.v1.byoc_trunks.list()
153
+
154
+ expect(actual).to_not eq(nil)
155
+ end
156
+
157
+ it "receives read_empty responses" do
158
+ @holodeck.mock(Twilio::Response.new(
159
+ 200,
160
+ %q[
161
+ {
162
+ "meta": {
163
+ "page": 0,
164
+ "page_size": 50,
165
+ "first_page_url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
166
+ "previous_page_url": null,
167
+ "url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
168
+ "next_page_url": null,
169
+ "key": "byoc_trunks"
170
+ },
171
+ "byoc_trunks": []
172
+ }
173
+ ]
174
+ ))
175
+
176
+ actual = @client.voice.v1.byoc_trunks.list()
177
+
178
+ expect(actual).to_not eq(nil)
179
+ end
180
+
181
+ it "can update" do
182
+ @holodeck.mock(Twilio::Response.new(500, ''))
183
+
184
+ expect {
185
+ @client.voice.v1.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
186
+ }.to raise_exception(Twilio::REST::TwilioError)
187
+
188
+ values = {}
189
+ expect(
190
+ @holodeck.has_request?(Holodeck::Request.new(
191
+ method: 'post',
192
+ url: 'https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
193
+ ))).to eq(true)
194
+ end
195
+
196
+ it "receives update responses" do
197
+ @holodeck.mock(Twilio::Response.new(
198
+ 200,
199
+ %q[
200
+ {
201
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
202
+ "sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
203
+ "friendly_name": "update_name",
204
+ "voice_url": "https://byoc.example.com/twilio_updated/app",
205
+ "voice_method": "GET",
206
+ "voice_fallback_method": "GET",
207
+ "voice_fallback_url": "https://byoc.example.com/twilio_updated/fallback",
208
+ "status_callback_method": "GET",
209
+ "status_callback_url": "https://byoc.example.com/twilio_updated/status_callback",
210
+ "cnam_lookup_enabled": true,
211
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
212
+ "from_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
213
+ "date_created": "2020-03-18T23:31:36Z",
214
+ "date_updated": "2020-03-18T23:31:37Z",
215
+ "url": "https://voice.twilio.com/v1/ByocTrunks/BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
216
+ }
217
+ ]
218
+ ))
219
+
220
+ actual = @client.voice.v1.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
221
+
222
+ expect(actual).to_not eq(nil)
223
+ end
224
+
225
+ it "can delete" do
226
+ @holodeck.mock(Twilio::Response.new(500, ''))
227
+
228
+ expect {
229
+ @client.voice.v1.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
230
+ }.to raise_exception(Twilio::REST::TwilioError)
231
+
232
+ values = {}
233
+ expect(
234
+ @holodeck.has_request?(Holodeck::Request.new(
235
+ method: 'delete',
236
+ url: 'https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
237
+ ))).to eq(true)
238
+ end
239
+
240
+ it "receives delete responses" do
241
+ @holodeck.mock(Twilio::Response.new(
242
+ 204,
243
+ nil,
244
+ ))
245
+
246
+ actual = @client.voice.v1.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
247
+
248
+ expect(actual).to eq(true)
249
+ end
250
+ end
@@ -0,0 +1,246 @@
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 'ConnectionPolicyTarget' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .targets.create(target: 'https://example.com')
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ values = {'Target' => 'https://example.com', }
21
+ expect(
22
+ @holodeck.has_request?(Holodeck::Request.new(
23
+ method: 'post',
24
+ url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets',
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
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "friendly_name": "friendly_name",
38
+ "target": "sip:sip-box.com:1234",
39
+ "priority": 1,
40
+ "weight": 20,
41
+ "enabled": true,
42
+ "date_created": "2020-03-18T23:31:36Z",
43
+ "date_updated": "2020-03-18T23:31:36Z",
44
+ "url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
45
+ }
46
+ ]
47
+ ))
48
+
49
+ actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
50
+ .targets.create(target: 'https://example.com')
51
+
52
+ expect(actual).to_not eq(nil)
53
+ end
54
+
55
+ it "can fetch" do
56
+ @holodeck.mock(Twilio::Response.new(500, ''))
57
+
58
+ expect {
59
+ @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
60
+ .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
61
+ }.to raise_exception(Twilio::REST::TwilioError)
62
+
63
+ values = {}
64
+ expect(
65
+ @holodeck.has_request?(Holodeck::Request.new(
66
+ method: 'get',
67
+ url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
68
+ ))).to eq(true)
69
+ end
70
+
71
+ it "receives fetch responses" do
72
+ @holodeck.mock(Twilio::Response.new(
73
+ 200,
74
+ %q[
75
+ {
76
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
77
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78
+ "sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
+ "friendly_name": "friendly_name",
80
+ "target": "sip:sip-box.com:1234",
81
+ "priority": 1,
82
+ "weight": 20,
83
+ "enabled": true,
84
+ "date_created": "2020-03-18T23:31:36Z",
85
+ "date_updated": "2020-03-18T23:31:37Z",
86
+ "url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
87
+ }
88
+ ]
89
+ ))
90
+
91
+ actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
92
+ .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
93
+
94
+ expect(actual).to_not eq(nil)
95
+ end
96
+
97
+ it "can read" do
98
+ @holodeck.mock(Twilio::Response.new(500, ''))
99
+
100
+ expect {
101
+ @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
102
+ .targets.list()
103
+ }.to raise_exception(Twilio::REST::TwilioError)
104
+
105
+ values = {}
106
+ expect(
107
+ @holodeck.has_request?(Holodeck::Request.new(
108
+ method: 'get',
109
+ url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets',
110
+ ))).to eq(true)
111
+ end
112
+
113
+ it "receives read_full responses" do
114
+ @holodeck.mock(Twilio::Response.new(
115
+ 200,
116
+ %q[
117
+ {
118
+ "meta": {
119
+ "page": 0,
120
+ "page_size": 50,
121
+ "first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
122
+ "previous_page_url": null,
123
+ "url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
124
+ "next_page_url": null,
125
+ "key": "targets"
126
+ },
127
+ "targets": [
128
+ {
129
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
130
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
131
+ "sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
132
+ "friendly_name": "friendly_name",
133
+ "target": "sip:sip-box.com:1234",
134
+ "priority": 1,
135
+ "weight": 20,
136
+ "enabled": true,
137
+ "date_created": "2020-03-18T23:31:36Z",
138
+ "date_updated": "2020-03-18T23:31:37Z",
139
+ "url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
140
+ }
141
+ ]
142
+ }
143
+ ]
144
+ ))
145
+
146
+ actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
147
+ .targets.list()
148
+
149
+ expect(actual).to_not eq(nil)
150
+ end
151
+
152
+ it "receives read_empty responses" do
153
+ @holodeck.mock(Twilio::Response.new(
154
+ 200,
155
+ %q[
156
+ {
157
+ "meta": {
158
+ "page": 0,
159
+ "page_size": 50,
160
+ "first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
161
+ "previous_page_url": null,
162
+ "url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
163
+ "next_page_url": null,
164
+ "key": "targets"
165
+ },
166
+ "targets": []
167
+ }
168
+ ]
169
+ ))
170
+
171
+ actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
172
+ .targets.list()
173
+
174
+ expect(actual).to_not eq(nil)
175
+ end
176
+
177
+ it "can update" do
178
+ @holodeck.mock(Twilio::Response.new(500, ''))
179
+
180
+ expect {
181
+ @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
182
+ .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
183
+ }.to raise_exception(Twilio::REST::TwilioError)
184
+
185
+ values = {}
186
+ expect(
187
+ @holodeck.has_request?(Holodeck::Request.new(
188
+ method: 'post',
189
+ url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
190
+ ))).to eq(true)
191
+ end
192
+
193
+ it "receives update responses" do
194
+ @holodeck.mock(Twilio::Response.new(
195
+ 200,
196
+ %q[
197
+ {
198
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
199
+ "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
200
+ "sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
201
+ "friendly_name": "updated_name",
202
+ "target": "sip:sip-updated.com:4321",
203
+ "priority": 2,
204
+ "weight": 10,
205
+ "enabled": false,
206
+ "date_created": "2020-03-18T23:31:36Z",
207
+ "date_updated": "2020-03-18T23:31:37Z",
208
+ "url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
209
+ }
210
+ ]
211
+ ))
212
+
213
+ actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
214
+ .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
215
+
216
+ expect(actual).to_not eq(nil)
217
+ end
218
+
219
+ it "can delete" do
220
+ @holodeck.mock(Twilio::Response.new(500, ''))
221
+
222
+ expect {
223
+ @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
224
+ .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
225
+ }.to raise_exception(Twilio::REST::TwilioError)
226
+
227
+ values = {}
228
+ expect(
229
+ @holodeck.has_request?(Holodeck::Request.new(
230
+ method: 'delete',
231
+ url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
232
+ ))).to eq(true)
233
+ end
234
+
235
+ it "receives delete responses" do
236
+ @holodeck.mock(Twilio::Response.new(
237
+ 204,
238
+ nil,
239
+ ))
240
+
241
+ actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
242
+ .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
243
+
244
+ expect(actual).to eq(true)
245
+ end
246
+ end