twilio-ruby 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,232 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Participant' 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
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").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/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
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
|
+
"sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
33
|
+
"session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
34
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"participant_type": "message-only",
|
37
|
+
"identifier": "identifier",
|
38
|
+
"proxy_identifier": "proxy_identifier",
|
39
|
+
"proxy_identifier_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
40
|
+
"friendly_name": "friendly_name",
|
41
|
+
"date_deleted": "2015-07-30T20:00:00Z",
|
42
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
43
|
+
"date_created": "2015-07-30T20:00:00Z",
|
44
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
45
|
+
"links": {
|
46
|
+
"message_interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
]
|
50
|
+
))
|
51
|
+
|
52
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
53
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
54
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
55
|
+
|
56
|
+
expect(actual).to_not eq(nil)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "can read" do
|
60
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
61
|
+
|
62
|
+
expect {
|
63
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
64
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
65
|
+
.participants.list()
|
66
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
67
|
+
|
68
|
+
values = {}
|
69
|
+
expect(
|
70
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
71
|
+
method: 'get',
|
72
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants',
|
73
|
+
))).to eq(true)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "receives read_empty responses" do
|
77
|
+
@holodeck.mock(Twilio::Response.new(
|
78
|
+
200,
|
79
|
+
%q[
|
80
|
+
{
|
81
|
+
"meta": {
|
82
|
+
"previous_page_url": null,
|
83
|
+
"next_page_url": null,
|
84
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",
|
85
|
+
"page": 0,
|
86
|
+
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",
|
87
|
+
"page_size": 50,
|
88
|
+
"key": "participants"
|
89
|
+
},
|
90
|
+
"participants": []
|
91
|
+
}
|
92
|
+
]
|
93
|
+
))
|
94
|
+
|
95
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
96
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
97
|
+
.participants.list()
|
98
|
+
|
99
|
+
expect(actual).to_not eq(nil)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "can create" do
|
103
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
104
|
+
|
105
|
+
expect {
|
106
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
107
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
108
|
+
.participants.create(identifier: "identifier")
|
109
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
110
|
+
|
111
|
+
values = {
|
112
|
+
'Identifier' => "identifier",
|
113
|
+
}
|
114
|
+
expect(
|
115
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
116
|
+
method: 'post',
|
117
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants',
|
118
|
+
data: values,
|
119
|
+
))).to eq(true)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "receives create responses" do
|
123
|
+
@holodeck.mock(Twilio::Response.new(
|
124
|
+
201,
|
125
|
+
%q[
|
126
|
+
{
|
127
|
+
"sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
128
|
+
"session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
129
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
130
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
131
|
+
"participant_type": "message-only",
|
132
|
+
"identifier": "identifier",
|
133
|
+
"proxy_identifier": "proxy_identifier",
|
134
|
+
"proxy_identifier_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
135
|
+
"friendly_name": "friendly_name",
|
136
|
+
"date_deleted": "2015-07-30T20:00:00Z",
|
137
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
138
|
+
"date_created": "2015-07-30T20:00:00Z",
|
139
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
140
|
+
"links": {
|
141
|
+
"message_interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions"
|
142
|
+
}
|
143
|
+
}
|
144
|
+
]
|
145
|
+
))
|
146
|
+
|
147
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
148
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
149
|
+
.participants.create(identifier: "identifier")
|
150
|
+
|
151
|
+
expect(actual).to_not eq(nil)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "can delete" do
|
155
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
156
|
+
|
157
|
+
expect {
|
158
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
159
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
160
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
161
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
162
|
+
|
163
|
+
values = {}
|
164
|
+
expect(
|
165
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
166
|
+
method: 'delete',
|
167
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
168
|
+
))).to eq(true)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "receives delete responses" do
|
172
|
+
@holodeck.mock(Twilio::Response.new(
|
173
|
+
204,
|
174
|
+
nil,
|
175
|
+
))
|
176
|
+
|
177
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
178
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
179
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
180
|
+
|
181
|
+
expect(actual).to eq(true)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "can update" do
|
185
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
186
|
+
|
187
|
+
expect {
|
188
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
189
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
190
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
191
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
192
|
+
|
193
|
+
values = {}
|
194
|
+
expect(
|
195
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
196
|
+
method: 'post',
|
197
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
198
|
+
))).to eq(true)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "receives update responses" do
|
202
|
+
@holodeck.mock(Twilio::Response.new(
|
203
|
+
200,
|
204
|
+
%q[
|
205
|
+
{
|
206
|
+
"sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
207
|
+
"session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
208
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
209
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
210
|
+
"participant_type": "message-only",
|
211
|
+
"identifier": "identifier",
|
212
|
+
"proxy_identifier": "proxy_identifier",
|
213
|
+
"proxy_identifier_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
214
|
+
"friendly_name": "friendly_name",
|
215
|
+
"date_deleted": "2015-07-30T20:00:00Z",
|
216
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
217
|
+
"date_created": "2015-07-30T20:00:00Z",
|
218
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
219
|
+
"links": {
|
220
|
+
"message_interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions"
|
221
|
+
}
|
222
|
+
}
|
223
|
+
]
|
224
|
+
))
|
225
|
+
|
226
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
227
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
228
|
+
.participants("KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
229
|
+
|
230
|
+
expect(actual).to_not eq(nil)
|
231
|
+
end
|
232
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Session' 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").fetch()
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
17
|
+
|
18
|
+
values = {}
|
19
|
+
expect(
|
20
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
21
|
+
method: 'get',
|
22
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives fetch responses" do
|
27
|
+
@holodeck.mock(Twilio::Response.new(
|
28
|
+
200,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
32
|
+
"status": "in-progess",
|
33
|
+
"unique_name": "unique_name",
|
34
|
+
"date_started": "2015-07-30T20:00:00Z",
|
35
|
+
"date_ended": "2015-07-30T20:00:00Z",
|
36
|
+
"date_last_interaction": "2015-07-30T20:00:00Z",
|
37
|
+
"date_expiry": "2015-07-30T20:00:00Z",
|
38
|
+
"ttl": 3600,
|
39
|
+
"closed_reason": "",
|
40
|
+
"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
41
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
42
|
+
"date_created": "2015-07-30T20:00:00Z",
|
43
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
44
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
45
|
+
"links": {
|
46
|
+
"interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",
|
47
|
+
"participants": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
]
|
51
|
+
))
|
52
|
+
|
53
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
54
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
55
|
+
|
56
|
+
expect(actual).to_not eq(nil)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "can read" do
|
60
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
61
|
+
|
62
|
+
expect {
|
63
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
64
|
+
.sessions.list()
|
65
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
66
|
+
|
67
|
+
values = {}
|
68
|
+
expect(
|
69
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
70
|
+
method: 'get',
|
71
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions',
|
72
|
+
))).to eq(true)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "receives read_empty responses" do
|
76
|
+
@holodeck.mock(Twilio::Response.new(
|
77
|
+
200,
|
78
|
+
%q[
|
79
|
+
{
|
80
|
+
"sessions": [],
|
81
|
+
"meta": {
|
82
|
+
"previous_page_url": null,
|
83
|
+
"next_page_url": null,
|
84
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions?PageSize=50&Page=0",
|
85
|
+
"page": 0,
|
86
|
+
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions?PageSize=50&Page=0",
|
87
|
+
"page_size": 50,
|
88
|
+
"key": "sessions"
|
89
|
+
}
|
90
|
+
}
|
91
|
+
]
|
92
|
+
))
|
93
|
+
|
94
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
95
|
+
.sessions.list()
|
96
|
+
|
97
|
+
expect(actual).to_not eq(nil)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "can create" do
|
101
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
102
|
+
|
103
|
+
expect {
|
104
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
105
|
+
.sessions.create()
|
106
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
107
|
+
|
108
|
+
values = {}
|
109
|
+
expect(
|
110
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
111
|
+
method: 'post',
|
112
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions',
|
113
|
+
))).to eq(true)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "receives create responses" do
|
117
|
+
@holodeck.mock(Twilio::Response.new(
|
118
|
+
201,
|
119
|
+
%q[
|
120
|
+
{
|
121
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
122
|
+
"status": "in-progess",
|
123
|
+
"unique_name": "unique_name",
|
124
|
+
"date_started": "2015-07-30T20:00:00Z",
|
125
|
+
"date_ended": "2015-07-30T20:00:00Z",
|
126
|
+
"date_last_interaction": "2015-07-30T20:00:00Z",
|
127
|
+
"date_expiry": "2015-07-30T20:00:00Z",
|
128
|
+
"ttl": 3600,
|
129
|
+
"closed_reason": "",
|
130
|
+
"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
131
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
132
|
+
"date_created": "2015-07-30T20:00:00Z",
|
133
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
134
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
135
|
+
"links": {
|
136
|
+
"interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",
|
137
|
+
"participants": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"
|
138
|
+
}
|
139
|
+
}
|
140
|
+
]
|
141
|
+
))
|
142
|
+
|
143
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
144
|
+
.sessions.create()
|
145
|
+
|
146
|
+
expect(actual).to_not eq(nil)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "can delete" do
|
150
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
151
|
+
|
152
|
+
expect {
|
153
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
154
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
155
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
156
|
+
|
157
|
+
values = {}
|
158
|
+
expect(
|
159
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
160
|
+
method: 'delete',
|
161
|
+
url: 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
162
|
+
))).to eq(true)
|
163
|
+
end
|
164
|
+
|
165
|
+
it "receives delete responses" do
|
166
|
+
@holodeck.mock(Twilio::Response.new(
|
167
|
+
204,
|
168
|
+
nil,
|
169
|
+
))
|
170
|
+
|
171
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
172
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
173
|
+
|
174
|
+
expect(actual).to eq(true)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "can update" do
|
178
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
179
|
+
|
180
|
+
expect {
|
181
|
+
@client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
182
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").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://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
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
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
199
|
+
"status": "in-progess",
|
200
|
+
"unique_name": "unique_name",
|
201
|
+
"date_started": "2015-07-30T20:00:00Z",
|
202
|
+
"date_ended": "2015-07-30T20:00:00Z",
|
203
|
+
"date_last_interaction": "2015-07-30T20:00:00Z",
|
204
|
+
"date_expiry": "2015-07-30T20:00:00Z",
|
205
|
+
"ttl": 3600,
|
206
|
+
"closed_reason": "",
|
207
|
+
"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
208
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
209
|
+
"date_created": "2015-07-30T20:00:00Z",
|
210
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
211
|
+
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
212
|
+
"links": {
|
213
|
+
"interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",
|
214
|
+
"participants": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"
|
215
|
+
}
|
216
|
+
}
|
217
|
+
]
|
218
|
+
))
|
219
|
+
|
220
|
+
actual = @client.proxy.v1.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
221
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
222
|
+
|
223
|
+
expect(actual).to_not eq(nil)
|
224
|
+
end
|
225
|
+
end
|