twilio-ruby 5.3.1 → 5.4.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 +17 -0
- data/README.md +2 -2
- data/lib/rack/twilio_webhook_authentication.rb +46 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +10 -1
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +10 -1
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +10 -1
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +22 -3
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +3 -1
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +417 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +8 -7
- data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +16 -0
- data/lib/twilio-ruby/rest/preview.rb +9 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +384 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +456 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +465 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +541 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +578 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +377 -0
- data/lib/twilio-ruby/rest/proxy/v1/service.rb +509 -0
- data/lib/twilio-ruby/rest/proxy/v1.rb +41 -0
- data/lib/twilio-ruby/rest/proxy.rb +44 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +7 -0
- data/lib/twilio-ruby/security/request_validator.rb +1 -1
- data/lib/twilio-ruby/twiml/messaging_response.rb +5 -5
- data/lib/twilio-ruby/twiml/voice_response.rb +9 -7
- data/lib/twilio-ruby/util/configuration.rb +0 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/lib/twilio-ruby.rb +1 -0
- data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +2 -0
- data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +2 -0
- data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +2 -0
- data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +4 -0
- data/spec/integration/preview/hosted_numbers/authorization_document_spec.rb +211 -0
- data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +35 -4
- data/spec/integration/proxy/v1/service/phone_number_spec.rb +176 -0
- data/spec/integration/proxy/v1/service/session/interaction_spec.rb +104 -0
- data/spec/integration/proxy/v1/service/session/participant/message_interaction_spec.rb +164 -0
- data/spec/integration/proxy/v1/service/session/participant_spec.rb +232 -0
- data/spec/integration/proxy/v1/service/session_spec.rb +225 -0
- data/spec/integration/proxy/v1/service/short_code_spec.rb +173 -0
- data/spec/integration/proxy/v1/service_spec.rb +200 -0
- data/spec/integration/wireless/v1/sim_spec.rb +6 -3
- data/spec/rack/twilio_webhook_authentication_spec.rb +106 -0
- data/spec/security/request_validator_spec.rb +28 -0
- data/spec/twiml/messaging_response_spec.rb +6 -6
- metadata +31 -2
@@ -227,15 +227,13 @@ describe 'HostedNumberOrder' do
|
|
227
227
|
@holodeck.mock(Twilio::Response.new(500, ''))
|
228
228
|
|
229
229
|
expect {
|
230
|
-
@client.preview.hosted_numbers.hosted_number_orders.create(
|
230
|
+
@client.preview.hosted_numbers.hosted_number_orders.create(phone_number: "+987654321", iso_country: "iso_country", sms_capability: true)
|
231
231
|
}.to raise_exception(Twilio::REST::TwilioError)
|
232
232
|
|
233
233
|
values = {
|
234
|
-
'AddressSid' => "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
235
234
|
'PhoneNumber' => "+987654321",
|
236
235
|
'IsoCountry' => "iso_country",
|
237
236
|
'SmsCapability' => true,
|
238
|
-
'Email' => "email",
|
239
237
|
}
|
240
238
|
expect(
|
241
239
|
@holodeck.has_request?(Holodeck::Request.new(
|
@@ -273,7 +271,40 @@ describe 'HostedNumberOrder' do
|
|
273
271
|
]
|
274
272
|
))
|
275
273
|
|
276
|
-
actual = @client.preview.hosted_numbers.hosted_number_orders.create(
|
274
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders.create(phone_number: "+987654321", iso_country: "iso_country", sms_capability: true)
|
275
|
+
|
276
|
+
expect(actual).to_not eq(nil)
|
277
|
+
end
|
278
|
+
|
279
|
+
it "receives create_without_optional_loa_fields responses" do
|
280
|
+
@holodeck.mock(Twilio::Response.new(
|
281
|
+
201,
|
282
|
+
%q[
|
283
|
+
{
|
284
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
285
|
+
"address_sid": null,
|
286
|
+
"capabilities": {
|
287
|
+
"sms": true,
|
288
|
+
"voice": false
|
289
|
+
},
|
290
|
+
"cc_emails": [],
|
291
|
+
"date_created": "2017-03-28T20:06:39Z",
|
292
|
+
"date_updated": "2017-03-28T20:06:39Z",
|
293
|
+
"email": null,
|
294
|
+
"friendly_name": null,
|
295
|
+
"incoming_phone_number_sid": "PN11111111111111111111111111111111",
|
296
|
+
"phone_number": "+14153608311",
|
297
|
+
"sid": "HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
298
|
+
"signing_document_sid": null,
|
299
|
+
"status": "received",
|
300
|
+
"unique_name": null,
|
301
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
302
|
+
"verification_attempts": 0
|
303
|
+
}
|
304
|
+
]
|
305
|
+
))
|
306
|
+
|
307
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders.create(phone_number: "+987654321", iso_country: "iso_country", sms_capability: true)
|
277
308
|
|
278
309
|
expect(actual).to_not eq(nil)
|
279
310
|
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'PhoneNumber' do
|
10
|
+
it "can create" do
|
11
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.phone_numbers.create(sid: "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
17
|
+
|
18
|
+
values = {
|
19
|
+
'Sid' => "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
20
|
+
}
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers',
|
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": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
+
"date_created": "2015-07-30T20:00:00Z",
|
38
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
39
|
+
"phone_number": "+987654321",
|
40
|
+
"friendly_name": "Friendly Name",
|
41
|
+
"iso_country": "US",
|
42
|
+
"capabilities": [],
|
43
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
44
|
+
}
|
45
|
+
]
|
46
|
+
))
|
47
|
+
|
48
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
49
|
+
.phone_numbers.create(sid: "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
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.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
59
|
+
.phone_numbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").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://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
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.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
77
|
+
.phone_numbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
78
|
+
|
79
|
+
expect(actual).to eq(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "can read" do
|
83
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
84
|
+
|
85
|
+
expect {
|
86
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
87
|
+
.phone_numbers.list()
|
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://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers',
|
95
|
+
))).to eq(true)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "receives read_full responses" do
|
99
|
+
@holodeck.mock(Twilio::Response.new(
|
100
|
+
200,
|
101
|
+
%q[
|
102
|
+
{
|
103
|
+
"meta": {
|
104
|
+
"page": 0,
|
105
|
+
"page_size": 50,
|
106
|
+
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=50&Page=0",
|
107
|
+
"previous_page_url": null,
|
108
|
+
"next_page_url": null,
|
109
|
+
"key": "phone_numbers",
|
110
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=50&Page=0"
|
111
|
+
},
|
112
|
+
"phone_numbers": [
|
113
|
+
{
|
114
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
115
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
116
|
+
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
117
|
+
"date_created": "2015-07-30T20:00:00Z",
|
118
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
119
|
+
"phone_number": "+987654321",
|
120
|
+
"friendly_name": "Friendly Name",
|
121
|
+
"iso_country": "US",
|
122
|
+
"capabilities": [],
|
123
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
124
|
+
}
|
125
|
+
]
|
126
|
+
}
|
127
|
+
]
|
128
|
+
))
|
129
|
+
|
130
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
131
|
+
.phone_numbers.list()
|
132
|
+
|
133
|
+
expect(actual).to_not eq(nil)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "can fetch" do
|
137
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
138
|
+
|
139
|
+
expect {
|
140
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
141
|
+
.phone_numbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
142
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
143
|
+
|
144
|
+
values = {}
|
145
|
+
expect(
|
146
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
147
|
+
method: 'get',
|
148
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
149
|
+
))).to eq(true)
|
150
|
+
end
|
151
|
+
|
152
|
+
it "receives fetch responses" do
|
153
|
+
@holodeck.mock(Twilio::Response.new(
|
154
|
+
200,
|
155
|
+
%q[
|
156
|
+
{
|
157
|
+
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
158
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
159
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
160
|
+
"date_created": "2015-07-30T20:00:00Z",
|
161
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
162
|
+
"phone_number": "12345",
|
163
|
+
"friendly_name": "Friendly Name",
|
164
|
+
"iso_country": "US",
|
165
|
+
"capabilities": [],
|
166
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
167
|
+
}
|
168
|
+
]
|
169
|
+
))
|
170
|
+
|
171
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
172
|
+
.phone_numbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
173
|
+
|
174
|
+
expect(actual).to_not eq(nil)
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Interaction' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
16
|
+
.interactions("KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
17
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
18
|
+
|
19
|
+
values = {}
|
20
|
+
expect(
|
21
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
22
|
+
method: 'get',
|
23
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
24
|
+
))).to eq(true)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "receives fetch responses" do
|
28
|
+
@holodeck.mock(Twilio::Response.new(
|
29
|
+
200,
|
30
|
+
%q[
|
31
|
+
{
|
32
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
33
|
+
"data": "data",
|
34
|
+
"date_created": "2015-07-30T20:00:00Z",
|
35
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
36
|
+
"inbound_participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
+
"inbound_resource_sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"inbound_resource_status": "sent",
|
39
|
+
"inbound_resource_type": "Message",
|
40
|
+
"inbound_resource_url": null,
|
41
|
+
"outbound_participant_sid": "KPbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
42
|
+
"outbound_resource_sid": "SMbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
43
|
+
"outbound_resource_status": "sent",
|
44
|
+
"outbound_resource_type": "Message",
|
45
|
+
"outbound_resource_url": null,
|
46
|
+
"sid": "KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
47
|
+
"type": "message",
|
48
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
49
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
50
|
+
"session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
))
|
54
|
+
|
55
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
56
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
57
|
+
.interactions("KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
58
|
+
|
59
|
+
expect(actual).to_not eq(nil)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "can read" do
|
63
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
64
|
+
|
65
|
+
expect {
|
66
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
67
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
68
|
+
.interactions.list()
|
69
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
70
|
+
|
71
|
+
values = {}
|
72
|
+
expect(
|
73
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
74
|
+
method: 'get',
|
75
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions',
|
76
|
+
))).to eq(true)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "receives read_empty responses" do
|
80
|
+
@holodeck.mock(Twilio::Response.new(
|
81
|
+
200,
|
82
|
+
%q[
|
83
|
+
{
|
84
|
+
"interactions": [],
|
85
|
+
"meta": {
|
86
|
+
"previous_page_url": null,
|
87
|
+
"next_page_url": null,
|
88
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions?PageSize=50&Page=0",
|
89
|
+
"page": 0,
|
90
|
+
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions?PageSize=50&Page=0",
|
91
|
+
"page_size": 50,
|
92
|
+
"key": "interactions"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
]
|
96
|
+
))
|
97
|
+
|
98
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
99
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
100
|
+
.interactions.list()
|
101
|
+
|
102
|
+
expect(actual).to_not eq(nil)
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'MessageInteraction' do
|
10
|
+
it "can create" do
|
11
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
16
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
17
|
+
.message_interactions.create()
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {}
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions',
|
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
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
34
|
+
"data": "body",
|
35
|
+
"date_created": "2015-07-30T20:00:00Z",
|
36
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
37
|
+
"participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"inbound_participant_sid": null,
|
39
|
+
"inbound_resource_sid": null,
|
40
|
+
"inbound_resource_status": null,
|
41
|
+
"inbound_resource_type": null,
|
42
|
+
"inbound_resource_url": null,
|
43
|
+
"outbound_participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
44
|
+
"outbound_resource_sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
45
|
+
"outbound_resource_status": "sent",
|
46
|
+
"outbound_resource_type": "Message",
|
47
|
+
"outbound_resource_url": null,
|
48
|
+
"sid": "KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
49
|
+
"type": "message",
|
50
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
51
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
52
|
+
"session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
53
|
+
}
|
54
|
+
]
|
55
|
+
))
|
56
|
+
|
57
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
58
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
59
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
60
|
+
.message_interactions.create()
|
61
|
+
|
62
|
+
expect(actual).to_not eq(nil)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "can fetch" do
|
66
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
67
|
+
|
68
|
+
expect {
|
69
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
70
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
71
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
72
|
+
.message_interactions("KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
73
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
74
|
+
|
75
|
+
values = {}
|
76
|
+
expect(
|
77
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
78
|
+
method: 'get',
|
79
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
80
|
+
))).to eq(true)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "receives fetch responses" do
|
84
|
+
@holodeck.mock(Twilio::Response.new(
|
85
|
+
200,
|
86
|
+
%q[
|
87
|
+
{
|
88
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
89
|
+
"data": "data",
|
90
|
+
"date_created": "2015-07-30T20:00:00Z",
|
91
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
92
|
+
"participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
93
|
+
"inbound_participant_sid": null,
|
94
|
+
"inbound_resource_sid": null,
|
95
|
+
"inbound_resource_status": null,
|
96
|
+
"inbound_resource_type": null,
|
97
|
+
"inbound_resource_url": null,
|
98
|
+
"outbound_participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
99
|
+
"outbound_resource_sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
100
|
+
"outbound_resource_status": "sent",
|
101
|
+
"outbound_resource_type": "Message",
|
102
|
+
"outbound_resource_url": null,
|
103
|
+
"sid": "KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
104
|
+
"type": "message",
|
105
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
106
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
107
|
+
"session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
108
|
+
}
|
109
|
+
]
|
110
|
+
))
|
111
|
+
|
112
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
113
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
114
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
115
|
+
.message_interactions("KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
116
|
+
|
117
|
+
expect(actual).to_not eq(nil)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "can read" do
|
121
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
122
|
+
|
123
|
+
expect {
|
124
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
125
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
126
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
127
|
+
.message_interactions.list()
|
128
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
129
|
+
|
130
|
+
values = {}
|
131
|
+
expect(
|
132
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
133
|
+
method: 'get',
|
134
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions',
|
135
|
+
))).to eq(true)
|
136
|
+
end
|
137
|
+
|
138
|
+
it "receives read_empty responses" do
|
139
|
+
@holodeck.mock(Twilio::Response.new(
|
140
|
+
200,
|
141
|
+
%q[
|
142
|
+
{
|
143
|
+
"interactions": [],
|
144
|
+
"meta": {
|
145
|
+
"previous_page_url": null,
|
146
|
+
"next_page_url": null,
|
147
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions?PageSize=50&Page=0",
|
148
|
+
"page": 0,
|
149
|
+
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions?PageSize=50&Page=0",
|
150
|
+
"page_size": 50,
|
151
|
+
"key": "interactions"
|
152
|
+
}
|
153
|
+
}
|
154
|
+
]
|
155
|
+
))
|
156
|
+
|
157
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
158
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
159
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
160
|
+
.message_interactions.list()
|
161
|
+
|
162
|
+
expect(actual).to_not eq(nil)
|
163
|
+
end
|
164
|
+
end
|