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,438 +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 Notify < Domain
|
12
|
-
class V1 < Version
|
13
|
-
class ServiceContext < InstanceContext
|
14
|
-
##
|
15
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
16
|
-
class UserList < ListResource
|
17
|
-
##
|
18
|
-
# Initialize the UserList
|
19
|
-
# @param [Version] version Version that contains the resource
|
20
|
-
# @param [String] service_sid The service_sid
|
21
|
-
# @return [UserList] UserList
|
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]}/Users"
|
28
|
-
end
|
29
|
-
|
30
|
-
##
|
31
|
-
# Retrieve a single page of UserInstance records from the API.
|
32
|
-
# Request is executed immediately.
|
33
|
-
# @param [String] identity The identifier of the User, defined by your
|
34
|
-
# application.
|
35
|
-
# @param [String] segment The list of segments this User belongs to. Segments can
|
36
|
-
# be used to select recipients of a notification. Maximum 20 Segments per User
|
37
|
-
# allowed.
|
38
|
-
# @return [UserInstance] Newly created UserInstance
|
39
|
-
def create(identity: nil, segment: :unset)
|
40
|
-
data = Twilio::Values.of({
|
41
|
-
'Identity' => identity,
|
42
|
-
'Segment' => Twilio.serialize_list(segment) { |e| e },
|
43
|
-
})
|
44
|
-
|
45
|
-
payload = @version.create(
|
46
|
-
'POST',
|
47
|
-
@uri,
|
48
|
-
data: data
|
49
|
-
)
|
50
|
-
|
51
|
-
UserInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
52
|
-
end
|
53
|
-
|
54
|
-
##
|
55
|
-
# Lists UserInstance records from the API as a list.
|
56
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
57
|
-
# memory before returning.
|
58
|
-
# @param [String] identity The identifier of the User, defined by your
|
59
|
-
# application.
|
60
|
-
# @param [String] segment The list of segments this User belongs to. Segments can
|
61
|
-
# be used to select recipients of a notification. Maximum 20 Segments per User
|
62
|
-
# allowed.
|
63
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
64
|
-
# guarantees to never return more than limit. Default is no limit
|
65
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
66
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
67
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
68
|
-
# efficient page size, i.e. min(limit, 1000)
|
69
|
-
# @return [Array] Array of up to limit results
|
70
|
-
def list(identity: :unset, segment: :unset, limit: nil, page_size: nil)
|
71
|
-
self.stream(identity: identity, segment: segment, limit: limit, page_size: page_size).entries
|
72
|
-
end
|
73
|
-
|
74
|
-
##
|
75
|
-
# Streams UserInstance records from the API as an Enumerable.
|
76
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
77
|
-
# is reached.
|
78
|
-
# @param [String] identity The identifier of the User, defined by your
|
79
|
-
# application.
|
80
|
-
# @param [String] segment The list of segments this User belongs to. Segments can
|
81
|
-
# be used to select recipients of a notification. Maximum 20 Segments per User
|
82
|
-
# allowed.
|
83
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
84
|
-
# guarantees to never return more than limit. Default is no limit.
|
85
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
86
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
87
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
88
|
-
# efficient page size, i.e. min(limit, 1000)
|
89
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
90
|
-
def stream(identity: :unset, segment: :unset, limit: nil, page_size: nil)
|
91
|
-
limits = @version.read_limits(limit, page_size)
|
92
|
-
|
93
|
-
page = self.page(identity: identity, segment: segment, page_size: limits[:page_size], )
|
94
|
-
|
95
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
96
|
-
end
|
97
|
-
|
98
|
-
##
|
99
|
-
# When passed a block, yields UserInstance records from the API.
|
100
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
101
|
-
# is reached.
|
102
|
-
def each
|
103
|
-
limits = @version.read_limits
|
104
|
-
|
105
|
-
page = self.page(page_size: limits[:page_size], )
|
106
|
-
|
107
|
-
@version.stream(page,
|
108
|
-
limit: limits[:limit],
|
109
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
110
|
-
end
|
111
|
-
|
112
|
-
##
|
113
|
-
# Retrieve a single page of UserInstance records from the API.
|
114
|
-
# Request is executed immediately.
|
115
|
-
# @param [String] identity The identifier of the User, defined by your
|
116
|
-
# application.
|
117
|
-
# @param [String] segment The list of segments this User belongs to. Segments can
|
118
|
-
# be used to select recipients of a notification. Maximum 20 Segments per User
|
119
|
-
# allowed.
|
120
|
-
# @param [String] page_token PageToken provided by the API
|
121
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
122
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
123
|
-
# @return [Page] Page of UserInstance
|
124
|
-
def page(identity: :unset, segment: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
125
|
-
params = Twilio::Values.of({
|
126
|
-
'Identity' => Twilio.serialize_list(identity) { |e| e },
|
127
|
-
'Segment' => segment,
|
128
|
-
'PageToken' => page_token,
|
129
|
-
'Page' => page_number,
|
130
|
-
'PageSize' => page_size,
|
131
|
-
})
|
132
|
-
response = @version.page(
|
133
|
-
'GET',
|
134
|
-
@uri,
|
135
|
-
params
|
136
|
-
)
|
137
|
-
UserPage.new(@version, response, @solution)
|
138
|
-
end
|
139
|
-
|
140
|
-
##
|
141
|
-
# Retrieve a single page of UserInstance records from the API.
|
142
|
-
# Request is executed immediately.
|
143
|
-
# @param [String] target_url API-generated URL for the requested results page
|
144
|
-
# @return [Page] Page of UserInstance
|
145
|
-
def get_page(target_url)
|
146
|
-
response = @version.domain.request(
|
147
|
-
'GET',
|
148
|
-
target_url
|
149
|
-
)
|
150
|
-
UserPage.new(@version, response, @solution)
|
151
|
-
end
|
152
|
-
|
153
|
-
##
|
154
|
-
# Provide a user friendly representation
|
155
|
-
def to_s
|
156
|
-
'#<Twilio.Notify.V1.UserList>'
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
##
|
161
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
162
|
-
class UserPage < Page
|
163
|
-
##
|
164
|
-
# Initialize the UserPage
|
165
|
-
# @param [Version] version Version that contains the resource
|
166
|
-
# @param [Response] response Response from the API
|
167
|
-
# @param [Hash] solution Path solution for the resource
|
168
|
-
# @return [UserPage] UserPage
|
169
|
-
def initialize(version, response, solution)
|
170
|
-
super(version, response)
|
171
|
-
|
172
|
-
# Path Solution
|
173
|
-
@solution = solution
|
174
|
-
end
|
175
|
-
|
176
|
-
##
|
177
|
-
# Build an instance of UserInstance
|
178
|
-
# @param [Hash] payload Payload response from the API
|
179
|
-
# @return [UserInstance] UserInstance
|
180
|
-
def get_instance(payload)
|
181
|
-
UserInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
182
|
-
end
|
183
|
-
|
184
|
-
##
|
185
|
-
# Provide a user friendly representation
|
186
|
-
def to_s
|
187
|
-
'<Twilio.Notify.V1.UserPage>'
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
##
|
192
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
193
|
-
class UserContext < InstanceContext
|
194
|
-
##
|
195
|
-
# Initialize the UserContext
|
196
|
-
# @param [Version] version Version that contains the resource
|
197
|
-
# @param [String] service_sid The service_sid
|
198
|
-
# @param [String] identity The identity
|
199
|
-
# @return [UserContext] UserContext
|
200
|
-
def initialize(version, service_sid, identity)
|
201
|
-
super(version)
|
202
|
-
|
203
|
-
# Path Solution
|
204
|
-
@solution = {service_sid: service_sid, identity: identity, }
|
205
|
-
@uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}"
|
206
|
-
|
207
|
-
# Dependents
|
208
|
-
@bindings = nil
|
209
|
-
@segment_memberships = nil
|
210
|
-
end
|
211
|
-
|
212
|
-
##
|
213
|
-
# Deletes the UserInstance
|
214
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
215
|
-
def delete
|
216
|
-
@version.delete('delete', @uri)
|
217
|
-
end
|
218
|
-
|
219
|
-
##
|
220
|
-
# Fetch a UserInstance
|
221
|
-
# @return [UserInstance] Fetched UserInstance
|
222
|
-
def fetch
|
223
|
-
params = Twilio::Values.of({})
|
224
|
-
|
225
|
-
payload = @version.fetch(
|
226
|
-
'GET',
|
227
|
-
@uri,
|
228
|
-
params,
|
229
|
-
)
|
230
|
-
|
231
|
-
UserInstance.new(
|
232
|
-
@version,
|
233
|
-
payload,
|
234
|
-
service_sid: @solution[:service_sid],
|
235
|
-
identity: @solution[:identity],
|
236
|
-
)
|
237
|
-
end
|
238
|
-
|
239
|
-
##
|
240
|
-
# Access the bindings
|
241
|
-
# @return [UserBindingList]
|
242
|
-
# @return [UserBindingContext] if sid was passed.
|
243
|
-
def bindings(sid=:unset)
|
244
|
-
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
245
|
-
|
246
|
-
if sid != :unset
|
247
|
-
return UserBindingContext.new(@version, @solution[:service_sid], @solution[:identity], sid, )
|
248
|
-
end
|
249
|
-
|
250
|
-
unless @bindings
|
251
|
-
@bindings = UserBindingList.new(
|
252
|
-
@version,
|
253
|
-
service_sid: @solution[:service_sid],
|
254
|
-
identity: @solution[:identity],
|
255
|
-
)
|
256
|
-
end
|
257
|
-
|
258
|
-
@bindings
|
259
|
-
end
|
260
|
-
|
261
|
-
##
|
262
|
-
# Access the segment_memberships
|
263
|
-
# @return [SegmentMembershipList]
|
264
|
-
# @return [SegmentMembershipContext] if segment was passed.
|
265
|
-
def segment_memberships(segment=:unset)
|
266
|
-
raise ArgumentError, 'segment cannot be nil' if segment.nil?
|
267
|
-
|
268
|
-
if segment != :unset
|
269
|
-
return SegmentMembershipContext.new(
|
270
|
-
@version,
|
271
|
-
@solution[:service_sid],
|
272
|
-
@solution[:identity],
|
273
|
-
segment,
|
274
|
-
)
|
275
|
-
end
|
276
|
-
|
277
|
-
unless @segment_memberships
|
278
|
-
@segment_memberships = SegmentMembershipList.new(
|
279
|
-
@version,
|
280
|
-
service_sid: @solution[:service_sid],
|
281
|
-
identity: @solution[:identity],
|
282
|
-
)
|
283
|
-
end
|
284
|
-
|
285
|
-
@segment_memberships
|
286
|
-
end
|
287
|
-
|
288
|
-
##
|
289
|
-
# Provide a user friendly representation
|
290
|
-
def to_s
|
291
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
292
|
-
"#<Twilio.Notify.V1.UserContext #{context}>"
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
##
|
297
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
298
|
-
class UserInstance < InstanceResource
|
299
|
-
##
|
300
|
-
# Initialize the UserInstance
|
301
|
-
# @param [Version] version Version that contains the resource
|
302
|
-
# @param [Hash] payload payload that contains response from Twilio
|
303
|
-
# @param [String] service_sid The service_sid
|
304
|
-
# @param [String] identity The identity
|
305
|
-
# @return [UserInstance] UserInstance
|
306
|
-
def initialize(version, payload, service_sid: nil, identity: nil)
|
307
|
-
super(version)
|
308
|
-
|
309
|
-
# Marshaled Properties
|
310
|
-
@properties = {
|
311
|
-
'sid' => payload['sid'],
|
312
|
-
'account_sid' => payload['account_sid'],
|
313
|
-
'service_sid' => payload['service_sid'],
|
314
|
-
'identity' => payload['identity'],
|
315
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
316
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
317
|
-
'segments' => payload['segments'],
|
318
|
-
'url' => payload['url'],
|
319
|
-
'links' => payload['links'],
|
320
|
-
}
|
321
|
-
|
322
|
-
# Context
|
323
|
-
@instance_context = nil
|
324
|
-
@params = {'service_sid' => service_sid, 'identity' => identity || @properties['identity'], }
|
325
|
-
end
|
326
|
-
|
327
|
-
##
|
328
|
-
# Generate an instance context for the instance, the context is capable of
|
329
|
-
# performing various actions. All instance actions are proxied to the context
|
330
|
-
# @return [UserContext] UserContext for this UserInstance
|
331
|
-
def context
|
332
|
-
unless @instance_context
|
333
|
-
@instance_context = UserContext.new(@version, @params['service_sid'], @params['identity'], )
|
334
|
-
end
|
335
|
-
@instance_context
|
336
|
-
end
|
337
|
-
|
338
|
-
##
|
339
|
-
# @return [String] The sid
|
340
|
-
def sid
|
341
|
-
@properties['sid']
|
342
|
-
end
|
343
|
-
|
344
|
-
##
|
345
|
-
# @return [String] The account_sid
|
346
|
-
def account_sid
|
347
|
-
@properties['account_sid']
|
348
|
-
end
|
349
|
-
|
350
|
-
##
|
351
|
-
# @return [String] The service_sid
|
352
|
-
def service_sid
|
353
|
-
@properties['service_sid']
|
354
|
-
end
|
355
|
-
|
356
|
-
##
|
357
|
-
# @return [String] The identifier of the User, defined by your application.
|
358
|
-
def identity
|
359
|
-
@properties['identity']
|
360
|
-
end
|
361
|
-
|
362
|
-
##
|
363
|
-
# @return [Time] The date_created
|
364
|
-
def date_created
|
365
|
-
@properties['date_created']
|
366
|
-
end
|
367
|
-
|
368
|
-
##
|
369
|
-
# @return [Time] The date_updated
|
370
|
-
def date_updated
|
371
|
-
@properties['date_updated']
|
372
|
-
end
|
373
|
-
|
374
|
-
##
|
375
|
-
# @return [String] The segments
|
376
|
-
def segments
|
377
|
-
@properties['segments']
|
378
|
-
end
|
379
|
-
|
380
|
-
##
|
381
|
-
# @return [String] The url
|
382
|
-
def url
|
383
|
-
@properties['url']
|
384
|
-
end
|
385
|
-
|
386
|
-
##
|
387
|
-
# @return [String] The links
|
388
|
-
def links
|
389
|
-
@properties['links']
|
390
|
-
end
|
391
|
-
|
392
|
-
##
|
393
|
-
# Deletes the UserInstance
|
394
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
395
|
-
def delete
|
396
|
-
context.delete
|
397
|
-
end
|
398
|
-
|
399
|
-
##
|
400
|
-
# Fetch a UserInstance
|
401
|
-
# @return [UserInstance] Fetched UserInstance
|
402
|
-
def fetch
|
403
|
-
context.fetch
|
404
|
-
end
|
405
|
-
|
406
|
-
##
|
407
|
-
# Access the bindings
|
408
|
-
# @return [bindings] bindings
|
409
|
-
def bindings
|
410
|
-
context.bindings
|
411
|
-
end
|
412
|
-
|
413
|
-
##
|
414
|
-
# Access the segment_memberships
|
415
|
-
# @return [segment_memberships] segment_memberships
|
416
|
-
def segment_memberships
|
417
|
-
context.segment_memberships
|
418
|
-
end
|
419
|
-
|
420
|
-
##
|
421
|
-
# Provide a user friendly representation
|
422
|
-
def to_s
|
423
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
424
|
-
"<Twilio.Notify.V1.UserInstance #{values}>"
|
425
|
-
end
|
426
|
-
|
427
|
-
##
|
428
|
-
# Provide a detailed, user friendly representation
|
429
|
-
def inspect
|
430
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
431
|
-
"<Twilio.Notify.V1.UserInstance #{values}>"
|
432
|
-
end
|
433
|
-
end
|
434
|
-
end
|
435
|
-
end
|
436
|
-
end
|
437
|
-
end
|
438
|
-
end
|
@@ -1,262 +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 Notify < Domain
|
12
|
-
class V1 < Version
|
13
|
-
class ServiceContext < InstanceContext
|
14
|
-
class UserContext < InstanceContext
|
15
|
-
##
|
16
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
17
|
-
class SegmentMembershipList < ListResource
|
18
|
-
##
|
19
|
-
# Initialize the SegmentMembershipList
|
20
|
-
# @param [Version] version Version that contains the resource
|
21
|
-
# @param [String] service_sid The service_sid
|
22
|
-
# @param [String] identity The identity
|
23
|
-
# @return [SegmentMembershipList] SegmentMembershipList
|
24
|
-
def initialize(version, service_sid: nil, identity: nil)
|
25
|
-
super(version)
|
26
|
-
|
27
|
-
# Path Solution
|
28
|
-
@solution = {service_sid: service_sid, identity: identity}
|
29
|
-
@uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}/SegmentMemberships"
|
30
|
-
end
|
31
|
-
|
32
|
-
##
|
33
|
-
# Retrieve a single page of SegmentMembershipInstance records from the API.
|
34
|
-
# Request is executed immediately.
|
35
|
-
# @param [String] segment The segment
|
36
|
-
# @return [SegmentMembershipInstance] Newly created SegmentMembershipInstance
|
37
|
-
def create(segment: nil)
|
38
|
-
data = Twilio::Values.of({'Segment' => segment, })
|
39
|
-
|
40
|
-
payload = @version.create(
|
41
|
-
'POST',
|
42
|
-
@uri,
|
43
|
-
data: data
|
44
|
-
)
|
45
|
-
|
46
|
-
SegmentMembershipInstance.new(
|
47
|
-
@version,
|
48
|
-
payload,
|
49
|
-
service_sid: @solution[:service_sid],
|
50
|
-
identity: @solution[:identity],
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
##
|
55
|
-
# Provide a user friendly representation
|
56
|
-
def to_s
|
57
|
-
'#<Twilio.Notify.V1.SegmentMembershipList>'
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
##
|
62
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
63
|
-
class SegmentMembershipPage < Page
|
64
|
-
##
|
65
|
-
# Initialize the SegmentMembershipPage
|
66
|
-
# @param [Version] version Version that contains the resource
|
67
|
-
# @param [Response] response Response from the API
|
68
|
-
# @param [Hash] solution Path solution for the resource
|
69
|
-
# @return [SegmentMembershipPage] SegmentMembershipPage
|
70
|
-
def initialize(version, response, solution)
|
71
|
-
super(version, response)
|
72
|
-
|
73
|
-
# Path Solution
|
74
|
-
@solution = solution
|
75
|
-
end
|
76
|
-
|
77
|
-
##
|
78
|
-
# Build an instance of SegmentMembershipInstance
|
79
|
-
# @param [Hash] payload Payload response from the API
|
80
|
-
# @return [SegmentMembershipInstance] SegmentMembershipInstance
|
81
|
-
def get_instance(payload)
|
82
|
-
SegmentMembershipInstance.new(
|
83
|
-
@version,
|
84
|
-
payload,
|
85
|
-
service_sid: @solution[:service_sid],
|
86
|
-
identity: @solution[:identity],
|
87
|
-
)
|
88
|
-
end
|
89
|
-
|
90
|
-
##
|
91
|
-
# Provide a user friendly representation
|
92
|
-
def to_s
|
93
|
-
'<Twilio.Notify.V1.SegmentMembershipPage>'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
##
|
98
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
99
|
-
class SegmentMembershipContext < InstanceContext
|
100
|
-
##
|
101
|
-
# Initialize the SegmentMembershipContext
|
102
|
-
# @param [Version] version Version that contains the resource
|
103
|
-
# @param [String] service_sid The service_sid
|
104
|
-
# @param [String] identity The identity
|
105
|
-
# @param [String] segment The segment
|
106
|
-
# @return [SegmentMembershipContext] SegmentMembershipContext
|
107
|
-
def initialize(version, service_sid, identity, segment)
|
108
|
-
super(version)
|
109
|
-
|
110
|
-
# Path Solution
|
111
|
-
@solution = {service_sid: service_sid, identity: identity, segment: segment, }
|
112
|
-
@uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}/SegmentMemberships/#{@solution[:segment]}"
|
113
|
-
end
|
114
|
-
|
115
|
-
##
|
116
|
-
# Deletes the SegmentMembershipInstance
|
117
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
118
|
-
def delete
|
119
|
-
@version.delete('delete', @uri)
|
120
|
-
end
|
121
|
-
|
122
|
-
##
|
123
|
-
# Fetch a SegmentMembershipInstance
|
124
|
-
# @return [SegmentMembershipInstance] Fetched SegmentMembershipInstance
|
125
|
-
def fetch
|
126
|
-
params = Twilio::Values.of({})
|
127
|
-
|
128
|
-
payload = @version.fetch(
|
129
|
-
'GET',
|
130
|
-
@uri,
|
131
|
-
params,
|
132
|
-
)
|
133
|
-
|
134
|
-
SegmentMembershipInstance.new(
|
135
|
-
@version,
|
136
|
-
payload,
|
137
|
-
service_sid: @solution[:service_sid],
|
138
|
-
identity: @solution[:identity],
|
139
|
-
segment: @solution[:segment],
|
140
|
-
)
|
141
|
-
end
|
142
|
-
|
143
|
-
##
|
144
|
-
# Provide a user friendly representation
|
145
|
-
def to_s
|
146
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
147
|
-
"#<Twilio.Notify.V1.SegmentMembershipContext #{context}>"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
##
|
152
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
153
|
-
class SegmentMembershipInstance < InstanceResource
|
154
|
-
##
|
155
|
-
# Initialize the SegmentMembershipInstance
|
156
|
-
# @param [Version] version Version that contains the resource
|
157
|
-
# @param [Hash] payload payload that contains response from Twilio
|
158
|
-
# @param [String] service_sid The service_sid
|
159
|
-
# @param [String] identity The identity
|
160
|
-
# @param [String] segment The segment
|
161
|
-
# @return [SegmentMembershipInstance] SegmentMembershipInstance
|
162
|
-
def initialize(version, payload, service_sid: nil, identity: nil, segment: nil)
|
163
|
-
super(version)
|
164
|
-
|
165
|
-
# Marshaled Properties
|
166
|
-
@properties = {
|
167
|
-
'account_sid' => payload['account_sid'],
|
168
|
-
'service_sid' => payload['service_sid'],
|
169
|
-
'identity' => payload['identity'],
|
170
|
-
'segment' => payload['segment'],
|
171
|
-
'url' => payload['url'],
|
172
|
-
}
|
173
|
-
|
174
|
-
# Context
|
175
|
-
@instance_context = nil
|
176
|
-
@params = {
|
177
|
-
'service_sid' => service_sid,
|
178
|
-
'identity' => identity,
|
179
|
-
'segment' => segment || @properties['segment'],
|
180
|
-
}
|
181
|
-
end
|
182
|
-
|
183
|
-
##
|
184
|
-
# Generate an instance context for the instance, the context is capable of
|
185
|
-
# performing various actions. All instance actions are proxied to the context
|
186
|
-
# @return [SegmentMembershipContext] SegmentMembershipContext for this SegmentMembershipInstance
|
187
|
-
def context
|
188
|
-
unless @instance_context
|
189
|
-
@instance_context = SegmentMembershipContext.new(
|
190
|
-
@version,
|
191
|
-
@params['service_sid'],
|
192
|
-
@params['identity'],
|
193
|
-
@params['segment'],
|
194
|
-
)
|
195
|
-
end
|
196
|
-
@instance_context
|
197
|
-
end
|
198
|
-
|
199
|
-
##
|
200
|
-
# @return [String] The account_sid
|
201
|
-
def account_sid
|
202
|
-
@properties['account_sid']
|
203
|
-
end
|
204
|
-
|
205
|
-
##
|
206
|
-
# @return [String] The service_sid
|
207
|
-
def service_sid
|
208
|
-
@properties['service_sid']
|
209
|
-
end
|
210
|
-
|
211
|
-
##
|
212
|
-
# @return [String] The identity
|
213
|
-
def identity
|
214
|
-
@properties['identity']
|
215
|
-
end
|
216
|
-
|
217
|
-
##
|
218
|
-
# @return [String] The segment
|
219
|
-
def segment
|
220
|
-
@properties['segment']
|
221
|
-
end
|
222
|
-
|
223
|
-
##
|
224
|
-
# @return [String] The url
|
225
|
-
def url
|
226
|
-
@properties['url']
|
227
|
-
end
|
228
|
-
|
229
|
-
##
|
230
|
-
# Deletes the SegmentMembershipInstance
|
231
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
232
|
-
def delete
|
233
|
-
context.delete
|
234
|
-
end
|
235
|
-
|
236
|
-
##
|
237
|
-
# Fetch a SegmentMembershipInstance
|
238
|
-
# @return [SegmentMembershipInstance] Fetched SegmentMembershipInstance
|
239
|
-
def fetch
|
240
|
-
context.fetch
|
241
|
-
end
|
242
|
-
|
243
|
-
##
|
244
|
-
# Provide a user friendly representation
|
245
|
-
def to_s
|
246
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
247
|
-
"<Twilio.Notify.V1.SegmentMembershipInstance #{values}>"
|
248
|
-
end
|
249
|
-
|
250
|
-
##
|
251
|
-
# Provide a detailed, user friendly representation
|
252
|
-
def inspect
|
253
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
254
|
-
"<Twilio.Notify.V1.SegmentMembershipInstance #{values}>"
|
255
|
-
end
|
256
|
-
end
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|