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.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +5 -26
- data/.travis.yml +9 -1
- data/CHANGES.md +110 -0
- data/README.md +17 -2
- data/lib/twilio-ruby.rb +4 -12
- data/lib/twilio-ruby/framework/error.rb +3 -3
- data/lib/twilio-ruby/jwt/jwt.rb +6 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +90 -90
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +75 -72
- 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/autopilot.rb +6 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +7 -0
- data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
- data/lib/twilio-ruby/rest/client.rb +35 -8
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +19 -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 +20 -11
- 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/trusted_comms/business.rb +26 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand.rb +239 -0
- 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 +197 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
- data/lib/twilio-ruby/rest/studio.rb +2 -2
- data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +26 -0
- data/lib/twilio-ruby/rest/studio/v2.rb +3 -3
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +7 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +71 -24
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +12 -11
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +21 -20
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +18 -15
- 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 +53 -10
- data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +378 -0
- 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/verify/v2/form.rb +197 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +48 -3
- data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +379 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +500 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor/challenge.rb +494 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
- data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -12
- data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -12
- 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/twiml/twiml.rb +4 -0
- data/lib/twilio-ruby/twiml/voice_response.rb +3 -2
- 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_spec.rb +42 -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/autopilot/v1/restore_assistant_spec.rb +53 -0
- data/spec/integration/bulkexports/v1/export/day_spec.rb +1 -1
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
- data/spec/integration/conversations/v1/conversation_spec.rb +4 -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/bulk_exports/export/day_spec.rb +1 -1
- 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/asset/asset_version_spec.rb +1 -1
- data/spec/integration/serverless/v1/service/build_spec.rb +4 -4
- data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
- data/spec/integration/serverless/v1/service/function/function_version_spec.rb +1 -1
- data/spec/integration/studio/v1/flow/execution_spec.rb +46 -0
- data/spec/integration/studio/v2/flow/execution_spec.rb +45 -0
- data/spec/integration/studio/v2/flow_spec.rb +4 -0
- data/spec/integration/studio/v2/flow_validate_spec.rb +2 -2
- data/spec/integration/supersim/v1/fleet_spec.rb +12 -4
- 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/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/verify/v2/form_spec.rb +48 -0
- data/spec/integration/verify/v2/service/entity/factor/challenge_spec.rb +353 -0
- data/spec/integration/verify/v2/service/entity/factor_spec.rb +298 -0
- data/spec/integration/verify/v2/service/entity_spec.rb +201 -0
- data/spec/integration/verify/v2/service_spec.rb +28 -4
- data/spec/integration/video/v1/composition_settings_spec.rb +2 -2
- data/spec/integration/video/v1/recording_settings_spec.rb +2 -2
- data/spec/integration/video/v1/recording_spec.rb +2 -2
- data/spec/integration/video/v1/room/recording_spec.rb +2 -2
- 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 +173 -23
- data/spec/util/configuration_spec.rb +12 -0
- data/twilio-ruby.gemspec +4 -4
- metadata +67 -10
@@ -0,0 +1,298 @@
|
|
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 'Factor' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.entities('identity') \
|
18
|
+
.factors.create(binding: 'binding', friendly_name: 'friendly_name', factor_type: 'app-push', config: 'config')
|
19
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
20
|
+
|
21
|
+
values = {
|
22
|
+
'Binding' => 'binding',
|
23
|
+
'FriendlyName' => 'friendly_name',
|
24
|
+
'FactorType' => 'app-push',
|
25
|
+
'Config' => 'config',
|
26
|
+
}
|
27
|
+
expect(
|
28
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
29
|
+
method: 'post',
|
30
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors',
|
31
|
+
data: values,
|
32
|
+
))).to eq(true)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "receives create responses" do
|
36
|
+
@holodeck.mock(Twilio::Response.new(
|
37
|
+
201,
|
38
|
+
%q[
|
39
|
+
{
|
40
|
+
"sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
41
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
42
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
43
|
+
"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
44
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
45
|
+
"date_created": "2015-07-30T20:00:00Z",
|
46
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
47
|
+
"friendly_name": "friendly_name",
|
48
|
+
"status": "unverified",
|
49
|
+
"factor_type": "push",
|
50
|
+
"config": {
|
51
|
+
"sdk_version": "1.0",
|
52
|
+
"app_id": "com.authy.authy",
|
53
|
+
"notification_platform": "fcm",
|
54
|
+
"notification_token": "test_token"
|
55
|
+
},
|
56
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
57
|
+
"links": {
|
58
|
+
"challenges": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges"
|
59
|
+
}
|
60
|
+
}
|
61
|
+
]
|
62
|
+
))
|
63
|
+
|
64
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
65
|
+
.entities('identity') \
|
66
|
+
.factors.create(binding: 'binding', friendly_name: 'friendly_name', factor_type: 'app-push', config: 'config')
|
67
|
+
|
68
|
+
expect(actual).to_not eq(nil)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "can delete" do
|
72
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
73
|
+
|
74
|
+
expect {
|
75
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
76
|
+
.entities('identity') \
|
77
|
+
.factors('YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
78
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
79
|
+
|
80
|
+
values = {}
|
81
|
+
expect(
|
82
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
83
|
+
method: 'delete',
|
84
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors/YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
85
|
+
))).to eq(true)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "receives delete responses" do
|
89
|
+
@holodeck.mock(Twilio::Response.new(
|
90
|
+
204,
|
91
|
+
nil,
|
92
|
+
))
|
93
|
+
|
94
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
95
|
+
.entities('identity') \
|
96
|
+
.factors('YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
97
|
+
|
98
|
+
expect(actual).to eq(true)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "can fetch" do
|
102
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
103
|
+
|
104
|
+
expect {
|
105
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
106
|
+
.entities('identity') \
|
107
|
+
.factors('YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
108
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
109
|
+
|
110
|
+
values = {}
|
111
|
+
expect(
|
112
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
113
|
+
method: 'get',
|
114
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors/YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
115
|
+
))).to eq(true)
|
116
|
+
end
|
117
|
+
|
118
|
+
it "receives fetch responses" do
|
119
|
+
@holodeck.mock(Twilio::Response.new(
|
120
|
+
200,
|
121
|
+
%q[
|
122
|
+
{
|
123
|
+
"sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
124
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
125
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
126
|
+
"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
127
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
128
|
+
"date_created": "2015-07-30T20:00:00Z",
|
129
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
130
|
+
"friendly_name": "friendly_name",
|
131
|
+
"status": "unverified",
|
132
|
+
"factor_type": "push",
|
133
|
+
"config": {
|
134
|
+
"sdk_version": "1.0",
|
135
|
+
"app_id": "com.authy.authy",
|
136
|
+
"notification_platform": "fcm",
|
137
|
+
"notification_token": "test_token"
|
138
|
+
},
|
139
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
140
|
+
"links": {
|
141
|
+
"challenges": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges"
|
142
|
+
}
|
143
|
+
}
|
144
|
+
]
|
145
|
+
))
|
146
|
+
|
147
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
148
|
+
.entities('identity') \
|
149
|
+
.factors('YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
150
|
+
|
151
|
+
expect(actual).to_not eq(nil)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "can read" do
|
155
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
156
|
+
|
157
|
+
expect {
|
158
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
159
|
+
.entities('identity') \
|
160
|
+
.factors.list()
|
161
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
162
|
+
|
163
|
+
values = {}
|
164
|
+
expect(
|
165
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
166
|
+
method: 'get',
|
167
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors',
|
168
|
+
))).to eq(true)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "receives read_empty responses" do
|
172
|
+
@holodeck.mock(Twilio::Response.new(
|
173
|
+
200,
|
174
|
+
%q[
|
175
|
+
{
|
176
|
+
"factors": [],
|
177
|
+
"meta": {
|
178
|
+
"page": 0,
|
179
|
+
"page_size": 50,
|
180
|
+
"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0",
|
181
|
+
"previous_page_url": null,
|
182
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0",
|
183
|
+
"next_page_url": null,
|
184
|
+
"key": "factors"
|
185
|
+
}
|
186
|
+
}
|
187
|
+
]
|
188
|
+
))
|
189
|
+
|
190
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
191
|
+
.entities('identity') \
|
192
|
+
.factors.list()
|
193
|
+
|
194
|
+
expect(actual).to_not eq(nil)
|
195
|
+
end
|
196
|
+
|
197
|
+
it "receives read_full responses" do
|
198
|
+
@holodeck.mock(Twilio::Response.new(
|
199
|
+
200,
|
200
|
+
%q[
|
201
|
+
{
|
202
|
+
"factors": [
|
203
|
+
{
|
204
|
+
"sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
205
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
206
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
207
|
+
"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
208
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
209
|
+
"date_created": "2015-07-30T20:00:00Z",
|
210
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
211
|
+
"friendly_name": "friendly_name",
|
212
|
+
"status": "unverified",
|
213
|
+
"factor_type": "push",
|
214
|
+
"config": {
|
215
|
+
"sdk_version": "1.0",
|
216
|
+
"app_id": "com.authy.authy",
|
217
|
+
"notification_platform": "fcm",
|
218
|
+
"notification_token": "test_token"
|
219
|
+
},
|
220
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
221
|
+
"links": {
|
222
|
+
"challenges": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges"
|
223
|
+
}
|
224
|
+
}
|
225
|
+
],
|
226
|
+
"meta": {
|
227
|
+
"page": 0,
|
228
|
+
"page_size": 50,
|
229
|
+
"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0",
|
230
|
+
"previous_page_url": null,
|
231
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0",
|
232
|
+
"next_page_url": null,
|
233
|
+
"key": "factors"
|
234
|
+
}
|
235
|
+
}
|
236
|
+
]
|
237
|
+
))
|
238
|
+
|
239
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
240
|
+
.entities('identity') \
|
241
|
+
.factors.list()
|
242
|
+
|
243
|
+
expect(actual).to_not eq(nil)
|
244
|
+
end
|
245
|
+
|
246
|
+
it "can update" do
|
247
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
248
|
+
|
249
|
+
expect {
|
250
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
251
|
+
.entities('identity') \
|
252
|
+
.factors('YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
253
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
254
|
+
|
255
|
+
values = {}
|
256
|
+
expect(
|
257
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
258
|
+
method: 'post',
|
259
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors/YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
260
|
+
))).to eq(true)
|
261
|
+
end
|
262
|
+
|
263
|
+
it "receives verify responses" do
|
264
|
+
@holodeck.mock(Twilio::Response.new(
|
265
|
+
200,
|
266
|
+
%q[
|
267
|
+
{
|
268
|
+
"sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
269
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
270
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
271
|
+
"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
272
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
273
|
+
"date_created": "2015-07-30T20:00:00Z",
|
274
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
275
|
+
"friendly_name": "friendly_name",
|
276
|
+
"status": "verified",
|
277
|
+
"factor_type": "push",
|
278
|
+
"config": {
|
279
|
+
"sdk_version": "1.0",
|
280
|
+
"app_id": "com.authy.authy",
|
281
|
+
"notification_platform": "fcm",
|
282
|
+
"notification_token": "test_token"
|
283
|
+
},
|
284
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
285
|
+
"links": {
|
286
|
+
"challenges": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges"
|
287
|
+
}
|
288
|
+
}
|
289
|
+
]
|
290
|
+
))
|
291
|
+
|
292
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
293
|
+
.entities('identity') \
|
294
|
+
.factors('YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
295
|
+
|
296
|
+
expect(actual).to_not eq(nil)
|
297
|
+
end
|
298
|
+
end
|
@@ -0,0 +1,201 @@
|
|
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 'Entity' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.entities.create(identity: 'identity')
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {'Identity' => 'identity', }
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities',
|
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
|
+
"sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
36
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
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/Entities/ff483d1ff591898a9942916050d2ca3f",
|
41
|
+
"links": {
|
42
|
+
"factors": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
]
|
46
|
+
))
|
47
|
+
|
48
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
49
|
+
.entities.create(identity: 'identity')
|
50
|
+
|
51
|
+
expect(actual).to_not eq(nil)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "can delete" do
|
55
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
56
|
+
|
57
|
+
expect {
|
58
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
59
|
+
.entities('identity').delete()
|
60
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
61
|
+
|
62
|
+
values = {}
|
63
|
+
expect(
|
64
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
65
|
+
method: 'delete',
|
66
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity',
|
67
|
+
))).to eq(true)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "receives delete responses" do
|
71
|
+
@holodeck.mock(Twilio::Response.new(
|
72
|
+
204,
|
73
|
+
nil,
|
74
|
+
))
|
75
|
+
|
76
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
77
|
+
.entities('identity').delete()
|
78
|
+
|
79
|
+
expect(actual).to eq(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "can fetch" do
|
83
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
84
|
+
|
85
|
+
expect {
|
86
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
87
|
+
.entities('identity').fetch()
|
88
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
89
|
+
|
90
|
+
values = {}
|
91
|
+
expect(
|
92
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
93
|
+
method: 'get',
|
94
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity',
|
95
|
+
))).to eq(true)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "receives fetch responses" do
|
99
|
+
@holodeck.mock(Twilio::Response.new(
|
100
|
+
200,
|
101
|
+
%q[
|
102
|
+
{
|
103
|
+
"sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
104
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
105
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
106
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
107
|
+
"date_created": "2015-07-30T20:00:00Z",
|
108
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
109
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f",
|
110
|
+
"links": {
|
111
|
+
"factors": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors"
|
112
|
+
}
|
113
|
+
}
|
114
|
+
]
|
115
|
+
))
|
116
|
+
|
117
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
118
|
+
.entities('identity').fetch()
|
119
|
+
|
120
|
+
expect(actual).to_not eq(nil)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "can read" do
|
124
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
125
|
+
|
126
|
+
expect {
|
127
|
+
@client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
128
|
+
.entities.list()
|
129
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
130
|
+
|
131
|
+
values = {}
|
132
|
+
expect(
|
133
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
134
|
+
method: 'get',
|
135
|
+
url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities',
|
136
|
+
))).to eq(true)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "receives read_empty responses" do
|
140
|
+
@holodeck.mock(Twilio::Response.new(
|
141
|
+
200,
|
142
|
+
%q[
|
143
|
+
{
|
144
|
+
"entities": [],
|
145
|
+
"meta": {
|
146
|
+
"page": 0,
|
147
|
+
"page_size": 50,
|
148
|
+
"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
|
149
|
+
"previous_page_url": null,
|
150
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
|
151
|
+
"next_page_url": null,
|
152
|
+
"key": "entities"
|
153
|
+
}
|
154
|
+
}
|
155
|
+
]
|
156
|
+
))
|
157
|
+
|
158
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
159
|
+
.entities.list()
|
160
|
+
|
161
|
+
expect(actual).to_not eq(nil)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "receives read_full responses" do
|
165
|
+
@holodeck.mock(Twilio::Response.new(
|
166
|
+
200,
|
167
|
+
%q[
|
168
|
+
{
|
169
|
+
"entities": [
|
170
|
+
{
|
171
|
+
"sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
172
|
+
"identity": "ff483d1ff591898a9942916050d2ca3f",
|
173
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
174
|
+
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
175
|
+
"date_created": "2015-07-30T20:00:00Z",
|
176
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
177
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f",
|
178
|
+
"links": {
|
179
|
+
"factors": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors"
|
180
|
+
}
|
181
|
+
}
|
182
|
+
],
|
183
|
+
"meta": {
|
184
|
+
"page": 0,
|
185
|
+
"page_size": 50,
|
186
|
+
"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
|
187
|
+
"previous_page_url": null,
|
188
|
+
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
|
189
|
+
"next_page_url": null,
|
190
|
+
"key": "entities"
|
191
|
+
}
|
192
|
+
}
|
193
|
+
]
|
194
|
+
))
|
195
|
+
|
196
|
+
actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
197
|
+
.entities.list()
|
198
|
+
|
199
|
+
expect(actual).to_not eq(nil)
|
200
|
+
end
|
201
|
+
end
|