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
@@ -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
@@ -0,0 +1,223 @@
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 'IpRecord' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.voice.v1.ip_records.create(ip_address: 'ip_address')
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {'IpAddress' => 'ip_address', }
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'post',
23
+ url: 'https://voice.twilio.com/v1/IpRecords',
24
+ data: values,
25
+ ))).to eq(true)
26
+ end
27
+
28
+ it "receives create responses" do
29
+ @holodeck.mock(Twilio::Response.new(
30
+ 201,
31
+ %q[
32
+ {
33
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "friendly_name": "friendly_name",
36
+ "ip_address": "10.2.3.4",
37
+ "cidr_prefix_length": 30,
38
+ "date_created": "2020-03-18T23:31:36Z",
39
+ "date_updated": "2020-03-18T23:31:36Z",
40
+ "url": "https://voice.twilio.com/v1/IpRecords/ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
41
+ }
42
+ ]
43
+ ))
44
+
45
+ actual = @client.voice.v1.ip_records.create(ip_address: 'ip_address')
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.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').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/IpRecords/ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
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": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
72
+ "friendly_name": "friendly_name",
73
+ "ip_address": "10.2.3.4",
74
+ "cidr_prefix_length": 30,
75
+ "date_created": "2020-03-18T23:31:36Z",
76
+ "date_updated": "2020-03-18T23:31:37Z",
77
+ "url": "https://voice.twilio.com/v1/IpRecords/ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
78
+ }
79
+ ]
80
+ ))
81
+
82
+ actual = @client.voice.v1.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
83
+
84
+ expect(actual).to_not eq(nil)
85
+ end
86
+
87
+ it "can read" do
88
+ @holodeck.mock(Twilio::Response.new(500, ''))
89
+
90
+ expect {
91
+ @client.voice.v1.ip_records.list()
92
+ }.to raise_exception(Twilio::REST::TwilioError)
93
+
94
+ values = {}
95
+ expect(
96
+ @holodeck.has_request?(Holodeck::Request.new(
97
+ method: 'get',
98
+ url: 'https://voice.twilio.com/v1/IpRecords',
99
+ ))).to eq(true)
100
+ end
101
+
102
+ it "receives read_full responses" do
103
+ @holodeck.mock(Twilio::Response.new(
104
+ 200,
105
+ %q[
106
+ {
107
+ "meta": {
108
+ "page": 0,
109
+ "page_size": 50,
110
+ "first_page_url": "https://voice.twilio.com/v1/IpRecords?PageSize=50&Page=0",
111
+ "previous_page_url": null,
112
+ "url": "https://voice.twilio.com/v1/IpRecords?PageSize=50&Page=0",
113
+ "next_page_url": null,
114
+ "key": "ip_records"
115
+ },
116
+ "ip_records": [
117
+ {
118
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
119
+ "sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
120
+ "friendly_name": "friendly_name",
121
+ "ip_address": "10.2.3.4",
122
+ "cidr_prefix_length": 30,
123
+ "date_created": "2020-03-18T23:31:36Z",
124
+ "date_updated": "2020-03-18T23:31:37Z",
125
+ "url": "https://voice.twilio.com/v1/IpRecords/ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
126
+ }
127
+ ]
128
+ }
129
+ ]
130
+ ))
131
+
132
+ actual = @client.voice.v1.ip_records.list()
133
+
134
+ expect(actual).to_not eq(nil)
135
+ end
136
+
137
+ it "receives read_empty responses" do
138
+ @holodeck.mock(Twilio::Response.new(
139
+ 200,
140
+ %q[
141
+ {
142
+ "meta": {
143
+ "page": 0,
144
+ "page_size": 50,
145
+ "first_page_url": "https://voice.twilio.com/v1/IpRecords?PageSize=50&Page=0",
146
+ "previous_page_url": null,
147
+ "url": "https://voice.twilio.com/v1/IpRecords?PageSize=50&Page=0",
148
+ "next_page_url": null,
149
+ "key": "ip_records"
150
+ },
151
+ "ip_records": []
152
+ }
153
+ ]
154
+ ))
155
+
156
+ actual = @client.voice.v1.ip_records.list()
157
+
158
+ expect(actual).to_not eq(nil)
159
+ end
160
+
161
+ it "can update" do
162
+ @holodeck.mock(Twilio::Response.new(500, ''))
163
+
164
+ expect {
165
+ @client.voice.v1.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
166
+ }.to raise_exception(Twilio::REST::TwilioError)
167
+
168
+ values = {}
169
+ expect(
170
+ @holodeck.has_request?(Holodeck::Request.new(
171
+ method: 'post',
172
+ url: 'https://voice.twilio.com/v1/IpRecords/ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
173
+ ))).to eq(true)
174
+ end
175
+
176
+ it "receives update responses" do
177
+ @holodeck.mock(Twilio::Response.new(
178
+ 200,
179
+ %q[
180
+ {
181
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
182
+ "sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
183
+ "friendly_name": "update_name",
184
+ "ip_address": "10.2.3.4",
185
+ "cidr_prefix_length": 30,
186
+ "date_created": "2020-03-18T23:31:36Z",
187
+ "date_updated": "2020-03-18T23:31:37Z",
188
+ "url": "https://voice.twilio.com/v1/IpRecords/ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
189
+ }
190
+ ]
191
+ ))
192
+
193
+ actual = @client.voice.v1.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
194
+
195
+ expect(actual).to_not eq(nil)
196
+ end
197
+
198
+ it "can delete" do
199
+ @holodeck.mock(Twilio::Response.new(500, ''))
200
+
201
+ expect {
202
+ @client.voice.v1.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
203
+ }.to raise_exception(Twilio::REST::TwilioError)
204
+
205
+ values = {}
206
+ expect(
207
+ @holodeck.has_request?(Holodeck::Request.new(
208
+ method: 'delete',
209
+ url: 'https://voice.twilio.com/v1/IpRecords/ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
210
+ ))).to eq(true)
211
+ end
212
+
213
+ it "receives delete responses" do
214
+ @holodeck.mock(Twilio::Response.new(
215
+ 204,
216
+ nil,
217
+ ))
218
+
219
+ actual = @client.voice.v1.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
220
+
221
+ expect(actual).to eq(true)
222
+ end
223
+ end
@@ -0,0 +1,219 @@
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 'SourceIpMapping' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.voice.v1.source_ip_mappings.create(ip_record_sid: 'ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', sip_domain_sid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {
20
+ 'IpRecordSid' => 'ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
21
+ 'SipDomainSid' => 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
22
+ }
23
+ expect(
24
+ @holodeck.has_request?(Holodeck::Request.new(
25
+ method: 'post',
26
+ url: 'https://voice.twilio.com/v1/SourceIpMappings',
27
+ data: values,
28
+ ))).to eq(true)
29
+ end
30
+
31
+ it "receives create responses" do
32
+ @holodeck.mock(Twilio::Response.new(
33
+ 201,
34
+ %q[
35
+ {
36
+ "sid": "IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "ip_record_sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "sip_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
39
+ "date_created": "2020-03-18T23:31:36Z",
40
+ "date_updated": "2020-03-18T23:31:36Z",
41
+ "url": "https://voice.twilio.com/v1/SourceIpMappings/IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
42
+ }
43
+ ]
44
+ ))
45
+
46
+ actual = @client.voice.v1.source_ip_mappings.create(ip_record_sid: 'ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', sip_domain_sid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
47
+
48
+ expect(actual).to_not eq(nil)
49
+ end
50
+
51
+ it "can fetch" do
52
+ @holodeck.mock(Twilio::Response.new(500, ''))
53
+
54
+ expect {
55
+ @client.voice.v1.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
56
+ }.to raise_exception(Twilio::REST::TwilioError)
57
+
58
+ values = {}
59
+ expect(
60
+ @holodeck.has_request?(Holodeck::Request.new(
61
+ method: 'get',
62
+ url: 'https://voice.twilio.com/v1/SourceIpMappings/IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
63
+ ))).to eq(true)
64
+ end
65
+
66
+ it "receives fetch responses" do
67
+ @holodeck.mock(Twilio::Response.new(
68
+ 200,
69
+ %q[
70
+ {
71
+ "sid": "IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
72
+ "ip_record_sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
73
+ "sip_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
74
+ "date_created": "2020-03-18T23:31:36Z",
75
+ "date_updated": "2020-03-18T23:31:37Z",
76
+ "url": "https://voice.twilio.com/v1/SourceIpMappings/IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
77
+ }
78
+ ]
79
+ ))
80
+
81
+ actual = @client.voice.v1.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
82
+
83
+ expect(actual).to_not eq(nil)
84
+ end
85
+
86
+ it "can read" do
87
+ @holodeck.mock(Twilio::Response.new(500, ''))
88
+
89
+ expect {
90
+ @client.voice.v1.source_ip_mappings.list()
91
+ }.to raise_exception(Twilio::REST::TwilioError)
92
+
93
+ values = {}
94
+ expect(
95
+ @holodeck.has_request?(Holodeck::Request.new(
96
+ method: 'get',
97
+ url: 'https://voice.twilio.com/v1/SourceIpMappings',
98
+ ))).to eq(true)
99
+ end
100
+
101
+ it "receives read_full responses" do
102
+ @holodeck.mock(Twilio::Response.new(
103
+ 200,
104
+ %q[
105
+ {
106
+ "meta": {
107
+ "page": 0,
108
+ "page_size": 50,
109
+ "first_page_url": "https://voice.twilio.com/v1/SourceIpMappings?PageSize=50&Page=0",
110
+ "previous_page_url": null,
111
+ "url": "https://voice.twilio.com/v1/SourceIpMappings?PageSize=50&Page=0",
112
+ "next_page_url": null,
113
+ "key": "source_ip_mappings"
114
+ },
115
+ "source_ip_mappings": [
116
+ {
117
+ "sid": "IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
118
+ "ip_record_sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
119
+ "sip_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
120
+ "date_created": "2020-03-18T23:31:36Z",
121
+ "date_updated": "2020-03-18T23:31:37Z",
122
+ "url": "https://voice.twilio.com/v1/SourceIpMappings/IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ ))
128
+
129
+ actual = @client.voice.v1.source_ip_mappings.list()
130
+
131
+ expect(actual).to_not eq(nil)
132
+ end
133
+
134
+ it "receives read_empty responses" do
135
+ @holodeck.mock(Twilio::Response.new(
136
+ 200,
137
+ %q[
138
+ {
139
+ "meta": {
140
+ "page": 0,
141
+ "page_size": 50,
142
+ "first_page_url": "https://voice.twilio.com/v1/SourceIpMappings?PageSize=50&Page=0",
143
+ "previous_page_url": null,
144
+ "url": "https://voice.twilio.com/v1/SourceIpMappings?PageSize=50&Page=0",
145
+ "next_page_url": null,
146
+ "key": "source_ip_mappings"
147
+ },
148
+ "source_ip_mappings": []
149
+ }
150
+ ]
151
+ ))
152
+
153
+ actual = @client.voice.v1.source_ip_mappings.list()
154
+
155
+ expect(actual).to_not eq(nil)
156
+ end
157
+
158
+ it "can update" do
159
+ @holodeck.mock(Twilio::Response.new(500, ''))
160
+
161
+ expect {
162
+ @client.voice.v1.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(sip_domain_sid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
163
+ }.to raise_exception(Twilio::REST::TwilioError)
164
+
165
+ values = {'SipDomainSid' => 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', }
166
+ expect(
167
+ @holodeck.has_request?(Holodeck::Request.new(
168
+ method: 'post',
169
+ url: 'https://voice.twilio.com/v1/SourceIpMappings/IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
170
+ data: values,
171
+ ))).to eq(true)
172
+ end
173
+
174
+ it "receives update responses" do
175
+ @holodeck.mock(Twilio::Response.new(
176
+ 200,
177
+ %q[
178
+ {
179
+ "sid": "IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
180
+ "ip_record_sid": "ILaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
181
+ "sip_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
182
+ "date_created": "2020-03-18T23:31:36Z",
183
+ "date_updated": "2020-03-18T23:31:37Z",
184
+ "url": "https://voice.twilio.com/v1/SourceIpMappings/IBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
185
+ }
186
+ ]
187
+ ))
188
+
189
+ actual = @client.voice.v1.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(sip_domain_sid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
190
+
191
+ expect(actual).to_not eq(nil)
192
+ end
193
+
194
+ it "can delete" do
195
+ @holodeck.mock(Twilio::Response.new(500, ''))
196
+
197
+ expect {
198
+ @client.voice.v1.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
199
+ }.to raise_exception(Twilio::REST::TwilioError)
200
+
201
+ values = {}
202
+ expect(
203
+ @holodeck.has_request?(Holodeck::Request.new(
204
+ method: 'delete',
205
+ url: 'https://voice.twilio.com/v1/SourceIpMappings/IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
206
+ ))).to eq(true)
207
+ end
208
+
209
+ it "receives delete responses" do
210
+ @holodeck.mock(Twilio::Response.new(
211
+ 204,
212
+ nil,
213
+ ))
214
+
215
+ actual = @client.voice.v1.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
216
+
217
+ expect(actual).to eq(true)
218
+ end
219
+ end