twilio-ruby 5.0.0.rc3 → 5.0.0.rc4
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 -0
- data/lib/twilio-ruby/rest/client.rb +7 -4
- data/lib/twilio-ruby/rest/conversations/v1/conversation/completed.rb +0 -7
- data/lib/twilio-ruby/rest/conversations/v1/conversation/in_progress.rb +0 -7
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/notifications/v1/service/binding.rb +440 -0
- data/lib/twilio-ruby/rest/notifications/v1/service/notification.rb +217 -0
- data/lib/twilio-ruby/rest/notifications/v1/service.rb +478 -0
- data/lib/twilio-ruby/rest/notifications/v1.rb +35 -0
- data/lib/twilio-ruby/rest/notifications.rb +40 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +96 -5
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/ip_messaging/v1/credential_spec.rb +136 -0
- data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +133 -0
- data/spec/integration/ip_messaging/v1/service/channel_spec.rb +171 -1
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +167 -1
- data/spec/integration/ip_messaging/v1/service/user_spec.rb +151 -1
- data/spec/integration/ip_messaging/v1/service_spec.rb +177 -1
- data/spec/integration/notifications/v1/service/binding_spec.rb +210 -0
- data/spec/integration/notifications/v1/service/notification_spec.rb +57 -0
- data/spec/integration/notifications/v1/service_spec.rb +244 -0
- metadata +14 -3
@@ -22,6 +22,38 @@ describe 'Service' do
|
|
22
22
|
))).to eq(true)
|
23
23
|
end
|
24
24
|
|
25
|
+
it "receives fetch responses" do
|
26
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
27
|
+
200,
|
28
|
+
%q[
|
29
|
+
{
|
30
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
31
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
32
|
+
"friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
|
33
|
+
"date_created": "2015-12-16T17:53:05Z",
|
34
|
+
"date_updated": "2015-12-16T17:53:05Z",
|
35
|
+
"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
+
"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"read_status_enabled": true,
|
39
|
+
"typing_indicator_timeout": 5,
|
40
|
+
"consumption_report_interval": 10,
|
41
|
+
"webhooks": {},
|
42
|
+
"url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
43
|
+
"links": {
|
44
|
+
"channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
|
45
|
+
"roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
46
|
+
"users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
]
|
50
|
+
))
|
51
|
+
|
52
|
+
actual = @client.ip_messaging.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
53
|
+
|
54
|
+
expect(actual).to_not eq(nil)
|
55
|
+
end
|
56
|
+
|
25
57
|
it "can delete" do
|
26
58
|
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
27
59
|
|
@@ -32,11 +64,22 @@ describe 'Service' do
|
|
32
64
|
values = {}
|
33
65
|
expect(
|
34
66
|
@holodeck.has_request?(Holodeck::Request.new(
|
35
|
-
method: '
|
67
|
+
method: 'delete',
|
36
68
|
url: 'https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
37
69
|
))).to eq(true)
|
38
70
|
end
|
39
71
|
|
72
|
+
it "receives delete responses" do
|
73
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
74
|
+
204,
|
75
|
+
nil,
|
76
|
+
))
|
77
|
+
|
78
|
+
actual = @client.ip_messaging.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
79
|
+
|
80
|
+
expect(actual).to eq(true)
|
81
|
+
end
|
82
|
+
|
40
83
|
it "can create" do
|
41
84
|
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
42
85
|
|
@@ -55,6 +98,38 @@ describe 'Service' do
|
|
55
98
|
))).to eq(true)
|
56
99
|
end
|
57
100
|
|
101
|
+
it "receives create responses" do
|
102
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
103
|
+
201,
|
104
|
+
%q[
|
105
|
+
{
|
106
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
107
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
108
|
+
"friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
|
109
|
+
"date_created": "2015-12-16T17:53:05Z",
|
110
|
+
"date_updated": "2015-12-16T17:53:05Z",
|
111
|
+
"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
112
|
+
"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
113
|
+
"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
114
|
+
"read_status_enabled": true,
|
115
|
+
"typing_indicator_timeout": 5,
|
116
|
+
"consumption_report_interval": 10,
|
117
|
+
"webhooks": {},
|
118
|
+
"url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
119
|
+
"links": {
|
120
|
+
"channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
|
121
|
+
"roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
122
|
+
"users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
|
123
|
+
}
|
124
|
+
}
|
125
|
+
]
|
126
|
+
))
|
127
|
+
|
128
|
+
actual = @client.ip_messaging.v1.services.create(friendly_name: "friendly_name")
|
129
|
+
|
130
|
+
expect(actual).to_not eq(nil)
|
131
|
+
end
|
132
|
+
|
58
133
|
it "can read" do
|
59
134
|
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
60
135
|
|
@@ -70,6 +145,75 @@ describe 'Service' do
|
|
70
145
|
))).to eq(true)
|
71
146
|
end
|
72
147
|
|
148
|
+
it "receives read_full responses" do
|
149
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
150
|
+
200,
|
151
|
+
%q[
|
152
|
+
{
|
153
|
+
"meta": {
|
154
|
+
"page": 0,
|
155
|
+
"page_size": 1,
|
156
|
+
"first_page_url": "https://ip-messaging.twilio.com/v1/Services?PageSize=1&Page=0",
|
157
|
+
"previous_page_url": null,
|
158
|
+
"url": "https://ip-messaging.twilio.com/v1/Services?PageSize=1&Page=0",
|
159
|
+
"next_page_url": null,
|
160
|
+
"key": "services"
|
161
|
+
},
|
162
|
+
"services": [
|
163
|
+
{
|
164
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
165
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
166
|
+
"friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
|
167
|
+
"date_created": "2015-12-16T17:53:05Z",
|
168
|
+
"date_updated": "2015-12-16T17:53:05Z",
|
169
|
+
"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
170
|
+
"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
171
|
+
"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
172
|
+
"read_status_enabled": true,
|
173
|
+
"typing_indicator_timeout": 5,
|
174
|
+
"consumption_report_interval": 10,
|
175
|
+
"webhooks": {},
|
176
|
+
"url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
177
|
+
"links": {
|
178
|
+
"channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
|
179
|
+
"roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
180
|
+
"users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
|
181
|
+
}
|
182
|
+
}
|
183
|
+
]
|
184
|
+
}
|
185
|
+
]
|
186
|
+
))
|
187
|
+
|
188
|
+
actual = @client.ip_messaging.v1.services.list()
|
189
|
+
|
190
|
+
expect(actual).to_not eq(nil)
|
191
|
+
end
|
192
|
+
|
193
|
+
it "receives read_empty responses" do
|
194
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
195
|
+
200,
|
196
|
+
%q[
|
197
|
+
{
|
198
|
+
"meta": {
|
199
|
+
"page": 0,
|
200
|
+
"page_size": 50,
|
201
|
+
"first_page_url": "https://ip-messaging.twilio.com/v1/Services?PageSize=50&Page=0",
|
202
|
+
"previous_page_url": null,
|
203
|
+
"url": "https://ip-messaging.twilio.com/v1/Services?PageSize=50&Page=0",
|
204
|
+
"next_page_url": null,
|
205
|
+
"key": "services"
|
206
|
+
},
|
207
|
+
"services": []
|
208
|
+
}
|
209
|
+
]
|
210
|
+
))
|
211
|
+
|
212
|
+
actual = @client.ip_messaging.v1.services.list()
|
213
|
+
|
214
|
+
expect(actual).to_not eq(nil)
|
215
|
+
end
|
216
|
+
|
73
217
|
it "can update" do
|
74
218
|
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
75
219
|
|
@@ -84,4 +228,36 @@ describe 'Service' do
|
|
84
228
|
url: 'https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
85
229
|
))).to eq(true)
|
86
230
|
end
|
231
|
+
|
232
|
+
it "receives update responses" do
|
233
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
234
|
+
200,
|
235
|
+
%q[
|
236
|
+
{
|
237
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
238
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
239
|
+
"friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
|
240
|
+
"date_created": "2015-12-16T17:53:05Z",
|
241
|
+
"date_updated": "2015-12-16T17:53:05Z",
|
242
|
+
"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
243
|
+
"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
244
|
+
"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
245
|
+
"read_status_enabled": true,
|
246
|
+
"typing_indicator_timeout": 5,
|
247
|
+
"consumption_report_interval": 10,
|
248
|
+
"webhooks": {},
|
249
|
+
"url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
250
|
+
"links": {
|
251
|
+
"channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
|
252
|
+
"roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
253
|
+
"users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
|
254
|
+
}
|
255
|
+
}
|
256
|
+
]
|
257
|
+
))
|
258
|
+
|
259
|
+
actual = @client.ip_messaging.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
260
|
+
|
261
|
+
expect(actual).to_not eq(nil)
|
262
|
+
end
|
87
263
|
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Binding' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
17
|
+
|
18
|
+
values = {}
|
19
|
+
expect(
|
20
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
21
|
+
method: 'get',
|
22
|
+
url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
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
|
+
"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
32
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
33
|
+
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
34
|
+
"date_created": "2016-03-24T23:24:45Z",
|
35
|
+
"date_updated": "2016-03-24T23:24:45Z",
|
36
|
+
"notification_protocol_version": "3",
|
37
|
+
"endpoint": "abcd",
|
38
|
+
"identity": "jing",
|
39
|
+
"binding_type": "apn",
|
40
|
+
"address": "1234",
|
41
|
+
"tags": [],
|
42
|
+
"url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
48
|
+
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
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.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
58
|
+
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
59
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
60
|
+
|
61
|
+
values = {}
|
62
|
+
expect(
|
63
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
64
|
+
method: 'delete',
|
65
|
+
url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
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.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
76
|
+
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
77
|
+
|
78
|
+
expect(actual).to eq(true)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "can create" do
|
82
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
83
|
+
|
84
|
+
expect {
|
85
|
+
@client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
86
|
+
.bindings.create(endpoint: "endpoint", identity: "identity", binding_type: "apn", address: "address")
|
87
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
88
|
+
|
89
|
+
values = {
|
90
|
+
'Endpoint' => "endpoint",
|
91
|
+
'Identity' => "identity",
|
92
|
+
'BindingType' => "apn",
|
93
|
+
'Address' => "address",
|
94
|
+
}
|
95
|
+
expect(
|
96
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
97
|
+
method: 'post',
|
98
|
+
url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings',
|
99
|
+
data: values,
|
100
|
+
))).to eq(true)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "receives create responses" do
|
104
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
105
|
+
201,
|
106
|
+
%q[
|
107
|
+
{
|
108
|
+
"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
109
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
110
|
+
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
111
|
+
"date_created": "2016-03-24T23:24:45Z",
|
112
|
+
"date_updated": "2016-03-24T23:24:45Z",
|
113
|
+
"notification_protocol_version": "3",
|
114
|
+
"endpoint": "abcd",
|
115
|
+
"identity": "jing",
|
116
|
+
"binding_type": "apn",
|
117
|
+
"address": "1234",
|
118
|
+
"tags": [],
|
119
|
+
"url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
120
|
+
}
|
121
|
+
]
|
122
|
+
))
|
123
|
+
|
124
|
+
actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
125
|
+
.bindings.create(endpoint: "endpoint", identity: "identity", binding_type: "apn", address: "address")
|
126
|
+
|
127
|
+
expect(actual).to_not eq(nil)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "can read" do
|
131
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
132
|
+
|
133
|
+
expect {
|
134
|
+
@client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
135
|
+
.bindings.list()
|
136
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
137
|
+
|
138
|
+
values = {}
|
139
|
+
expect(
|
140
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
141
|
+
method: 'get',
|
142
|
+
url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings',
|
143
|
+
))).to eq(true)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "receives read_full responses" do
|
147
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
148
|
+
200,
|
149
|
+
%q[
|
150
|
+
{
|
151
|
+
"meta": {
|
152
|
+
"page": 0,
|
153
|
+
"page_size": 1,
|
154
|
+
"first_page_url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0",
|
155
|
+
"previous_page_url": null,
|
156
|
+
"url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0",
|
157
|
+
"next_page_url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=1&PageToken=PABSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
158
|
+
"key": "bindings"
|
159
|
+
},
|
160
|
+
"bindings": [
|
161
|
+
{
|
162
|
+
"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
163
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
164
|
+
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
165
|
+
"date_created": "2016-03-24T23:24:45Z",
|
166
|
+
"date_updated": "2016-03-24T23:24:45Z",
|
167
|
+
"notification_protocol_version": "3",
|
168
|
+
"endpoint": "abcd",
|
169
|
+
"identity": "jing",
|
170
|
+
"binding_type": "apn",
|
171
|
+
"address": "1234",
|
172
|
+
"tags": [],
|
173
|
+
"url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
174
|
+
}
|
175
|
+
]
|
176
|
+
}
|
177
|
+
]
|
178
|
+
))
|
179
|
+
|
180
|
+
actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
181
|
+
.bindings.list()
|
182
|
+
|
183
|
+
expect(actual).to_not eq(nil)
|
184
|
+
end
|
185
|
+
|
186
|
+
it "receives read_empty responses" do
|
187
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
188
|
+
200,
|
189
|
+
%q[
|
190
|
+
{
|
191
|
+
"meta": {
|
192
|
+
"page": 0,
|
193
|
+
"page_size": 1,
|
194
|
+
"first_page_url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0",
|
195
|
+
"previous_page_url": null,
|
196
|
+
"url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0",
|
197
|
+
"next_page_url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=1&PageToken=PABSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
198
|
+
"key": "bindings"
|
199
|
+
},
|
200
|
+
"bindings": []
|
201
|
+
}
|
202
|
+
]
|
203
|
+
))
|
204
|
+
|
205
|
+
actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
206
|
+
.bindings.list()
|
207
|
+
|
208
|
+
expect(actual).to_not eq(nil)
|
209
|
+
end
|
210
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Notification' do
|
10
|
+
it "can create" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.notifications.create()
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
17
|
+
|
18
|
+
values = {}
|
19
|
+
expect(
|
20
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
21
|
+
method: 'post',
|
22
|
+
url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives create responses" do
|
27
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
28
|
+
201,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"sid": "NOb8021351170b4e1286adaac3fdd6d082",
|
32
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
33
|
+
"service_sid": "IS699b53e02da45a1ba9d13b7d7d2766af",
|
34
|
+
"date_created": "2016-03-24T23:42:28Z",
|
35
|
+
"identities": [
|
36
|
+
"jing"
|
37
|
+
],
|
38
|
+
"tags": [],
|
39
|
+
"priority": "high",
|
40
|
+
"ttl": 2419200,
|
41
|
+
"title": "test",
|
42
|
+
"body": "body",
|
43
|
+
"sound": null,
|
44
|
+
"action": null,
|
45
|
+
"data": null,
|
46
|
+
"apn": null,
|
47
|
+
"gcm": null
|
48
|
+
}
|
49
|
+
]
|
50
|
+
))
|
51
|
+
|
52
|
+
actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
53
|
+
.notifications.create()
|
54
|
+
|
55
|
+
expect(actual).to_not eq(nil)
|
56
|
+
end
|
57
|
+
end
|