twilio-ruby 5.11.2 → 5.12.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,437 +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
|
-
class SessionContext < InstanceContext
|
15
|
-
##
|
16
|
-
# 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.
|
17
|
-
class InteractionList < ListResource
|
18
|
-
##
|
19
|
-
# Initialize the InteractionList
|
20
|
-
# @param [Version] version Version that contains the resource
|
21
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
22
|
-
# @param [String] session_sid The unique SID identifier of the Session.
|
23
|
-
# @return [InteractionList] InteractionList
|
24
|
-
def initialize(version, service_sid: nil, session_sid: nil)
|
25
|
-
super(version)
|
26
|
-
|
27
|
-
# Path Solution
|
28
|
-
@solution = {service_sid: service_sid, session_sid: session_sid}
|
29
|
-
@uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Interactions"
|
30
|
-
end
|
31
|
-
|
32
|
-
##
|
33
|
-
# Lists InteractionInstance records from the API as a list.
|
34
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
35
|
-
# memory before returning.
|
36
|
-
# @param [interaction.ResourceStatus] inbound_participant_status The Inbound
|
37
|
-
# Participant Status of this Interaction. One of `completed`, `in-progress` or
|
38
|
-
# `failed`.
|
39
|
-
# @param [interaction.ResourceStatus] outbound_participant_status The Outbound
|
40
|
-
# Participant Status of this Interaction. One of `completed`, `in-progress` or
|
41
|
-
# `failed`.
|
42
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
43
|
-
# guarantees to never return more than limit. Default is no limit
|
44
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
45
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
46
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
47
|
-
# efficient page size, i.e. min(limit, 1000)
|
48
|
-
# @return [Array] Array of up to limit results
|
49
|
-
def list(inbound_participant_status: :unset, outbound_participant_status: :unset, limit: nil, page_size: nil)
|
50
|
-
self.stream(
|
51
|
-
inbound_participant_status: inbound_participant_status,
|
52
|
-
outbound_participant_status: outbound_participant_status,
|
53
|
-
limit: limit,
|
54
|
-
page_size: page_size
|
55
|
-
).entries
|
56
|
-
end
|
57
|
-
|
58
|
-
##
|
59
|
-
# Streams InteractionInstance records from the API as an Enumerable.
|
60
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
61
|
-
# is reached.
|
62
|
-
# @param [interaction.ResourceStatus] inbound_participant_status The Inbound
|
63
|
-
# Participant Status of this Interaction. One of `completed`, `in-progress` or
|
64
|
-
# `failed`.
|
65
|
-
# @param [interaction.ResourceStatus] outbound_participant_status The Outbound
|
66
|
-
# Participant Status of this Interaction. One of `completed`, `in-progress` or
|
67
|
-
# `failed`.
|
68
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
69
|
-
# guarantees to never return more than limit. Default is no limit.
|
70
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
71
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
72
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
73
|
-
# efficient page size, i.e. min(limit, 1000)
|
74
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
75
|
-
def stream(inbound_participant_status: :unset, outbound_participant_status: :unset, limit: nil, page_size: nil)
|
76
|
-
limits = @version.read_limits(limit, page_size)
|
77
|
-
|
78
|
-
page = self.page(
|
79
|
-
inbound_participant_status: inbound_participant_status,
|
80
|
-
outbound_participant_status: outbound_participant_status,
|
81
|
-
page_size: limits[:page_size],
|
82
|
-
)
|
83
|
-
|
84
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
85
|
-
end
|
86
|
-
|
87
|
-
##
|
88
|
-
# When passed a block, yields InteractionInstance records from the API.
|
89
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
90
|
-
# is reached.
|
91
|
-
def each
|
92
|
-
limits = @version.read_limits
|
93
|
-
|
94
|
-
page = self.page(page_size: limits[:page_size], )
|
95
|
-
|
96
|
-
@version.stream(page,
|
97
|
-
limit: limits[:limit],
|
98
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
99
|
-
end
|
100
|
-
|
101
|
-
##
|
102
|
-
# Retrieve a single page of InteractionInstance records from the API.
|
103
|
-
# Request is executed immediately.
|
104
|
-
# @param [interaction.ResourceStatus] inbound_participant_status The Inbound
|
105
|
-
# Participant Status of this Interaction. One of `completed`, `in-progress` or
|
106
|
-
# `failed`.
|
107
|
-
# @param [interaction.ResourceStatus] outbound_participant_status The Outbound
|
108
|
-
# Participant Status of this Interaction. One of `completed`, `in-progress` or
|
109
|
-
# `failed`.
|
110
|
-
# @param [String] page_token PageToken provided by the API
|
111
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
112
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
113
|
-
# @return [Page] Page of InteractionInstance
|
114
|
-
def page(inbound_participant_status: :unset, outbound_participant_status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
115
|
-
params = Twilio::Values.of({
|
116
|
-
'InboundParticipantStatus' => inbound_participant_status,
|
117
|
-
'OutboundParticipantStatus' => outbound_participant_status,
|
118
|
-
'PageToken' => page_token,
|
119
|
-
'Page' => page_number,
|
120
|
-
'PageSize' => page_size,
|
121
|
-
})
|
122
|
-
response = @version.page(
|
123
|
-
'GET',
|
124
|
-
@uri,
|
125
|
-
params
|
126
|
-
)
|
127
|
-
InteractionPage.new(@version, response, @solution)
|
128
|
-
end
|
129
|
-
|
130
|
-
##
|
131
|
-
# Retrieve a single page of InteractionInstance records from the API.
|
132
|
-
# Request is executed immediately.
|
133
|
-
# @param [String] target_url API-generated URL for the requested results page
|
134
|
-
# @return [Page] Page of InteractionInstance
|
135
|
-
def get_page(target_url)
|
136
|
-
response = @version.domain.request(
|
137
|
-
'GET',
|
138
|
-
target_url
|
139
|
-
)
|
140
|
-
InteractionPage.new(@version, response, @solution)
|
141
|
-
end
|
142
|
-
|
143
|
-
##
|
144
|
-
# Provide a user friendly representation
|
145
|
-
def to_s
|
146
|
-
'#<Twilio.Preview.Proxy.InteractionList>'
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
##
|
151
|
-
# 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.
|
152
|
-
class InteractionPage < Page
|
153
|
-
##
|
154
|
-
# Initialize the InteractionPage
|
155
|
-
# @param [Version] version Version that contains the resource
|
156
|
-
# @param [Response] response Response from the API
|
157
|
-
# @param [Hash] solution Path solution for the resource
|
158
|
-
# @return [InteractionPage] InteractionPage
|
159
|
-
def initialize(version, response, solution)
|
160
|
-
super(version, response)
|
161
|
-
|
162
|
-
# Path Solution
|
163
|
-
@solution = solution
|
164
|
-
end
|
165
|
-
|
166
|
-
##
|
167
|
-
# Build an instance of InteractionInstance
|
168
|
-
# @param [Hash] payload Payload response from the API
|
169
|
-
# @return [InteractionInstance] InteractionInstance
|
170
|
-
def get_instance(payload)
|
171
|
-
InteractionInstance.new(
|
172
|
-
@version,
|
173
|
-
payload,
|
174
|
-
service_sid: @solution[:service_sid],
|
175
|
-
session_sid: @solution[:session_sid],
|
176
|
-
)
|
177
|
-
end
|
178
|
-
|
179
|
-
##
|
180
|
-
# Provide a user friendly representation
|
181
|
-
def to_s
|
182
|
-
'<Twilio.Preview.Proxy.InteractionPage>'
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
##
|
187
|
-
# 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.
|
188
|
-
class InteractionContext < InstanceContext
|
189
|
-
##
|
190
|
-
# Initialize the InteractionContext
|
191
|
-
# @param [Version] version Version that contains the resource
|
192
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
193
|
-
# @param [String] session_sid The unique SID identifier of the Session.
|
194
|
-
# @param [String] sid A 34 character string that uniquely identifies this
|
195
|
-
# Interaction.
|
196
|
-
# @return [InteractionContext] InteractionContext
|
197
|
-
def initialize(version, service_sid, session_sid, sid)
|
198
|
-
super(version)
|
199
|
-
|
200
|
-
# Path Solution
|
201
|
-
@solution = {service_sid: service_sid, session_sid: session_sid, sid: sid, }
|
202
|
-
@uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Interactions/#{@solution[:sid]}"
|
203
|
-
end
|
204
|
-
|
205
|
-
##
|
206
|
-
# Fetch a InteractionInstance
|
207
|
-
# @return [InteractionInstance] Fetched InteractionInstance
|
208
|
-
def fetch
|
209
|
-
params = Twilio::Values.of({})
|
210
|
-
|
211
|
-
payload = @version.fetch(
|
212
|
-
'GET',
|
213
|
-
@uri,
|
214
|
-
params,
|
215
|
-
)
|
216
|
-
|
217
|
-
InteractionInstance.new(
|
218
|
-
@version,
|
219
|
-
payload,
|
220
|
-
service_sid: @solution[:service_sid],
|
221
|
-
session_sid: @solution[:session_sid],
|
222
|
-
sid: @solution[:sid],
|
223
|
-
)
|
224
|
-
end
|
225
|
-
|
226
|
-
##
|
227
|
-
# Provide a user friendly representation
|
228
|
-
def to_s
|
229
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
230
|
-
"#<Twilio.Preview.Proxy.InteractionContext #{context}>"
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
##
|
235
|
-
# 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.
|
236
|
-
class InteractionInstance < InstanceResource
|
237
|
-
##
|
238
|
-
# Initialize the InteractionInstance
|
239
|
-
# @param [Version] version Version that contains the resource
|
240
|
-
# @param [Hash] payload payload that contains response from Twilio
|
241
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
242
|
-
# @param [String] session_sid The unique SID identifier of the Session.
|
243
|
-
# @param [String] sid A 34 character string that uniquely identifies this
|
244
|
-
# Interaction.
|
245
|
-
# @return [InteractionInstance] InteractionInstance
|
246
|
-
def initialize(version, payload, service_sid: nil, session_sid: nil, sid: nil)
|
247
|
-
super(version)
|
248
|
-
|
249
|
-
# Marshaled Properties
|
250
|
-
@properties = {
|
251
|
-
'sid' => payload['sid'],
|
252
|
-
'session_sid' => payload['session_sid'],
|
253
|
-
'service_sid' => payload['service_sid'],
|
254
|
-
'account_sid' => payload['account_sid'],
|
255
|
-
'data' => payload['data'],
|
256
|
-
'status' => payload['status'],
|
257
|
-
'inbound_participant_sid' => payload['inbound_participant_sid'],
|
258
|
-
'inbound_resource_sid' => payload['inbound_resource_sid'],
|
259
|
-
'inbound_resource_status' => payload['inbound_resource_status'],
|
260
|
-
'inbound_resource_type' => payload['inbound_resource_type'],
|
261
|
-
'inbound_resource_url' => payload['inbound_resource_url'],
|
262
|
-
'outbound_participant_sid' => payload['outbound_participant_sid'],
|
263
|
-
'outbound_resource_sid' => payload['outbound_resource_sid'],
|
264
|
-
'outbound_resource_status' => payload['outbound_resource_status'],
|
265
|
-
'outbound_resource_type' => payload['outbound_resource_type'],
|
266
|
-
'outbound_resource_url' => payload['outbound_resource_url'],
|
267
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
268
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
269
|
-
'url' => payload['url'],
|
270
|
-
}
|
271
|
-
|
272
|
-
# Context
|
273
|
-
@instance_context = nil
|
274
|
-
@params = {
|
275
|
-
'service_sid' => service_sid,
|
276
|
-
'session_sid' => session_sid,
|
277
|
-
'sid' => sid || @properties['sid'],
|
278
|
-
}
|
279
|
-
end
|
280
|
-
|
281
|
-
##
|
282
|
-
# Generate an instance context for the instance, the context is capable of
|
283
|
-
# performing various actions. All instance actions are proxied to the context
|
284
|
-
# @return [InteractionContext] InteractionContext for this InteractionInstance
|
285
|
-
def context
|
286
|
-
unless @instance_context
|
287
|
-
@instance_context = InteractionContext.new(
|
288
|
-
@version,
|
289
|
-
@params['service_sid'],
|
290
|
-
@params['session_sid'],
|
291
|
-
@params['sid'],
|
292
|
-
)
|
293
|
-
end
|
294
|
-
@instance_context
|
295
|
-
end
|
296
|
-
|
297
|
-
##
|
298
|
-
# @return [String] A string that uniquely identifies this Interaction.
|
299
|
-
def sid
|
300
|
-
@properties['sid']
|
301
|
-
end
|
302
|
-
|
303
|
-
##
|
304
|
-
# @return [String] Session Sid.
|
305
|
-
def session_sid
|
306
|
-
@properties['session_sid']
|
307
|
-
end
|
308
|
-
|
309
|
-
##
|
310
|
-
# @return [String] Service Sid.
|
311
|
-
def service_sid
|
312
|
-
@properties['service_sid']
|
313
|
-
end
|
314
|
-
|
315
|
-
##
|
316
|
-
# @return [String] Account Sid.
|
317
|
-
def account_sid
|
318
|
-
@properties['account_sid']
|
319
|
-
end
|
320
|
-
|
321
|
-
##
|
322
|
-
# @return [String] What happened in this Interaction.
|
323
|
-
def data
|
324
|
-
@properties['data']
|
325
|
-
end
|
326
|
-
|
327
|
-
##
|
328
|
-
# @return [interaction.Status] The Status of this Interaction
|
329
|
-
def status
|
330
|
-
@properties['status']
|
331
|
-
end
|
332
|
-
|
333
|
-
##
|
334
|
-
# @return [String] The inbound_participant_sid
|
335
|
-
def inbound_participant_sid
|
336
|
-
@properties['inbound_participant_sid']
|
337
|
-
end
|
338
|
-
|
339
|
-
##
|
340
|
-
# @return [String] The SID of the inbound resource.
|
341
|
-
def inbound_resource_sid
|
342
|
-
@properties['inbound_resource_sid']
|
343
|
-
end
|
344
|
-
|
345
|
-
##
|
346
|
-
# @return [interaction.ResourceStatus] The Inbound Resource Status of this Interaction
|
347
|
-
def inbound_resource_status
|
348
|
-
@properties['inbound_resource_status']
|
349
|
-
end
|
350
|
-
|
351
|
-
##
|
352
|
-
# @return [String] The Twilio object type of the inbound resource.
|
353
|
-
def inbound_resource_type
|
354
|
-
@properties['inbound_resource_type']
|
355
|
-
end
|
356
|
-
|
357
|
-
##
|
358
|
-
# @return [String] The URL of the inbound resource.
|
359
|
-
def inbound_resource_url
|
360
|
-
@properties['inbound_resource_url']
|
361
|
-
end
|
362
|
-
|
363
|
-
##
|
364
|
-
# @return [String] The outbound_participant_sid
|
365
|
-
def outbound_participant_sid
|
366
|
-
@properties['outbound_participant_sid']
|
367
|
-
end
|
368
|
-
|
369
|
-
##
|
370
|
-
# @return [String] The SID of the outbound resource.
|
371
|
-
def outbound_resource_sid
|
372
|
-
@properties['outbound_resource_sid']
|
373
|
-
end
|
374
|
-
|
375
|
-
##
|
376
|
-
# @return [interaction.ResourceStatus] The Outbound Resource Status of this Interaction
|
377
|
-
def outbound_resource_status
|
378
|
-
@properties['outbound_resource_status']
|
379
|
-
end
|
380
|
-
|
381
|
-
##
|
382
|
-
# @return [String] The Twilio object type of the outbound resource.
|
383
|
-
def outbound_resource_type
|
384
|
-
@properties['outbound_resource_type']
|
385
|
-
end
|
386
|
-
|
387
|
-
##
|
388
|
-
# @return [String] The URL of the outbound resource.
|
389
|
-
def outbound_resource_url
|
390
|
-
@properties['outbound_resource_url']
|
391
|
-
end
|
392
|
-
|
393
|
-
##
|
394
|
-
# @return [Time] The date this Interaction was created
|
395
|
-
def date_created
|
396
|
-
@properties['date_created']
|
397
|
-
end
|
398
|
-
|
399
|
-
##
|
400
|
-
# @return [Time] The date this Interaction was updated
|
401
|
-
def date_updated
|
402
|
-
@properties['date_updated']
|
403
|
-
end
|
404
|
-
|
405
|
-
##
|
406
|
-
# @return [String] The URL of this Interaction.
|
407
|
-
def url
|
408
|
-
@properties['url']
|
409
|
-
end
|
410
|
-
|
411
|
-
##
|
412
|
-
# Fetch a InteractionInstance
|
413
|
-
# @return [InteractionInstance] Fetched InteractionInstance
|
414
|
-
def fetch
|
415
|
-
context.fetch
|
416
|
-
end
|
417
|
-
|
418
|
-
##
|
419
|
-
# Provide a user friendly representation
|
420
|
-
def to_s
|
421
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
422
|
-
"<Twilio.Preview.Proxy.InteractionInstance #{values}>"
|
423
|
-
end
|
424
|
-
|
425
|
-
##
|
426
|
-
# Provide a detailed, user friendly representation
|
427
|
-
def inspect
|
428
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
429
|
-
"<Twilio.Preview.Proxy.InteractionInstance #{values}>"
|
430
|
-
end
|
431
|
-
end
|
432
|
-
end
|
433
|
-
end
|
434
|
-
end
|
435
|
-
end
|
436
|
-
end
|
437
|
-
end
|
@@ -1,514 +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
|
-
class SessionContext < InstanceContext
|
15
|
-
##
|
16
|
-
# 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.
|
17
|
-
class ParticipantList < ListResource
|
18
|
-
##
|
19
|
-
# Initialize the ParticipantList
|
20
|
-
# @param [Version] version Version that contains the resource
|
21
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
22
|
-
# @param [String] session_sid The unique SID identifier of the Session.
|
23
|
-
# @return [ParticipantList] ParticipantList
|
24
|
-
def initialize(version, service_sid: nil, session_sid: nil)
|
25
|
-
super(version)
|
26
|
-
|
27
|
-
# Path Solution
|
28
|
-
@solution = {service_sid: service_sid, session_sid: session_sid}
|
29
|
-
@uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Participants"
|
30
|
-
end
|
31
|
-
|
32
|
-
##
|
33
|
-
# Lists ParticipantInstance records from the API as a list.
|
34
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
35
|
-
# memory before returning.
|
36
|
-
# @param [String] identifier The Participant's contact identifier, normally a
|
37
|
-
# phone number.
|
38
|
-
# @param [participant.ParticipantType] participant_type The Type of this
|
39
|
-
# Participant. One of `sms`, `voice` or `phone`.
|
40
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
41
|
-
# guarantees to never return more than limit. Default is no limit
|
42
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
43
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
44
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
45
|
-
# efficient page size, i.e. min(limit, 1000)
|
46
|
-
# @return [Array] Array of up to limit results
|
47
|
-
def list(identifier: :unset, participant_type: :unset, limit: nil, page_size: nil)
|
48
|
-
self.stream(
|
49
|
-
identifier: identifier,
|
50
|
-
participant_type: participant_type,
|
51
|
-
limit: limit,
|
52
|
-
page_size: page_size
|
53
|
-
).entries
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
# Streams ParticipantInstance records from the API as an Enumerable.
|
58
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
59
|
-
# is reached.
|
60
|
-
# @param [String] identifier The Participant's contact identifier, normally a
|
61
|
-
# phone number.
|
62
|
-
# @param [participant.ParticipantType] participant_type The Type of this
|
63
|
-
# Participant. One of `sms`, `voice` or `phone`.
|
64
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
65
|
-
# guarantees to never return more than limit. Default is no limit.
|
66
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
67
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
68
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
69
|
-
# efficient page size, i.e. min(limit, 1000)
|
70
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
71
|
-
def stream(identifier: :unset, participant_type: :unset, limit: nil, page_size: nil)
|
72
|
-
limits = @version.read_limits(limit, page_size)
|
73
|
-
|
74
|
-
page = self.page(
|
75
|
-
identifier: identifier,
|
76
|
-
participant_type: participant_type,
|
77
|
-
page_size: limits[:page_size],
|
78
|
-
)
|
79
|
-
|
80
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
81
|
-
end
|
82
|
-
|
83
|
-
##
|
84
|
-
# When passed a block, yields ParticipantInstance records from the API.
|
85
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
86
|
-
# is reached.
|
87
|
-
def each
|
88
|
-
limits = @version.read_limits
|
89
|
-
|
90
|
-
page = self.page(page_size: limits[:page_size], )
|
91
|
-
|
92
|
-
@version.stream(page,
|
93
|
-
limit: limits[:limit],
|
94
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
95
|
-
end
|
96
|
-
|
97
|
-
##
|
98
|
-
# Retrieve a single page of ParticipantInstance records from the API.
|
99
|
-
# Request is executed immediately.
|
100
|
-
# @param [String] identifier The Participant's contact identifier, normally a
|
101
|
-
# phone number.
|
102
|
-
# @param [participant.ParticipantType] participant_type The Type of this
|
103
|
-
# Participant. One of `sms`, `voice` or `phone`.
|
104
|
-
# @param [String] page_token PageToken provided by the API
|
105
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
106
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
107
|
-
# @return [Page] Page of ParticipantInstance
|
108
|
-
def page(identifier: :unset, participant_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
109
|
-
params = Twilio::Values.of({
|
110
|
-
'Identifier' => identifier,
|
111
|
-
'ParticipantType' => participant_type,
|
112
|
-
'PageToken' => page_token,
|
113
|
-
'Page' => page_number,
|
114
|
-
'PageSize' => page_size,
|
115
|
-
})
|
116
|
-
response = @version.page(
|
117
|
-
'GET',
|
118
|
-
@uri,
|
119
|
-
params
|
120
|
-
)
|
121
|
-
ParticipantPage.new(@version, response, @solution)
|
122
|
-
end
|
123
|
-
|
124
|
-
##
|
125
|
-
# Retrieve a single page of ParticipantInstance records from the API.
|
126
|
-
# Request is executed immediately.
|
127
|
-
# @param [String] target_url API-generated URL for the requested results page
|
128
|
-
# @return [Page] Page of ParticipantInstance
|
129
|
-
def get_page(target_url)
|
130
|
-
response = @version.domain.request(
|
131
|
-
'GET',
|
132
|
-
target_url
|
133
|
-
)
|
134
|
-
ParticipantPage.new(@version, response, @solution)
|
135
|
-
end
|
136
|
-
|
137
|
-
##
|
138
|
-
# Retrieve a single page of ParticipantInstance records from the API.
|
139
|
-
# Request is executed immediately.
|
140
|
-
# @param [String] identifier The Participant's contact identifier, normally a
|
141
|
-
# phone number.
|
142
|
-
# @param [String] friendly_name A human readable description of this resource, up
|
143
|
-
# to 64 characters.
|
144
|
-
# @param [participant.ParticipantType] participant_type The Type of this
|
145
|
-
# Participant. One of `sms`, `voice` or `phone`.
|
146
|
-
# @return [ParticipantInstance] Newly created ParticipantInstance
|
147
|
-
def create(identifier: nil, friendly_name: :unset, participant_type: :unset)
|
148
|
-
data = Twilio::Values.of({
|
149
|
-
'Identifier' => identifier,
|
150
|
-
'FriendlyName' => friendly_name,
|
151
|
-
'ParticipantType' => participant_type,
|
152
|
-
})
|
153
|
-
|
154
|
-
payload = @version.create(
|
155
|
-
'POST',
|
156
|
-
@uri,
|
157
|
-
data: data
|
158
|
-
)
|
159
|
-
|
160
|
-
ParticipantInstance.new(
|
161
|
-
@version,
|
162
|
-
payload,
|
163
|
-
service_sid: @solution[:service_sid],
|
164
|
-
session_sid: @solution[:session_sid],
|
165
|
-
)
|
166
|
-
end
|
167
|
-
|
168
|
-
##
|
169
|
-
# Provide a user friendly representation
|
170
|
-
def to_s
|
171
|
-
'#<Twilio.Preview.Proxy.ParticipantList>'
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
##
|
176
|
-
# 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.
|
177
|
-
class ParticipantPage < Page
|
178
|
-
##
|
179
|
-
# Initialize the ParticipantPage
|
180
|
-
# @param [Version] version Version that contains the resource
|
181
|
-
# @param [Response] response Response from the API
|
182
|
-
# @param [Hash] solution Path solution for the resource
|
183
|
-
# @return [ParticipantPage] ParticipantPage
|
184
|
-
def initialize(version, response, solution)
|
185
|
-
super(version, response)
|
186
|
-
|
187
|
-
# Path Solution
|
188
|
-
@solution = solution
|
189
|
-
end
|
190
|
-
|
191
|
-
##
|
192
|
-
# Build an instance of ParticipantInstance
|
193
|
-
# @param [Hash] payload Payload response from the API
|
194
|
-
# @return [ParticipantInstance] ParticipantInstance
|
195
|
-
def get_instance(payload)
|
196
|
-
ParticipantInstance.new(
|
197
|
-
@version,
|
198
|
-
payload,
|
199
|
-
service_sid: @solution[:service_sid],
|
200
|
-
session_sid: @solution[:session_sid],
|
201
|
-
)
|
202
|
-
end
|
203
|
-
|
204
|
-
##
|
205
|
-
# Provide a user friendly representation
|
206
|
-
def to_s
|
207
|
-
'<Twilio.Preview.Proxy.ParticipantPage>'
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
##
|
212
|
-
# 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.
|
213
|
-
class ParticipantContext < InstanceContext
|
214
|
-
##
|
215
|
-
# Initialize the ParticipantContext
|
216
|
-
# @param [Version] version Version that contains the resource
|
217
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
218
|
-
# @param [String] session_sid The unique SID identifier of the Session.
|
219
|
-
# @param [String] sid A 34 character string that uniquely identifies this
|
220
|
-
# Participant.
|
221
|
-
# @return [ParticipantContext] ParticipantContext
|
222
|
-
def initialize(version, service_sid, session_sid, sid)
|
223
|
-
super(version)
|
224
|
-
|
225
|
-
# Path Solution
|
226
|
-
@solution = {service_sid: service_sid, session_sid: session_sid, sid: sid, }
|
227
|
-
@uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Participants/#{@solution[:sid]}"
|
228
|
-
|
229
|
-
# Dependents
|
230
|
-
@message_interactions = nil
|
231
|
-
end
|
232
|
-
|
233
|
-
##
|
234
|
-
# Fetch a ParticipantInstance
|
235
|
-
# @return [ParticipantInstance] Fetched ParticipantInstance
|
236
|
-
def fetch
|
237
|
-
params = Twilio::Values.of({})
|
238
|
-
|
239
|
-
payload = @version.fetch(
|
240
|
-
'GET',
|
241
|
-
@uri,
|
242
|
-
params,
|
243
|
-
)
|
244
|
-
|
245
|
-
ParticipantInstance.new(
|
246
|
-
@version,
|
247
|
-
payload,
|
248
|
-
service_sid: @solution[:service_sid],
|
249
|
-
session_sid: @solution[:session_sid],
|
250
|
-
sid: @solution[:sid],
|
251
|
-
)
|
252
|
-
end
|
253
|
-
|
254
|
-
##
|
255
|
-
# Deletes the ParticipantInstance
|
256
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
257
|
-
def delete
|
258
|
-
@version.delete('delete', @uri)
|
259
|
-
end
|
260
|
-
|
261
|
-
##
|
262
|
-
# Update the ParticipantInstance
|
263
|
-
# @param [participant.ParticipantType] participant_type The Type of this
|
264
|
-
# Participant. One of `sms`, `voice` or `phone`.
|
265
|
-
# @param [String] identifier The Participant's contact identifier, normally a
|
266
|
-
# phone number.
|
267
|
-
# @param [String] friendly_name A human readable description of this resource, up
|
268
|
-
# to 64 characters.
|
269
|
-
# @return [ParticipantInstance] Updated ParticipantInstance
|
270
|
-
def update(participant_type: :unset, identifier: :unset, friendly_name: :unset)
|
271
|
-
data = Twilio::Values.of({
|
272
|
-
'ParticipantType' => participant_type,
|
273
|
-
'Identifier' => identifier,
|
274
|
-
'FriendlyName' => friendly_name,
|
275
|
-
})
|
276
|
-
|
277
|
-
payload = @version.update(
|
278
|
-
'POST',
|
279
|
-
@uri,
|
280
|
-
data: data,
|
281
|
-
)
|
282
|
-
|
283
|
-
ParticipantInstance.new(
|
284
|
-
@version,
|
285
|
-
payload,
|
286
|
-
service_sid: @solution[:service_sid],
|
287
|
-
session_sid: @solution[:session_sid],
|
288
|
-
sid: @solution[:sid],
|
289
|
-
)
|
290
|
-
end
|
291
|
-
|
292
|
-
##
|
293
|
-
# Access the message_interactions
|
294
|
-
# @return [MessageInteractionList]
|
295
|
-
# @return [MessageInteractionContext] if sid was passed.
|
296
|
-
def message_interactions(sid=:unset)
|
297
|
-
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
298
|
-
|
299
|
-
if sid != :unset
|
300
|
-
return MessageInteractionContext.new(
|
301
|
-
@version,
|
302
|
-
@solution[:service_sid],
|
303
|
-
@solution[:session_sid],
|
304
|
-
@solution[:sid],
|
305
|
-
sid,
|
306
|
-
)
|
307
|
-
end
|
308
|
-
|
309
|
-
unless @message_interactions
|
310
|
-
@message_interactions = MessageInteractionList.new(
|
311
|
-
@version,
|
312
|
-
service_sid: @solution[:service_sid],
|
313
|
-
session_sid: @solution[:session_sid],
|
314
|
-
participant_sid: @solution[:sid],
|
315
|
-
)
|
316
|
-
end
|
317
|
-
|
318
|
-
@message_interactions
|
319
|
-
end
|
320
|
-
|
321
|
-
##
|
322
|
-
# Provide a user friendly representation
|
323
|
-
def to_s
|
324
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
325
|
-
"#<Twilio.Preview.Proxy.ParticipantContext #{context}>"
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
##
|
330
|
-
# 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.
|
331
|
-
class ParticipantInstance < InstanceResource
|
332
|
-
##
|
333
|
-
# Initialize the ParticipantInstance
|
334
|
-
# @param [Version] version Version that contains the resource
|
335
|
-
# @param [Hash] payload payload that contains response from Twilio
|
336
|
-
# @param [String] service_sid The unique SID identifier of the Service.
|
337
|
-
# @param [String] session_sid The unique SID identifier of the Session.
|
338
|
-
# @param [String] sid A 34 character string that uniquely identifies this
|
339
|
-
# Participant.
|
340
|
-
# @return [ParticipantInstance] ParticipantInstance
|
341
|
-
def initialize(version, payload, service_sid: nil, session_sid: nil, sid: nil)
|
342
|
-
super(version)
|
343
|
-
|
344
|
-
# Marshaled Properties
|
345
|
-
@properties = {
|
346
|
-
'sid' => payload['sid'],
|
347
|
-
'session_sid' => payload['session_sid'],
|
348
|
-
'service_sid' => payload['service_sid'],
|
349
|
-
'account_sid' => payload['account_sid'],
|
350
|
-
'friendly_name' => payload['friendly_name'],
|
351
|
-
'participant_type' => payload['participant_type'],
|
352
|
-
'identifier' => payload['identifier'],
|
353
|
-
'proxy_identifier' => payload['proxy_identifier'],
|
354
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
355
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
356
|
-
'url' => payload['url'],
|
357
|
-
'links' => payload['links'],
|
358
|
-
}
|
359
|
-
|
360
|
-
# Context
|
361
|
-
@instance_context = nil
|
362
|
-
@params = {
|
363
|
-
'service_sid' => service_sid,
|
364
|
-
'session_sid' => session_sid,
|
365
|
-
'sid' => sid || @properties['sid'],
|
366
|
-
}
|
367
|
-
end
|
368
|
-
|
369
|
-
##
|
370
|
-
# Generate an instance context for the instance, the context is capable of
|
371
|
-
# performing various actions. All instance actions are proxied to the context
|
372
|
-
# @return [ParticipantContext] ParticipantContext for this ParticipantInstance
|
373
|
-
def context
|
374
|
-
unless @instance_context
|
375
|
-
@instance_context = ParticipantContext.new(
|
376
|
-
@version,
|
377
|
-
@params['service_sid'],
|
378
|
-
@params['session_sid'],
|
379
|
-
@params['sid'],
|
380
|
-
)
|
381
|
-
end
|
382
|
-
@instance_context
|
383
|
-
end
|
384
|
-
|
385
|
-
##
|
386
|
-
# @return [String] A string that uniquely identifies this Participant.
|
387
|
-
def sid
|
388
|
-
@properties['sid']
|
389
|
-
end
|
390
|
-
|
391
|
-
##
|
392
|
-
# @return [String] Session Sid.
|
393
|
-
def session_sid
|
394
|
-
@properties['session_sid']
|
395
|
-
end
|
396
|
-
|
397
|
-
##
|
398
|
-
# @return [String] Service Sid.
|
399
|
-
def service_sid
|
400
|
-
@properties['service_sid']
|
401
|
-
end
|
402
|
-
|
403
|
-
##
|
404
|
-
# @return [String] Account Sid.
|
405
|
-
def account_sid
|
406
|
-
@properties['account_sid']
|
407
|
-
end
|
408
|
-
|
409
|
-
##
|
410
|
-
# @return [String] A human readable description of this resource
|
411
|
-
def friendly_name
|
412
|
-
@properties['friendly_name']
|
413
|
-
end
|
414
|
-
|
415
|
-
##
|
416
|
-
# @return [participant.ParticipantType] The Type of this Participant
|
417
|
-
def participant_type
|
418
|
-
@properties['participant_type']
|
419
|
-
end
|
420
|
-
|
421
|
-
##
|
422
|
-
# @return [String] The Participant's contact identifier, normally a phone number.
|
423
|
-
def identifier
|
424
|
-
@properties['identifier']
|
425
|
-
end
|
426
|
-
|
427
|
-
##
|
428
|
-
# @return [String] What this Participant communicates with, normally a phone number.
|
429
|
-
def proxy_identifier
|
430
|
-
@properties['proxy_identifier']
|
431
|
-
end
|
432
|
-
|
433
|
-
##
|
434
|
-
# @return [Time] The date this Participant was created
|
435
|
-
def date_created
|
436
|
-
@properties['date_created']
|
437
|
-
end
|
438
|
-
|
439
|
-
##
|
440
|
-
# @return [Time] The date this Participant was updated
|
441
|
-
def date_updated
|
442
|
-
@properties['date_updated']
|
443
|
-
end
|
444
|
-
|
445
|
-
##
|
446
|
-
# @return [String] The URL of this resource.
|
447
|
-
def url
|
448
|
-
@properties['url']
|
449
|
-
end
|
450
|
-
|
451
|
-
##
|
452
|
-
# @return [String] Nested resource URLs.
|
453
|
-
def links
|
454
|
-
@properties['links']
|
455
|
-
end
|
456
|
-
|
457
|
-
##
|
458
|
-
# Fetch a ParticipantInstance
|
459
|
-
# @return [ParticipantInstance] Fetched ParticipantInstance
|
460
|
-
def fetch
|
461
|
-
context.fetch
|
462
|
-
end
|
463
|
-
|
464
|
-
##
|
465
|
-
# Deletes the ParticipantInstance
|
466
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
467
|
-
def delete
|
468
|
-
context.delete
|
469
|
-
end
|
470
|
-
|
471
|
-
##
|
472
|
-
# Update the ParticipantInstance
|
473
|
-
# @param [participant.ParticipantType] participant_type The Type of this
|
474
|
-
# Participant. One of `sms`, `voice` or `phone`.
|
475
|
-
# @param [String] identifier The Participant's contact identifier, normally a
|
476
|
-
# phone number.
|
477
|
-
# @param [String] friendly_name A human readable description of this resource, up
|
478
|
-
# to 64 characters.
|
479
|
-
# @return [ParticipantInstance] Updated ParticipantInstance
|
480
|
-
def update(participant_type: :unset, identifier: :unset, friendly_name: :unset)
|
481
|
-
context.update(
|
482
|
-
participant_type: participant_type,
|
483
|
-
identifier: identifier,
|
484
|
-
friendly_name: friendly_name,
|
485
|
-
)
|
486
|
-
end
|
487
|
-
|
488
|
-
##
|
489
|
-
# Access the message_interactions
|
490
|
-
# @return [message_interactions] message_interactions
|
491
|
-
def message_interactions
|
492
|
-
context.message_interactions
|
493
|
-
end
|
494
|
-
|
495
|
-
##
|
496
|
-
# Provide a user friendly representation
|
497
|
-
def to_s
|
498
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
499
|
-
"<Twilio.Preview.Proxy.ParticipantInstance #{values}>"
|
500
|
-
end
|
501
|
-
|
502
|
-
##
|
503
|
-
# Provide a detailed, user friendly representation
|
504
|
-
def inspect
|
505
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
506
|
-
"<Twilio.Preview.Proxy.ParticipantInstance #{values}>"
|
507
|
-
end
|
508
|
-
end
|
509
|
-
end
|
510
|
-
end
|
511
|
-
end
|
512
|
-
end
|
513
|
-
end
|
514
|
-
end
|