twilio-ruby 5.11.2 → 5.12.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 +20 -0
- data/Makefile +2 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +13 -6
- data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +10 -4
- data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +18 -6
- data/lib/twilio-ruby/rest/chat/v2/service/user.rb +7 -3
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +13 -6
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +10 -4
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +18 -6
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +7 -3
- data/lib/twilio-ruby/rest/notify/v1/service.rb +0 -46
- data/lib/twilio-ruby/rest/preview.rb +13 -20
- data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
- data/lib/twilio-ruby/rest/preview/understand/assistant/intent.rb +16 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_statistics.rb +226 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +102 -50
- data/lib/twilio-ruby/rest/video.rb +9 -9
- data/lib/twilio-ruby/rest/video/v1.rb +16 -16
- data/lib/twilio-ruby/twiml/voice_response.rb +42 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/chat/v2/service/channel/message_spec.rb +1 -1
- data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +1 -1
- data/spec/integration/preview/understand/assistant/intent/intent_statistics_spec.rb +50 -0
- data/spec/integration/preview/understand/assistant/intent_spec.rb +8 -4
- data/spec/integration/taskrouter/v1/workspace/task/reservation_spec.rb +31 -0
- metadata +6 -37
- data/lib/twilio-ruby/rest/notify/v1/service/segment.rb +0 -225
- data/lib/twilio-ruby/rest/notify/v1/service/user.rb +0 -438
- data/lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb +0 -262
- data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +0 -438
- data/lib/twilio-ruby/rest/preview/proxy.rb +0 -43
- data/lib/twilio-ruby/rest/preview/proxy/service.rb +0 -464
- data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +0 -347
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +0 -497
- data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +0 -437
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +0 -514
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +0 -455
- data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +0 -342
- data/spec/integration/notify/v1/service/segment_spec.rb +0 -86
- data/spec/integration/notify/v1/service/user/segment_memberships_spec.rb +0 -118
- data/spec/integration/notify/v1/service/user/user_binding_spec.rb +0 -268
- data/spec/integration/notify/v1/service/user_spec.rb +0 -213
- data/spec/integration/preview/proxy/service/phone_number_spec.rb +0 -173
- data/spec/integration/preview/proxy/service/session/interaction_spec.rb +0 -106
- data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +0 -166
- data/spec/integration/preview/proxy/service/session/participant_spec.rb +0 -226
- data/spec/integration/preview/proxy/service/session_spec.rb +0 -218
- data/spec/integration/preview/proxy/service/short_code_spec.rb +0 -173
- data/spec/integration/preview/proxy/service_spec.rb +0 -202
@@ -1,342 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# \ / _ _ _| _ _
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
-
# / /
|
6
|
-
#
|
7
|
-
# frozen_string_literal: true
|
8
|
-
|
9
|
-
module Twilio
|
10
|
-
module REST
|
11
|
-
class Preview < Domain
|
12
|
-
class Proxy < Version
|
13
|
-
class ServiceContext < InstanceContext
|
14
|
-
##
|
15
|
-
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
16
|
-
class ShortCodeList < ListResource
|
17
|
-
##
|
18
|
-
# Initialize the ShortCodeList
|
19
|
-
# @param [Version] version Version that contains the resource
|
20
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
21
|
-
# @return [ShortCodeList] ShortCodeList
|
22
|
-
def initialize(version, service_sid: nil)
|
23
|
-
super(version)
|
24
|
-
|
25
|
-
# Path Solution
|
26
|
-
@solution = {service_sid: service_sid}
|
27
|
-
@uri = "/Services/#{@solution[:service_sid]}/ShortCodes"
|
28
|
-
end
|
29
|
-
|
30
|
-
##
|
31
|
-
# Retrieve a single page of ShortCodeInstance records from the API.
|
32
|
-
# Request is executed immediately.
|
33
|
-
# @param [String] sid The shortcode Sid that uniquely identifies this resource
|
34
|
-
# @return [ShortCodeInstance] Newly created ShortCodeInstance
|
35
|
-
def create(sid: nil)
|
36
|
-
data = Twilio::Values.of({'Sid' => sid, })
|
37
|
-
|
38
|
-
payload = @version.create(
|
39
|
-
'POST',
|
40
|
-
@uri,
|
41
|
-
data: data
|
42
|
-
)
|
43
|
-
|
44
|
-
ShortCodeInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
45
|
-
end
|
46
|
-
|
47
|
-
##
|
48
|
-
# Lists ShortCodeInstance records from the API as a list.
|
49
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
50
|
-
# memory before returning.
|
51
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
52
|
-
# guarantees to never return more than limit. Default is no limit
|
53
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
54
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
55
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
56
|
-
# efficient page size, i.e. min(limit, 1000)
|
57
|
-
# @return [Array] Array of up to limit results
|
58
|
-
def list(limit: nil, page_size: nil)
|
59
|
-
self.stream(limit: limit, page_size: page_size).entries
|
60
|
-
end
|
61
|
-
|
62
|
-
##
|
63
|
-
# Streams ShortCodeInstance records from the API as an Enumerable.
|
64
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
65
|
-
# is reached.
|
66
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
67
|
-
# guarantees to never return more than limit. Default is no limit.
|
68
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
69
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
70
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
71
|
-
# efficient page size, i.e. min(limit, 1000)
|
72
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
73
|
-
def stream(limit: nil, page_size: nil)
|
74
|
-
limits = @version.read_limits(limit, page_size)
|
75
|
-
|
76
|
-
page = self.page(page_size: limits[:page_size], )
|
77
|
-
|
78
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
79
|
-
end
|
80
|
-
|
81
|
-
##
|
82
|
-
# When passed a block, yields ShortCodeInstance records from the API.
|
83
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
84
|
-
# is reached.
|
85
|
-
def each
|
86
|
-
limits = @version.read_limits
|
87
|
-
|
88
|
-
page = self.page(page_size: limits[:page_size], )
|
89
|
-
|
90
|
-
@version.stream(page,
|
91
|
-
limit: limits[:limit],
|
92
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
# Retrieve a single page of ShortCodeInstance records from the API.
|
97
|
-
# Request is executed immediately.
|
98
|
-
# @param [String] page_token PageToken provided by the API
|
99
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
100
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
101
|
-
# @return [Page] Page of ShortCodeInstance
|
102
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
103
|
-
params = Twilio::Values.of({
|
104
|
-
'PageToken' => page_token,
|
105
|
-
'Page' => page_number,
|
106
|
-
'PageSize' => page_size,
|
107
|
-
})
|
108
|
-
response = @version.page(
|
109
|
-
'GET',
|
110
|
-
@uri,
|
111
|
-
params
|
112
|
-
)
|
113
|
-
ShortCodePage.new(@version, response, @solution)
|
114
|
-
end
|
115
|
-
|
116
|
-
##
|
117
|
-
# Retrieve a single page of ShortCodeInstance records from the API.
|
118
|
-
# Request is executed immediately.
|
119
|
-
# @param [String] target_url API-generated URL for the requested results page
|
120
|
-
# @return [Page] Page of ShortCodeInstance
|
121
|
-
def get_page(target_url)
|
122
|
-
response = @version.domain.request(
|
123
|
-
'GET',
|
124
|
-
target_url
|
125
|
-
)
|
126
|
-
ShortCodePage.new(@version, response, @solution)
|
127
|
-
end
|
128
|
-
|
129
|
-
##
|
130
|
-
# Provide a user friendly representation
|
131
|
-
def to_s
|
132
|
-
'#<Twilio.Preview.Proxy.ShortCodeList>'
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
##
|
137
|
-
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
138
|
-
class ShortCodePage < Page
|
139
|
-
##
|
140
|
-
# Initialize the ShortCodePage
|
141
|
-
# @param [Version] version Version that contains the resource
|
142
|
-
# @param [Response] response Response from the API
|
143
|
-
# @param [Hash] solution Path solution for the resource
|
144
|
-
# @return [ShortCodePage] ShortCodePage
|
145
|
-
def initialize(version, response, solution)
|
146
|
-
super(version, response)
|
147
|
-
|
148
|
-
# Path Solution
|
149
|
-
@solution = solution
|
150
|
-
end
|
151
|
-
|
152
|
-
##
|
153
|
-
# Build an instance of ShortCodeInstance
|
154
|
-
# @param [Hash] payload Payload response from the API
|
155
|
-
# @return [ShortCodeInstance] ShortCodeInstance
|
156
|
-
def get_instance(payload)
|
157
|
-
ShortCodeInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
158
|
-
end
|
159
|
-
|
160
|
-
##
|
161
|
-
# Provide a user friendly representation
|
162
|
-
def to_s
|
163
|
-
'<Twilio.Preview.Proxy.ShortCodePage>'
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
##
|
168
|
-
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
169
|
-
class ShortCodeContext < InstanceContext
|
170
|
-
##
|
171
|
-
# Initialize the ShortCodeContext
|
172
|
-
# @param [Version] version Version that contains the resource
|
173
|
-
# @param [String] service_sid The service_sid
|
174
|
-
# @param [String] sid The shortcode Sid that uniquely identifies this resource
|
175
|
-
# @return [ShortCodeContext] ShortCodeContext
|
176
|
-
def initialize(version, service_sid, sid)
|
177
|
-
super(version)
|
178
|
-
|
179
|
-
# Path Solution
|
180
|
-
@solution = {service_sid: service_sid, sid: sid, }
|
181
|
-
@uri = "/Services/#{@solution[:service_sid]}/ShortCodes/#{@solution[:sid]}"
|
182
|
-
end
|
183
|
-
|
184
|
-
##
|
185
|
-
# Deletes the ShortCodeInstance
|
186
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
187
|
-
def delete
|
188
|
-
@version.delete('delete', @uri)
|
189
|
-
end
|
190
|
-
|
191
|
-
##
|
192
|
-
# Fetch a ShortCodeInstance
|
193
|
-
# @return [ShortCodeInstance] Fetched ShortCodeInstance
|
194
|
-
def fetch
|
195
|
-
params = Twilio::Values.of({})
|
196
|
-
|
197
|
-
payload = @version.fetch(
|
198
|
-
'GET',
|
199
|
-
@uri,
|
200
|
-
params,
|
201
|
-
)
|
202
|
-
|
203
|
-
ShortCodeInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
|
204
|
-
end
|
205
|
-
|
206
|
-
##
|
207
|
-
# Provide a user friendly representation
|
208
|
-
def to_s
|
209
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
210
|
-
"#<Twilio.Preview.Proxy.ShortCodeContext #{context}>"
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
##
|
215
|
-
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
216
|
-
class ShortCodeInstance < InstanceResource
|
217
|
-
##
|
218
|
-
# Initialize the ShortCodeInstance
|
219
|
-
# @param [Version] version Version that contains the resource
|
220
|
-
# @param [Hash] payload payload that contains response from Twilio
|
221
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
222
|
-
# @param [String] sid The shortcode Sid that uniquely identifies this resource
|
223
|
-
# @return [ShortCodeInstance] ShortCodeInstance
|
224
|
-
def initialize(version, payload, service_sid: nil, sid: nil)
|
225
|
-
super(version)
|
226
|
-
|
227
|
-
# Marshaled Properties
|
228
|
-
@properties = {
|
229
|
-
'sid' => payload['sid'],
|
230
|
-
'account_sid' => payload['account_sid'],
|
231
|
-
'service_sid' => payload['service_sid'],
|
232
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
233
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
234
|
-
'short_code' => payload['short_code'],
|
235
|
-
'country_code' => payload['country_code'],
|
236
|
-
'capabilities' => payload['capabilities'],
|
237
|
-
'url' => payload['url'],
|
238
|
-
}
|
239
|
-
|
240
|
-
# Context
|
241
|
-
@instance_context = nil
|
242
|
-
@params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
|
243
|
-
end
|
244
|
-
|
245
|
-
##
|
246
|
-
# Generate an instance context for the instance, the context is capable of
|
247
|
-
# performing various actions. All instance actions are proxied to the context
|
248
|
-
# @return [ShortCodeContext] ShortCodeContext for this ShortCodeInstance
|
249
|
-
def context
|
250
|
-
unless @instance_context
|
251
|
-
@instance_context = ShortCodeContext.new(@version, @params['service_sid'], @params['sid'], )
|
252
|
-
end
|
253
|
-
@instance_context
|
254
|
-
end
|
255
|
-
|
256
|
-
##
|
257
|
-
# @return [String] A string that uniquely identifies this resource
|
258
|
-
def sid
|
259
|
-
@properties['sid']
|
260
|
-
end
|
261
|
-
|
262
|
-
##
|
263
|
-
# @return [String] Account Sid.
|
264
|
-
def account_sid
|
265
|
-
@properties['account_sid']
|
266
|
-
end
|
267
|
-
|
268
|
-
##
|
269
|
-
# @return [String] Service Sid.
|
270
|
-
def service_sid
|
271
|
-
@properties['service_sid']
|
272
|
-
end
|
273
|
-
|
274
|
-
##
|
275
|
-
# @return [Time] The date this resource was created
|
276
|
-
def date_created
|
277
|
-
@properties['date_created']
|
278
|
-
end
|
279
|
-
|
280
|
-
##
|
281
|
-
# @return [Time] The date this resource was last updated
|
282
|
-
def date_updated
|
283
|
-
@properties['date_updated']
|
284
|
-
end
|
285
|
-
|
286
|
-
##
|
287
|
-
# @return [String] The short code. e.g., 894546.
|
288
|
-
def short_code
|
289
|
-
@properties['short_code']
|
290
|
-
end
|
291
|
-
|
292
|
-
##
|
293
|
-
# @return [String] The ISO 3166-1 alpha-2 country code
|
294
|
-
def country_code
|
295
|
-
@properties['country_code']
|
296
|
-
end
|
297
|
-
|
298
|
-
##
|
299
|
-
# @return [Hash] Indicate if a shortcode can receive messages
|
300
|
-
def capabilities
|
301
|
-
@properties['capabilities']
|
302
|
-
end
|
303
|
-
|
304
|
-
##
|
305
|
-
# @return [String] The URL of this resource.
|
306
|
-
def url
|
307
|
-
@properties['url']
|
308
|
-
end
|
309
|
-
|
310
|
-
##
|
311
|
-
# Deletes the ShortCodeInstance
|
312
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
313
|
-
def delete
|
314
|
-
context.delete
|
315
|
-
end
|
316
|
-
|
317
|
-
##
|
318
|
-
# Fetch a ShortCodeInstance
|
319
|
-
# @return [ShortCodeInstance] Fetched ShortCodeInstance
|
320
|
-
def fetch
|
321
|
-
context.fetch
|
322
|
-
end
|
323
|
-
|
324
|
-
##
|
325
|
-
# Provide a user friendly representation
|
326
|
-
def to_s
|
327
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
328
|
-
"<Twilio.Preview.Proxy.ShortCodeInstance #{values}>"
|
329
|
-
end
|
330
|
-
|
331
|
-
##
|
332
|
-
# Provide a detailed, user friendly representation
|
333
|
-
def inspect
|
334
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
335
|
-
"<Twilio.Preview.Proxy.ShortCodeInstance #{values}>"
|
336
|
-
end
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|
342
|
-
end
|
@@ -1,86 +0,0 @@
|
|
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 'Segment' do
|
12
|
-
it "can read" do
|
13
|
-
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
-
|
15
|
-
expect {
|
16
|
-
@client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
-
.segments.list()
|
18
|
-
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
-
|
20
|
-
values = {}
|
21
|
-
expect(
|
22
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
-
method: 'get',
|
24
|
-
url: 'https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Segments',
|
25
|
-
))).to eq(true)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "receives read_empty responses" do
|
29
|
-
@holodeck.mock(Twilio::Response.new(
|
30
|
-
200,
|
31
|
-
%q[
|
32
|
-
{
|
33
|
-
"meta": {
|
34
|
-
"first_page_url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments?PageSize=50&Page=0",
|
35
|
-
"key": "segments",
|
36
|
-
"next_page_url": null,
|
37
|
-
"page": 0,
|
38
|
-
"page_size": 50,
|
39
|
-
"previous_page_url": null,
|
40
|
-
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments?PageSize=50&Page=0"
|
41
|
-
},
|
42
|
-
"segments": []
|
43
|
-
}
|
44
|
-
]
|
45
|
-
))
|
46
|
-
|
47
|
-
actual = @client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
48
|
-
.segments.list()
|
49
|
-
|
50
|
-
expect(actual).to_not eq(nil)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "receives read_full responses" do
|
54
|
-
@holodeck.mock(Twilio::Response.new(
|
55
|
-
200,
|
56
|
-
%q[
|
57
|
-
{
|
58
|
-
"segments": [
|
59
|
-
{
|
60
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
61
|
-
"date_created": "2017-02-14T14:36:41Z",
|
62
|
-
"date_updated": "2017-02-14T14:36:41Z",
|
63
|
-
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
64
|
-
"sid": "GSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
65
|
-
"unique_name": "segment"
|
66
|
-
}
|
67
|
-
],
|
68
|
-
"meta": {
|
69
|
-
"first_page_url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments?PageSize=50&Page=0",
|
70
|
-
"key": "segments",
|
71
|
-
"next_page_url": null,
|
72
|
-
"page": 0,
|
73
|
-
"page_size": 50,
|
74
|
-
"previous_page_url": null,
|
75
|
-
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments?PageSize=50&Page=0"
|
76
|
-
}
|
77
|
-
}
|
78
|
-
]
|
79
|
-
))
|
80
|
-
|
81
|
-
actual = @client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
82
|
-
.segments.list()
|
83
|
-
|
84
|
-
expect(actual).to_not eq(nil)
|
85
|
-
end
|
86
|
-
end
|
@@ -1,118 +0,0 @@
|
|
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 'SegmentMembership' do
|
12
|
-
it "can create" do
|
13
|
-
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
-
|
15
|
-
expect {
|
16
|
-
@client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
-
.users('NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
18
|
-
.segment_memberships.create(segment: 'segment')
|
19
|
-
}.to raise_exception(Twilio::REST::TwilioError)
|
20
|
-
|
21
|
-
values = {'Segment' => 'segment', }
|
22
|
-
expect(
|
23
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
24
|
-
method: 'post',
|
25
|
-
url: 'https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SegmentMemberships',
|
26
|
-
data: values,
|
27
|
-
))).to eq(true)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "receives create responses" do
|
31
|
-
@holodeck.mock(Twilio::Response.new(
|
32
|
-
201,
|
33
|
-
%q[
|
34
|
-
{
|
35
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
-
"identity": "identity",
|
37
|
-
"segment": "segment",
|
38
|
-
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
39
|
-
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/identity/SegmentMemberships/segment"
|
40
|
-
}
|
41
|
-
]
|
42
|
-
))
|
43
|
-
|
44
|
-
actual = @client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
45
|
-
.users('NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
46
|
-
.segment_memberships.create(segment: 'segment')
|
47
|
-
|
48
|
-
expect(actual).to_not eq(nil)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "can delete" do
|
52
|
-
@holodeck.mock(Twilio::Response.new(500, ''))
|
53
|
-
|
54
|
-
expect {
|
55
|
-
@client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
56
|
-
.users('NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
57
|
-
.segment_memberships('segment').delete()
|
58
|
-
}.to raise_exception(Twilio::REST::TwilioError)
|
59
|
-
|
60
|
-
values = {}
|
61
|
-
expect(
|
62
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
63
|
-
method: 'delete',
|
64
|
-
url: 'https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SegmentMemberships/segment',
|
65
|
-
))).to eq(true)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "receives delete responses" do
|
69
|
-
@holodeck.mock(Twilio::Response.new(
|
70
|
-
204,
|
71
|
-
nil,
|
72
|
-
))
|
73
|
-
|
74
|
-
actual = @client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
75
|
-
.users('NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
76
|
-
.segment_memberships('segment').delete()
|
77
|
-
|
78
|
-
expect(actual).to eq(true)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "can fetch" do
|
82
|
-
@holodeck.mock(Twilio::Response.new(500, ''))
|
83
|
-
|
84
|
-
expect {
|
85
|
-
@client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
86
|
-
.users('NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
87
|
-
.segment_memberships('segment').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://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SegmentMemberships/segment',
|
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
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
104
|
-
"identity": "identity",
|
105
|
-
"segment": "segment",
|
106
|
-
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
107
|
-
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/identity/SegmentMemberships/segment"
|
108
|
-
}
|
109
|
-
]
|
110
|
-
))
|
111
|
-
|
112
|
-
actual = @client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
113
|
-
.users('NUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
114
|
-
.segment_memberships('segment').fetch()
|
115
|
-
|
116
|
-
expect(actual).to_not eq(nil)
|
117
|
-
end
|
118
|
-
end
|