twilio-ruby 5.0.0.rc20 → 5.0.0.rc21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -3
- data/README.md +2 -2
- data/lib/twilio-ruby/http/http_client.rb +0 -1
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +196 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +197 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +232 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports.rb +44 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +517 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +35 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +336 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +393 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +409 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +479 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +506 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +336 -0
- data/lib/twilio-ruby/rest/preview/proxy/service.rb +467 -0
- data/lib/twilio-ruby/rest/preview/proxy.rb +35 -0
- data/lib/twilio-ruby/rest/preview.rb +34 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/preview/bulk_exports/export/day_spec.rb +56 -0
- data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +79 -0
- data/spec/integration/preview/bulk_exports/export_spec.rb +43 -0
- data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +277 -0
- data/spec/integration/preview/proxy/service/phone_number_spec.rb +173 -0
- data/spec/integration/preview/proxy/service/session/interaction_spec.rb +104 -0
- data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +164 -0
- data/spec/integration/preview/proxy/service/session/participant_spec.rb +226 -0
- data/spec/integration/preview/proxy/service/session_spec.rb +216 -0
- data/spec/integration/preview/proxy/service/short_code_spec.rb +173 -0
- data/spec/integration/preview/proxy/service_spec.rb +200 -0
- metadata +38 -2
@@ -0,0 +1,216 @@
|
|
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::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.proxy.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://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives fetch responses" do
|
27
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
28
|
+
200,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
32
|
+
"status": "in-progess",
|
33
|
+
"unique_name": "unique_name",
|
34
|
+
"start_time": "2015-07-30T20:00:00Z",
|
35
|
+
"links": {
|
36
|
+
"interactions": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",
|
37
|
+
"participants": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"
|
38
|
+
},
|
39
|
+
"ttl": 100,
|
40
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
41
|
+
"date_created": "2015-07-30T20:00:00Z",
|
42
|
+
"end_time": "2015-07-30T20:00:00Z",
|
43
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
44
|
+
"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
45
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
))
|
49
|
+
|
50
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
51
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
52
|
+
|
53
|
+
expect(actual).to_not eq(nil)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "can read" do
|
57
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
58
|
+
|
59
|
+
expect {
|
60
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
61
|
+
.sessions.list()
|
62
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
63
|
+
|
64
|
+
values = {}
|
65
|
+
expect(
|
66
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
67
|
+
method: 'get',
|
68
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions',
|
69
|
+
))).to eq(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "receives read_empty responses" do
|
73
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
74
|
+
200,
|
75
|
+
%q[
|
76
|
+
{
|
77
|
+
"sessions": [],
|
78
|
+
"meta": {
|
79
|
+
"previous_page_url": null,
|
80
|
+
"next_page_url": null,
|
81
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions?PageSize=50&Page=0",
|
82
|
+
"page": 0,
|
83
|
+
"first_page_url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions?PageSize=50&Page=0",
|
84
|
+
"page_size": 50,
|
85
|
+
"key": "sessions"
|
86
|
+
}
|
87
|
+
}
|
88
|
+
]
|
89
|
+
))
|
90
|
+
|
91
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
92
|
+
.sessions.list()
|
93
|
+
|
94
|
+
expect(actual).to_not eq(nil)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "can create" do
|
98
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
99
|
+
|
100
|
+
expect {
|
101
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
102
|
+
.sessions.create()
|
103
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
104
|
+
|
105
|
+
values = {}
|
106
|
+
expect(
|
107
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
108
|
+
method: 'post',
|
109
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions',
|
110
|
+
))).to eq(true)
|
111
|
+
end
|
112
|
+
|
113
|
+
it "receives create responses" do
|
114
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
115
|
+
201,
|
116
|
+
%q[
|
117
|
+
{
|
118
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
119
|
+
"status": "in-progess",
|
120
|
+
"unique_name": "unique_name",
|
121
|
+
"start_time": "2015-07-30T20:00:00Z",
|
122
|
+
"links": {
|
123
|
+
"interactions": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",
|
124
|
+
"participants": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"
|
125
|
+
},
|
126
|
+
"ttl": 100,
|
127
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
128
|
+
"date_created": "2015-07-30T20:00:00Z",
|
129
|
+
"end_time": "2015-07-30T20:00:00Z",
|
130
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
131
|
+
"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
132
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
133
|
+
}
|
134
|
+
]
|
135
|
+
))
|
136
|
+
|
137
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
138
|
+
.sessions.create()
|
139
|
+
|
140
|
+
expect(actual).to_not eq(nil)
|
141
|
+
end
|
142
|
+
|
143
|
+
it "can delete" do
|
144
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
145
|
+
|
146
|
+
expect {
|
147
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
148
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
149
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
150
|
+
|
151
|
+
values = {}
|
152
|
+
expect(
|
153
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
154
|
+
method: 'delete',
|
155
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
156
|
+
))).to eq(true)
|
157
|
+
end
|
158
|
+
|
159
|
+
it "receives delete responses" do
|
160
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
161
|
+
204,
|
162
|
+
nil,
|
163
|
+
))
|
164
|
+
|
165
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
166
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
167
|
+
|
168
|
+
expect(actual).to eq(true)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "can update" do
|
172
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
173
|
+
|
174
|
+
expect {
|
175
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
176
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
177
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
178
|
+
|
179
|
+
values = {}
|
180
|
+
expect(
|
181
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
182
|
+
method: 'post',
|
183
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
184
|
+
))).to eq(true)
|
185
|
+
end
|
186
|
+
|
187
|
+
it "receives update responses" do
|
188
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
189
|
+
200,
|
190
|
+
%q[
|
191
|
+
{
|
192
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
193
|
+
"status": "in-progess",
|
194
|
+
"unique_name": "unique_name",
|
195
|
+
"start_time": "2015-07-30T20:00:00Z",
|
196
|
+
"links": {
|
197
|
+
"interactions": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",
|
198
|
+
"participants": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"
|
199
|
+
},
|
200
|
+
"ttl": 100,
|
201
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
202
|
+
"date_created": "2015-07-30T20:00:00Z",
|
203
|
+
"end_time": "2015-07-30T20:00:00Z",
|
204
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
205
|
+
"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
206
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
207
|
+
}
|
208
|
+
]
|
209
|
+
))
|
210
|
+
|
211
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
212
|
+
.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
213
|
+
|
214
|
+
expect(actual).to_not eq(nil)
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'ShortCode' do
|
10
|
+
it "can create" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.short_codes.create(sid: "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
17
|
+
|
18
|
+
values = {
|
19
|
+
'Sid' => "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
20
|
+
}
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes',
|
25
|
+
data: values,
|
26
|
+
))).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "receives create responses" do
|
30
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
31
|
+
201,
|
32
|
+
%q[
|
33
|
+
{
|
34
|
+
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
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
|
+
"short_code": "12345",
|
40
|
+
"country_code": "US",
|
41
|
+
"capabilities": [],
|
42
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
48
|
+
.short_codes.create(sid: "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
49
|
+
|
50
|
+
expect(actual).to_not eq(nil)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "can delete" do
|
54
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
55
|
+
|
56
|
+
expect {
|
57
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
58
|
+
.short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
59
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
60
|
+
|
61
|
+
values = {}
|
62
|
+
expect(
|
63
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
64
|
+
method: 'delete',
|
65
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
66
|
+
))).to eq(true)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "receives delete responses" do
|
70
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
71
|
+
204,
|
72
|
+
nil,
|
73
|
+
))
|
74
|
+
|
75
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
76
|
+
.short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
77
|
+
|
78
|
+
expect(actual).to eq(true)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "can read" do
|
82
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
83
|
+
|
84
|
+
expect {
|
85
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
86
|
+
.short_codes.list()
|
87
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
88
|
+
|
89
|
+
values = {}
|
90
|
+
expect(
|
91
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
92
|
+
method: 'get',
|
93
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes',
|
94
|
+
))).to eq(true)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "receives read_full responses" do
|
98
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
99
|
+
200,
|
100
|
+
%q[
|
101
|
+
{
|
102
|
+
"meta": {
|
103
|
+
"page": 0,
|
104
|
+
"page_size": 50,
|
105
|
+
"first_page_url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes?PageSize=50&Page=0",
|
106
|
+
"previous_page_url": null,
|
107
|
+
"next_page_url": null,
|
108
|
+
"key": "short_codes",
|
109
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes?PageSize=50&Page=0"
|
110
|
+
},
|
111
|
+
"short_codes": [
|
112
|
+
{
|
113
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
114
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
115
|
+
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
116
|
+
"date_created": "2015-07-30T20:00:00Z",
|
117
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
118
|
+
"short_code": "12345",
|
119
|
+
"country_code": "US",
|
120
|
+
"capabilities": [],
|
121
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
122
|
+
}
|
123
|
+
]
|
124
|
+
}
|
125
|
+
]
|
126
|
+
))
|
127
|
+
|
128
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
129
|
+
.short_codes.list()
|
130
|
+
|
131
|
+
expect(actual).to_not eq(nil)
|
132
|
+
end
|
133
|
+
|
134
|
+
it "can fetch" do
|
135
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
136
|
+
|
137
|
+
expect {
|
138
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
139
|
+
.short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
140
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
141
|
+
|
142
|
+
values = {}
|
143
|
+
expect(
|
144
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
145
|
+
method: 'get',
|
146
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
147
|
+
))).to eq(true)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "receives fetch responses" do
|
151
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
152
|
+
200,
|
153
|
+
%q[
|
154
|
+
{
|
155
|
+
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
156
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
157
|
+
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
158
|
+
"date_created": "2015-07-30T20:00:00Z",
|
159
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
160
|
+
"short_code": "12345",
|
161
|
+
"country_code": "US",
|
162
|
+
"capabilities": [],
|
163
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
164
|
+
}
|
165
|
+
]
|
166
|
+
))
|
167
|
+
|
168
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
169
|
+
.short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
170
|
+
|
171
|
+
expect(actual).to_not eq(nil)
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Service' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
15
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
16
|
+
|
17
|
+
values = {}
|
18
|
+
expect(
|
19
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
20
|
+
method: 'get',
|
21
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
22
|
+
))).to eq(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "receives fetch responses" do
|
26
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
27
|
+
200,
|
28
|
+
%q[
|
29
|
+
{
|
30
|
+
"friendly_name": "friendly_name",
|
31
|
+
"date_created": "2015-07-30T20:00:00Z",
|
32
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
33
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
34
|
+
"sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"links": {
|
36
|
+
"sessions": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions",
|
37
|
+
"phone_numbers": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
|
38
|
+
"short_codes": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes"
|
39
|
+
},
|
40
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
41
|
+
"callback_url": "http://www.example.com",
|
42
|
+
"auto_create": false
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
48
|
+
|
49
|
+
expect(actual).to_not eq(nil)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "can read" do
|
53
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
54
|
+
|
55
|
+
expect {
|
56
|
+
@client.preview.proxy.services.list()
|
57
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
58
|
+
|
59
|
+
values = {}
|
60
|
+
expect(
|
61
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
62
|
+
method: 'get',
|
63
|
+
url: 'https://preview.twilio.com/Proxy/Services',
|
64
|
+
))).to eq(true)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "receives read_empty responses" do
|
68
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
69
|
+
200,
|
70
|
+
%q[
|
71
|
+
{
|
72
|
+
"meta": {
|
73
|
+
"previous_page_url": null,
|
74
|
+
"next_page_url": null,
|
75
|
+
"url": "https://preview.twilio.com/Proxy/Services?PageSize=50&Page=0",
|
76
|
+
"page": 0,
|
77
|
+
"first_page_url": "https://preview.twilio.com/Proxy/Services?PageSize=50&Page=0",
|
78
|
+
"page_size": 50,
|
79
|
+
"key": "services"
|
80
|
+
},
|
81
|
+
"services": []
|
82
|
+
}
|
83
|
+
]
|
84
|
+
))
|
85
|
+
|
86
|
+
actual = @client.preview.proxy.services.list()
|
87
|
+
|
88
|
+
expect(actual).to_not eq(nil)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "can create" do
|
92
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
93
|
+
|
94
|
+
expect {
|
95
|
+
@client.preview.proxy.services.create()
|
96
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
97
|
+
|
98
|
+
values = {}
|
99
|
+
expect(
|
100
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
101
|
+
method: 'post',
|
102
|
+
url: 'https://preview.twilio.com/Proxy/Services',
|
103
|
+
))).to eq(true)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "receives create responses" do
|
107
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
108
|
+
201,
|
109
|
+
%q[
|
110
|
+
{
|
111
|
+
"friendly_name": "friendly_name",
|
112
|
+
"date_created": "2015-07-30T20:00:00Z",
|
113
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
114
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
115
|
+
"sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
116
|
+
"links": {
|
117
|
+
"sessions": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions",
|
118
|
+
"phone_numbers": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
|
119
|
+
"short_codes": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes"
|
120
|
+
},
|
121
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
122
|
+
"callback_url": "http://www.example.com",
|
123
|
+
"auto_create": false
|
124
|
+
}
|
125
|
+
]
|
126
|
+
))
|
127
|
+
|
128
|
+
actual = @client.preview.proxy.services.create()
|
129
|
+
|
130
|
+
expect(actual).to_not eq(nil)
|
131
|
+
end
|
132
|
+
|
133
|
+
it "can delete" do
|
134
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
135
|
+
|
136
|
+
expect {
|
137
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
138
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
139
|
+
|
140
|
+
values = {}
|
141
|
+
expect(
|
142
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
143
|
+
method: 'delete',
|
144
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
145
|
+
))).to eq(true)
|
146
|
+
end
|
147
|
+
|
148
|
+
it "receives delete responses" do
|
149
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
150
|
+
204,
|
151
|
+
nil,
|
152
|
+
))
|
153
|
+
|
154
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
155
|
+
|
156
|
+
expect(actual).to eq(true)
|
157
|
+
end
|
158
|
+
|
159
|
+
it "can update" do
|
160
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
161
|
+
|
162
|
+
expect {
|
163
|
+
@client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
164
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
165
|
+
|
166
|
+
values = {}
|
167
|
+
expect(
|
168
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
169
|
+
method: 'post',
|
170
|
+
url: 'https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
171
|
+
))).to eq(true)
|
172
|
+
end
|
173
|
+
|
174
|
+
it "receives update responses" do
|
175
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
176
|
+
200,
|
177
|
+
%q[
|
178
|
+
{
|
179
|
+
"friendly_name": "friendly_name",
|
180
|
+
"date_created": "2015-07-30T20:00:00Z",
|
181
|
+
"url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
182
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
183
|
+
"sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
184
|
+
"links": {
|
185
|
+
"sessions": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions",
|
186
|
+
"phone_numbers": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
|
187
|
+
"short_codes": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes"
|
188
|
+
},
|
189
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
190
|
+
"callback_url": "http://www.example.com",
|
191
|
+
"auto_create": false
|
192
|
+
}
|
193
|
+
]
|
194
|
+
))
|
195
|
+
|
196
|
+
actual = @client.preview.proxy.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
197
|
+
|
198
|
+
expect(actual).to_not eq(nil)
|
199
|
+
end
|
200
|
+
end
|