twilio-ruby 5.34.0 → 5.38.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 +126 -0
- data/README.md +24 -3
- data/lib/twilio-ruby.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +87 -87
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +47 -9
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +71 -71
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +29 -29
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +38 -3
- data/lib/twilio-ruby/rest/api/v2010/account/validation_request.rb +12 -12
- data/lib/twilio-ruby/rest/autopilot.rb +6 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +7 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +0 -16
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +12 -3
- data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
- data/lib/twilio-ruby/rest/client.rb +35 -15
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +28 -3
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +27 -4
- data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +2 -1
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +6 -3
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +8 -8
- data/lib/twilio-ruby/rest/notify/v1/service.rb +20 -1
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +26 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +324 -0
- data/lib/twilio-ruby/rest/preview.rb +6 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +7 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/brands_information.rb +193 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +26 -0
- data/lib/twilio-ruby/rest/{autopilot/v1/assistant/export_assistant.rb → preview/trusted_comms/business/brand.rb} +88 -71
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +266 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +194 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
- data/lib/twilio-ruby/rest/supersim.rb +18 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +30 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +63 -16
- data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
- data/lib/twilio-ruby/rest/{authy/v1/service.rb → supersim/v1/network_access_profile.rb} +95 -121
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +352 -0
- data/lib/twilio-ruby/rest/verify.rb +9 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +16 -0
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/form.rb +8 -8
- data/lib/twilio-ruby/rest/verify/v2/service.rb +74 -3
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/service/entity.rb +32 -8
- data/lib/twilio-ruby/rest/verify/v2/service/entity/access_token.rb +141 -0
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/service/entity/factor.rb +8 -8
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/service/entity/factor/challenge.rb +8 -8
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
- data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +425 -0
- data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -4
- data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -4
- data/lib/twilio-ruby/rest/voice.rb +36 -0
- data/lib/twilio-ruby/rest/voice/v1.rb +64 -0
- data/lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb +513 -0
- data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +379 -0
- data/lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb +458 -0
- data/lib/twilio-ruby/rest/voice/v1/ip_record.rb +366 -0
- data/lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb +346 -0
- data/lib/twilio-ruby/util/configuration.rb +9 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call_spec.rb +5 -5
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +177 -0
- data/spec/integration/api/v2010/account/conference_spec.rb +42 -14
- data/spec/integration/api/v2010/account/outgoing_caller_id_spec.rb +8 -14
- data/spec/integration/api/v2010/account/sip/domain_spec.rb +12 -4
- data/spec/integration/api/v2010/account/token_spec.rb +23 -11
- data/spec/integration/api/v2010/account/validation_request_spec.rb +1 -1
- data/spec/integration/autopilot/v1/assistant/query_spec.rb +4 -4
- data/spec/integration/autopilot/v1/assistant_spec.rb +4 -8
- data/spec/integration/autopilot/v1/restore_assistant_spec.rb +53 -0
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
- data/spec/integration/conversations/v1/conversation_spec.rb +16 -0
- data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
- data/spec/integration/numbers/v2/regulatory_compliance/bundle/evaluation_spec.rb +623 -0
- data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +4 -0
- data/spec/integration/preview/trusted_comms/brands_information_spec.rb +44 -0
- data/spec/integration/preview/trusted_comms/business/brand/branded_channel/channel_spec.rb +54 -0
- data/spec/integration/preview/trusted_comms/business/brand/branded_channel_spec.rb +52 -0
- data/spec/integration/preview/trusted_comms/business/brand_spec.rb +49 -0
- data/spec/integration/preview/trusted_comms/business_spec.rb +1 -0
- data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
- data/spec/integration/supersim/v1/fleet_spec.rb +16 -7
- data/spec/integration/supersim/v1/network_access_profile/network_access_profile_network_spec.rb +179 -0
- data/spec/integration/supersim/v1/network_access_profile_spec.rb +223 -0
- data/spec/integration/supersim/v1/network_spec.rb +139 -0
- data/spec/integration/supersim/v1/sim_spec.rb +78 -6
- data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +13 -13
- data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +23 -23
- data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +28 -28
- data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +17 -17
- data/spec/integration/trunking/v1/trunk_spec.rb +33 -33
- data/spec/integration/{authy/v1 → verify/v2}/form_spec.rb +4 -4
- data/spec/integration/verify/v2/service/entity/access_token_spec.rb +46 -0
- data/spec/integration/{authy/v1 → verify/v2}/service/entity/factor/challenge_spec.rb +73 -73
- data/spec/integration/{authy/v1 → verify/v2}/service/entity/factor_spec.rb +54 -54
- data/spec/integration/verify/v2/service/entity_spec.rb +204 -0
- data/spec/integration/verify/v2/service/webhook_spec.rb +262 -0
- data/spec/integration/verify/v2/service_spec.rb +32 -4
- data/spec/integration/voice/v1/byoc_trunk_spec.rb +250 -0
- data/spec/integration/voice/v1/connection_policy/connection_policy_target_spec.rb +246 -0
- data/spec/integration/voice/v1/connection_policy_spec.rb +226 -0
- data/spec/integration/voice/v1/ip_record_spec.rb +223 -0
- data/spec/integration/voice/v1/source_ip_mapping_spec.rb +219 -0
- data/spec/rest/client_spec.rb +168 -58
- data/spec/util/configuration_spec.rb +12 -0
- data/twilio-ruby.gemspec +1 -1
- metadata +63 -23
- data/lib/twilio-ruby/rest/authy.rb +0 -55
- data/lib/twilio-ruby/rest/authy/v1.rb +0 -59
- data/spec/integration/authy/v1/service/entity_spec.rb +0 -201
- data/spec/integration/authy/v1/service_spec.rb +0 -231
- data/spec/integration/autopilot/v1/assistant/export_assistant_spec.rb +0 -49
@@ -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
|
@@ -0,0 +1,226 @@
|
|
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 'ConnectionPolicy' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.voice.v1.connection_policies.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/ConnectionPolicies',
|
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": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
34
|
+
"friendly_name": "friendly_name",
|
35
|
+
"date_created": "2020-03-18T23:31:36Z",
|
36
|
+
"date_updated": "2020-03-18T23:31:36Z",
|
37
|
+
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"links": {
|
39
|
+
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
))
|
44
|
+
|
45
|
+
actual = @client.voice.v1.connection_policies.create()
|
46
|
+
|
47
|
+
expect(actual).to_not eq(nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "can fetch" do
|
51
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
52
|
+
|
53
|
+
expect {
|
54
|
+
@client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
55
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
56
|
+
|
57
|
+
values = {}
|
58
|
+
expect(
|
59
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
60
|
+
method: 'get',
|
61
|
+
url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
62
|
+
))).to eq(true)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "receives fetch responses" do
|
66
|
+
@holodeck.mock(Twilio::Response.new(
|
67
|
+
200,
|
68
|
+
%q[
|
69
|
+
{
|
70
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
71
|
+
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
72
|
+
"friendly_name": "friendly_name",
|
73
|
+
"date_created": "2020-03-18T23:31:36Z",
|
74
|
+
"date_updated": "2020-03-18T23:31:37Z",
|
75
|
+
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
76
|
+
"links": {
|
77
|
+
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
|
78
|
+
}
|
79
|
+
}
|
80
|
+
]
|
81
|
+
))
|
82
|
+
|
83
|
+
actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
84
|
+
|
85
|
+
expect(actual).to_not eq(nil)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "can read" do
|
89
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
90
|
+
|
91
|
+
expect {
|
92
|
+
@client.voice.v1.connection_policies.list()
|
93
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
94
|
+
|
95
|
+
values = {}
|
96
|
+
expect(
|
97
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
98
|
+
method: 'get',
|
99
|
+
url: 'https://voice.twilio.com/v1/ConnectionPolicies',
|
100
|
+
))).to eq(true)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "receives read_full responses" do
|
104
|
+
@holodeck.mock(Twilio::Response.new(
|
105
|
+
200,
|
106
|
+
%q[
|
107
|
+
{
|
108
|
+
"meta": {
|
109
|
+
"page": 0,
|
110
|
+
"page_size": 50,
|
111
|
+
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",
|
112
|
+
"previous_page_url": null,
|
113
|
+
"url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",
|
114
|
+
"next_page_url": null,
|
115
|
+
"key": "connection_policies"
|
116
|
+
},
|
117
|
+
"connection_policies": [
|
118
|
+
{
|
119
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
120
|
+
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
121
|
+
"friendly_name": "friendly_name",
|
122
|
+
"date_created": "2020-03-18T23:31:36Z",
|
123
|
+
"date_updated": "2020-03-18T23:31:37Z",
|
124
|
+
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
125
|
+
"links": {
|
126
|
+
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
|
127
|
+
}
|
128
|
+
}
|
129
|
+
]
|
130
|
+
}
|
131
|
+
]
|
132
|
+
))
|
133
|
+
|
134
|
+
actual = @client.voice.v1.connection_policies.list()
|
135
|
+
|
136
|
+
expect(actual).to_not eq(nil)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "receives read_empty responses" do
|
140
|
+
@holodeck.mock(Twilio::Response.new(
|
141
|
+
200,
|
142
|
+
%q[
|
143
|
+
{
|
144
|
+
"meta": {
|
145
|
+
"page": 0,
|
146
|
+
"page_size": 50,
|
147
|
+
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",
|
148
|
+
"previous_page_url": null,
|
149
|
+
"url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",
|
150
|
+
"next_page_url": null,
|
151
|
+
"key": "connection_policies"
|
152
|
+
},
|
153
|
+
"connection_policies": []
|
154
|
+
}
|
155
|
+
]
|
156
|
+
))
|
157
|
+
|
158
|
+
actual = @client.voice.v1.connection_policies.list()
|
159
|
+
|
160
|
+
expect(actual).to_not eq(nil)
|
161
|
+
end
|
162
|
+
|
163
|
+
it "can update" do
|
164
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
165
|
+
|
166
|
+
expect {
|
167
|
+
@client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
168
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
169
|
+
|
170
|
+
values = {}
|
171
|
+
expect(
|
172
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
173
|
+
method: 'post',
|
174
|
+
url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
175
|
+
))).to eq(true)
|
176
|
+
end
|
177
|
+
|
178
|
+
it "receives update responses" do
|
179
|
+
@holodeck.mock(Twilio::Response.new(
|
180
|
+
200,
|
181
|
+
%q[
|
182
|
+
{
|
183
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
184
|
+
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
185
|
+
"friendly_name": "updated_name",
|
186
|
+
"date_created": "2020-03-18T23:31:36Z",
|
187
|
+
"date_updated": "2020-03-18T23:31:37Z",
|
188
|
+
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
189
|
+
"links": {
|
190
|
+
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
|
191
|
+
}
|
192
|
+
}
|
193
|
+
]
|
194
|
+
))
|
195
|
+
|
196
|
+
actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
197
|
+
|
198
|
+
expect(actual).to_not eq(nil)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "can delete" do
|
202
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
203
|
+
|
204
|
+
expect {
|
205
|
+
@client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
206
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
207
|
+
|
208
|
+
values = {}
|
209
|
+
expect(
|
210
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
211
|
+
method: 'delete',
|
212
|
+
url: 'https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
213
|
+
))).to eq(true)
|
214
|
+
end
|
215
|
+
|
216
|
+
it "receives delete responses" do
|
217
|
+
@holodeck.mock(Twilio::Response.new(
|
218
|
+
204,
|
219
|
+
nil,
|
220
|
+
))
|
221
|
+
|
222
|
+
actual = @client.voice.v1.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
223
|
+
|
224
|
+
expect(actual).to eq(true)
|
225
|
+
end
|
226
|
+
end
|