twilio-ruby 6.9.0 → 6.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +12 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/http/http_client.rb +3 -2
- data/lib/twilio-ruby/rest/client.rb +0 -5
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet.rb +27 -27
- data/lib/twilio-ruby/rest/preview/sync/service.rb +27 -27
- data/lib/twilio-ruby/rest/preview.rb +1 -11
- data/lib/twilio-ruby/rest/preview_base.rb +0 -5
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +2 -35
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb +0 -241
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb +0 -217
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +0 -389
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +0 -435
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +0 -409
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +0 -473
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb +0 -241
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +0 -373
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +0 -436
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +0 -253
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb +0 -226
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb +0 -525
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb +0 -433
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +0 -683
- data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +0 -207
- data/lib/twilio-ruby/rest/autopilot/v1.rb +0 -55
- data/lib/twilio-ruby/rest/autopilot.rb +0 -22
- data/lib/twilio-ruby/rest/autopilot_base.rb +0 -38
- data/lib/twilio-ruby/rest/preview/understand/assistant/assistant_fallback_actions.rb +0 -241
- data/lib/twilio-ruby/rest/preview/understand/assistant/assistant_initiation_actions.rb +0 -241
- data/lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb +0 -217
- data/lib/twilio-ruby/rest/preview/understand/assistant/field_type/field_value.rb +0 -389
- data/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb +0 -435
- data/lib/twilio-ruby/rest/preview/understand/assistant/model_build.rb +0 -409
- data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +0 -463
- data/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb +0 -241
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/field.rb +0 -373
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb +0 -436
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb +0 -253
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb +0 -226
- data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +0 -525
- data/lib/twilio-ruby/rest/preview/understand/assistant.rb +0 -663
- data/lib/twilio-ruby/rest/preview/understand.rb +0 -49
@@ -1,433 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
-
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
-
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
-
#
|
7
|
-
# Twilio - Autopilot
|
8
|
-
# This is the public Twilio REST API.
|
9
|
-
#
|
10
|
-
# NOTE: This class is auto generated by OpenAPI Generator.
|
11
|
-
# https://openapi-generator.tech
|
12
|
-
# Do not edit the class manually.
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
module Twilio
|
17
|
-
module REST
|
18
|
-
class Autopilot < AutopilotBase
|
19
|
-
class V1 < Version
|
20
|
-
class AssistantContext < InstanceContext
|
21
|
-
|
22
|
-
class WebhookList < ListResource
|
23
|
-
##
|
24
|
-
# Initialize the WebhookList
|
25
|
-
# @param [Version] version Version that contains the resource
|
26
|
-
# @return [WebhookList] WebhookList
|
27
|
-
def initialize(version, assistant_sid: nil)
|
28
|
-
super(version)
|
29
|
-
# Path Solution
|
30
|
-
@solution = { assistant_sid: assistant_sid }
|
31
|
-
@uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks"
|
32
|
-
|
33
|
-
end
|
34
|
-
##
|
35
|
-
# Create the WebhookInstance
|
36
|
-
# @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
|
37
|
-
# @param [String] events The list of space-separated events that this Webhook will subscribe to.
|
38
|
-
# @param [String] webhook_url The URL associated with this Webhook.
|
39
|
-
# @param [String] webhook_method The method to be used when calling the webhook's URL.
|
40
|
-
# @return [WebhookInstance] Created WebhookInstance
|
41
|
-
def create(
|
42
|
-
unique_name: nil,
|
43
|
-
events: nil,
|
44
|
-
webhook_url: nil,
|
45
|
-
webhook_method: :unset
|
46
|
-
)
|
47
|
-
|
48
|
-
data = Twilio::Values.of({
|
49
|
-
'UniqueName' => unique_name,
|
50
|
-
'Events' => events,
|
51
|
-
'WebhookUrl' => webhook_url,
|
52
|
-
'WebhookMethod' => webhook_method,
|
53
|
-
})
|
54
|
-
|
55
|
-
payload = @version.create('POST', @uri, data: data)
|
56
|
-
WebhookInstance.new(
|
57
|
-
@version,
|
58
|
-
payload,
|
59
|
-
assistant_sid: @solution[:assistant_sid],
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
##
|
65
|
-
# Lists WebhookInstance records from the API as a list.
|
66
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
67
|
-
# memory before returning.
|
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 [Array] Array of up to limit results
|
75
|
-
def list(limit: nil, page_size: nil)
|
76
|
-
self.stream(
|
77
|
-
limit: limit,
|
78
|
-
page_size: page_size
|
79
|
-
).entries
|
80
|
-
end
|
81
|
-
|
82
|
-
##
|
83
|
-
# Streams Instance records from the API as an Enumerable.
|
84
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
85
|
-
# is reached.
|
86
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
87
|
-
# guarantees to never return more than limit. Default is no limit
|
88
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
89
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
90
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
91
|
-
# efficient page size, i.e. min(limit, 1000)
|
92
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
93
|
-
def stream(limit: nil, page_size: nil)
|
94
|
-
limits = @version.read_limits(limit, page_size)
|
95
|
-
|
96
|
-
page = self.page(
|
97
|
-
page_size: limits[:page_size], )
|
98
|
-
|
99
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
100
|
-
end
|
101
|
-
|
102
|
-
##
|
103
|
-
# When passed a block, yields WebhookInstance records from the API.
|
104
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
105
|
-
# is reached.
|
106
|
-
def each
|
107
|
-
limits = @version.read_limits
|
108
|
-
|
109
|
-
page = self.page(page_size: limits[:page_size], )
|
110
|
-
|
111
|
-
@version.stream(page,
|
112
|
-
limit: limits[:limit],
|
113
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
114
|
-
end
|
115
|
-
|
116
|
-
##
|
117
|
-
# Retrieve a single page of WebhookInstance records from the API.
|
118
|
-
# Request is executed immediately.
|
119
|
-
# @param [String] page_token PageToken provided by the API
|
120
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
121
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
122
|
-
# @return [Page] Page of WebhookInstance
|
123
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
124
|
-
params = Twilio::Values.of({
|
125
|
-
'PageToken' => page_token,
|
126
|
-
'Page' => page_number,
|
127
|
-
'PageSize' => page_size,
|
128
|
-
})
|
129
|
-
|
130
|
-
response = @version.page('GET', @uri, params: params)
|
131
|
-
|
132
|
-
WebhookPage.new(@version, response, @solution)
|
133
|
-
end
|
134
|
-
|
135
|
-
##
|
136
|
-
# Retrieve a single page of WebhookInstance records from the API.
|
137
|
-
# Request is executed immediately.
|
138
|
-
# @param [String] target_url API-generated URL for the requested results page
|
139
|
-
# @return [Page] Page of WebhookInstance
|
140
|
-
def get_page(target_url)
|
141
|
-
response = @version.domain.request(
|
142
|
-
'GET',
|
143
|
-
target_url
|
144
|
-
)
|
145
|
-
WebhookPage.new(@version, response, @solution)
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
# Provide a user friendly representation
|
151
|
-
def to_s
|
152
|
-
'#<Twilio.Autopilot.V1.WebhookList>'
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
##
|
158
|
-
#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.
|
159
|
-
class WebhookContext < InstanceContext
|
160
|
-
##
|
161
|
-
# Initialize the WebhookContext
|
162
|
-
# @param [Version] version Version that contains the resource
|
163
|
-
# @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update.
|
164
|
-
# @param [String] sid The Twilio-provided string that uniquely identifies the Webhook resource to update.
|
165
|
-
# @return [WebhookContext] WebhookContext
|
166
|
-
def initialize(version, assistant_sid, sid)
|
167
|
-
super(version)
|
168
|
-
|
169
|
-
# Path Solution
|
170
|
-
@solution = { assistant_sid: assistant_sid, sid: sid, }
|
171
|
-
@uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks/#{@solution[:sid]}"
|
172
|
-
|
173
|
-
|
174
|
-
end
|
175
|
-
##
|
176
|
-
# Delete the WebhookInstance
|
177
|
-
# @return [Boolean] True if delete succeeds, false otherwise
|
178
|
-
def delete
|
179
|
-
|
180
|
-
@version.delete('DELETE', @uri)
|
181
|
-
end
|
182
|
-
|
183
|
-
##
|
184
|
-
# Fetch the WebhookInstance
|
185
|
-
# @return [WebhookInstance] Fetched WebhookInstance
|
186
|
-
def fetch
|
187
|
-
|
188
|
-
payload = @version.fetch('GET', @uri)
|
189
|
-
WebhookInstance.new(
|
190
|
-
@version,
|
191
|
-
payload,
|
192
|
-
assistant_sid: @solution[:assistant_sid],
|
193
|
-
sid: @solution[:sid],
|
194
|
-
)
|
195
|
-
end
|
196
|
-
|
197
|
-
##
|
198
|
-
# Update the WebhookInstance
|
199
|
-
# @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
|
200
|
-
# @param [String] events The list of space-separated events that this Webhook will subscribe to.
|
201
|
-
# @param [String] webhook_url The URL associated with this Webhook.
|
202
|
-
# @param [String] webhook_method The method to be used when calling the webhook's URL.
|
203
|
-
# @return [WebhookInstance] Updated WebhookInstance
|
204
|
-
def update(
|
205
|
-
unique_name: :unset,
|
206
|
-
events: :unset,
|
207
|
-
webhook_url: :unset,
|
208
|
-
webhook_method: :unset
|
209
|
-
)
|
210
|
-
|
211
|
-
data = Twilio::Values.of({
|
212
|
-
'UniqueName' => unique_name,
|
213
|
-
'Events' => events,
|
214
|
-
'WebhookUrl' => webhook_url,
|
215
|
-
'WebhookMethod' => webhook_method,
|
216
|
-
})
|
217
|
-
|
218
|
-
payload = @version.update('POST', @uri, data: data)
|
219
|
-
WebhookInstance.new(
|
220
|
-
@version,
|
221
|
-
payload,
|
222
|
-
assistant_sid: @solution[:assistant_sid],
|
223
|
-
sid: @solution[:sid],
|
224
|
-
)
|
225
|
-
end
|
226
|
-
|
227
|
-
|
228
|
-
##
|
229
|
-
# Provide a user friendly representation
|
230
|
-
def to_s
|
231
|
-
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
232
|
-
"#<Twilio.Autopilot.V1.WebhookContext #{context}>"
|
233
|
-
end
|
234
|
-
|
235
|
-
##
|
236
|
-
# Provide a detailed, user friendly representation
|
237
|
-
def inspect
|
238
|
-
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
239
|
-
"#<Twilio.Autopilot.V1.WebhookContext #{context}>"
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
class WebhookPage < Page
|
244
|
-
##
|
245
|
-
# Initialize the WebhookPage
|
246
|
-
# @param [Version] version Version that contains the resource
|
247
|
-
# @param [Response] response Response from the API
|
248
|
-
# @param [Hash] solution Path solution for the resource
|
249
|
-
# @return [WebhookPage] WebhookPage
|
250
|
-
def initialize(version, response, solution)
|
251
|
-
super(version, response)
|
252
|
-
|
253
|
-
# Path Solution
|
254
|
-
@solution = solution
|
255
|
-
end
|
256
|
-
|
257
|
-
##
|
258
|
-
# Build an instance of WebhookInstance
|
259
|
-
# @param [Hash] payload Payload response from the API
|
260
|
-
# @return [WebhookInstance] WebhookInstance
|
261
|
-
def get_instance(payload)
|
262
|
-
WebhookInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid])
|
263
|
-
end
|
264
|
-
|
265
|
-
##
|
266
|
-
# Provide a user friendly representation
|
267
|
-
def to_s
|
268
|
-
'<Twilio.Autopilot.V1.WebhookPage>'
|
269
|
-
end
|
270
|
-
end
|
271
|
-
class WebhookInstance < InstanceResource
|
272
|
-
##
|
273
|
-
# Initialize the WebhookInstance
|
274
|
-
# @param [Version] version Version that contains the resource
|
275
|
-
# @param [Hash] payload payload that contains response from Twilio
|
276
|
-
# @param [String] account_sid The SID of the
|
277
|
-
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Webhook
|
278
|
-
# resource.
|
279
|
-
# @param [String] sid The SID of the Call resource to fetch.
|
280
|
-
# @return [WebhookInstance] WebhookInstance
|
281
|
-
def initialize(version, payload , assistant_sid: nil, sid: nil)
|
282
|
-
super(version)
|
283
|
-
|
284
|
-
# Marshaled Properties
|
285
|
-
@properties = {
|
286
|
-
'url' => payload['url'],
|
287
|
-
'account_sid' => payload['account_sid'],
|
288
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
289
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
290
|
-
'assistant_sid' => payload['assistant_sid'],
|
291
|
-
'sid' => payload['sid'],
|
292
|
-
'unique_name' => payload['unique_name'],
|
293
|
-
'events' => payload['events'],
|
294
|
-
'webhook_url' => payload['webhook_url'],
|
295
|
-
'webhook_method' => payload['webhook_method'],
|
296
|
-
}
|
297
|
-
|
298
|
-
# Context
|
299
|
-
@instance_context = nil
|
300
|
-
@params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'sid' => sid || @properties['sid'] , }
|
301
|
-
end
|
302
|
-
|
303
|
-
##
|
304
|
-
# Generate an instance context for the instance, the context is capable of
|
305
|
-
# performing various actions. All instance actions are proxied to the context
|
306
|
-
# @return [WebhookContext] CallContext for this CallInstance
|
307
|
-
def context
|
308
|
-
unless @instance_context
|
309
|
-
@instance_context = WebhookContext.new(@version , @params['assistant_sid'], @params['sid'])
|
310
|
-
end
|
311
|
-
@instance_context
|
312
|
-
end
|
313
|
-
|
314
|
-
##
|
315
|
-
# @return [String] The absolute URL of the Webhook resource.
|
316
|
-
def url
|
317
|
-
@properties['url']
|
318
|
-
end
|
319
|
-
|
320
|
-
##
|
321
|
-
# @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource.
|
322
|
-
def account_sid
|
323
|
-
@properties['account_sid']
|
324
|
-
end
|
325
|
-
|
326
|
-
##
|
327
|
-
# @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
328
|
-
def date_created
|
329
|
-
@properties['date_created']
|
330
|
-
end
|
331
|
-
|
332
|
-
##
|
333
|
-
# @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
334
|
-
def date_updated
|
335
|
-
@properties['date_updated']
|
336
|
-
end
|
337
|
-
|
338
|
-
##
|
339
|
-
# @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource.
|
340
|
-
def assistant_sid
|
341
|
-
@properties['assistant_sid']
|
342
|
-
end
|
343
|
-
|
344
|
-
##
|
345
|
-
# @return [String] The unique string that we created to identify the Webhook resource.
|
346
|
-
def sid
|
347
|
-
@properties['sid']
|
348
|
-
end
|
349
|
-
|
350
|
-
##
|
351
|
-
# @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource.
|
352
|
-
def unique_name
|
353
|
-
@properties['unique_name']
|
354
|
-
end
|
355
|
-
|
356
|
-
##
|
357
|
-
# @return [String] The list of space-separated events that this Webhook is subscribed to.
|
358
|
-
def events
|
359
|
-
@properties['events']
|
360
|
-
end
|
361
|
-
|
362
|
-
##
|
363
|
-
# @return [String] The URL associated with this Webhook.
|
364
|
-
def webhook_url
|
365
|
-
@properties['webhook_url']
|
366
|
-
end
|
367
|
-
|
368
|
-
##
|
369
|
-
# @return [String] The method used when calling the webhook's URL.
|
370
|
-
def webhook_method
|
371
|
-
@properties['webhook_method']
|
372
|
-
end
|
373
|
-
|
374
|
-
##
|
375
|
-
# Delete the WebhookInstance
|
376
|
-
# @return [Boolean] True if delete succeeds, false otherwise
|
377
|
-
def delete
|
378
|
-
|
379
|
-
context.delete
|
380
|
-
end
|
381
|
-
|
382
|
-
##
|
383
|
-
# Fetch the WebhookInstance
|
384
|
-
# @return [WebhookInstance] Fetched WebhookInstance
|
385
|
-
def fetch
|
386
|
-
|
387
|
-
context.fetch
|
388
|
-
end
|
389
|
-
|
390
|
-
##
|
391
|
-
# Update the WebhookInstance
|
392
|
-
# @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
|
393
|
-
# @param [String] events The list of space-separated events that this Webhook will subscribe to.
|
394
|
-
# @param [String] webhook_url The URL associated with this Webhook.
|
395
|
-
# @param [String] webhook_method The method to be used when calling the webhook's URL.
|
396
|
-
# @return [WebhookInstance] Updated WebhookInstance
|
397
|
-
def update(
|
398
|
-
unique_name: :unset,
|
399
|
-
events: :unset,
|
400
|
-
webhook_url: :unset,
|
401
|
-
webhook_method: :unset
|
402
|
-
)
|
403
|
-
|
404
|
-
context.update(
|
405
|
-
unique_name: unique_name,
|
406
|
-
events: events,
|
407
|
-
webhook_url: webhook_url,
|
408
|
-
webhook_method: webhook_method,
|
409
|
-
)
|
410
|
-
end
|
411
|
-
|
412
|
-
##
|
413
|
-
# Provide a user friendly representation
|
414
|
-
def to_s
|
415
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
416
|
-
"<Twilio.Autopilot.V1.WebhookInstance #{values}>"
|
417
|
-
end
|
418
|
-
|
419
|
-
##
|
420
|
-
# Provide a detailed, user friendly representation
|
421
|
-
def inspect
|
422
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
423
|
-
"<Twilio.Autopilot.V1.WebhookInstance #{values}>"
|
424
|
-
end
|
425
|
-
end
|
426
|
-
|
427
|
-
end
|
428
|
-
end
|
429
|
-
end
|
430
|
-
end
|
431
|
-
end
|
432
|
-
|
433
|
-
|