twilio-ruby 5.14.1 → 5.15.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 +33 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +2 -1
- data/lib/twilio-ruby/rest/authy.rb +55 -0
- data/lib/twilio-ruby/rest/authy/v1.rb +59 -0
- data/lib/twilio-ruby/rest/authy/v1/form.rb +190 -0
- data/lib/twilio-ruby/rest/authy/v1/service.rb +378 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity.rb +372 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +474 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +405 -0
- data/lib/twilio-ruby/rest/autopilot.rb +47 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +43 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +606 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb +215 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb +205 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +417 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +393 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +390 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +443 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb +215 -0
- data/lib/twilio-ruby/rest/{preview/understand/assistant/intent.rb → autopilot/v1/assistant/task.rb} +91 -84
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +377 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +442 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +244 -0
- data/lib/twilio-ruby/rest/{preview/understand/assistant/intent/intent_statistics.rb → autopilot/v1/assistant/task/task_statistics.rb} +49 -51
- data/lib/twilio-ruby/rest/chat/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +12 -6
- data/lib/twilio-ruby/rest/client.rb +14 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +12 -6
- data/lib/twilio-ruby/rest/preview/understand.rb +2 -1
- data/lib/twilio-ruby/rest/preview/understand/assistant.rb +59 -29
- data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +17 -13
- data/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb +215 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +505 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent → task}/field.rb +25 -25
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent → task}/sample.rb +30 -30
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent/intent_actions.rb → task/task_actions.rb} +50 -54
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb +224 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +7 -7
- data/lib/twilio-ruby/rest/verify/v1/service.rb +45 -6
- data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +9 -2
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +32 -5
- data/lib/twilio-ruby/twiml/voice_response.rb +66 -5
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call/recording_spec.rb +3 -3
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +42 -1
- data/spec/integration/api/v2010/account/conference/recording_spec.rb +2 -2
- data/spec/integration/authy/v1/form_spec.rb +48 -0
- data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +267 -0
- data/spec/integration/authy/v1/service/entity/factor_spec.rb +269 -0
- data/spec/integration/authy/v1/service/entity_spec.rb +201 -0
- data/spec/integration/authy/v1/service_spec.rb +227 -0
- data/spec/integration/autopilot/v1/assistant/defaults_spec.rb +81 -0
- data/spec/integration/autopilot/v1/assistant/dialogue_spec.rb +47 -0
- data/spec/integration/autopilot/v1/assistant/field_type/field_value_spec.rb +210 -0
- data/spec/integration/autopilot/v1/assistant/field_type_spec.rb +246 -0
- data/spec/integration/autopilot/v1/assistant/model_build_spec.rb +241 -0
- data/spec/integration/autopilot/v1/assistant/query_spec.rb +306 -0
- data/spec/integration/autopilot/v1/assistant/style_sheet_spec.rb +81 -0
- data/spec/integration/autopilot/v1/assistant/task/field_spec.rb +207 -0
- data/spec/integration/autopilot/v1/assistant/task/sample_spec.rb +253 -0
- data/spec/integration/autopilot/v1/assistant/task/task_actions_spec.rb +87 -0
- data/spec/integration/autopilot/v1/assistant/task/task_statistics_spec.rb +50 -0
- data/spec/integration/autopilot/v1/assistant/task_spec.rb +262 -0
- data/spec/integration/autopilot/v1/assistant_spec.rb +270 -0
- data/spec/integration/preview/understand/assistant/query_spec.rb +8 -8
- data/spec/integration/preview/understand/assistant/style_sheet_spec.rb +81 -0
- data/spec/integration/preview/understand/assistant/{intent → task}/field_spec.rb +23 -23
- data/spec/integration/preview/understand/assistant/{intent → task}/sample_spec.rb +28 -28
- data/spec/integration/preview/understand/assistant/{intent/intent_actions_spec.rb → task/task_actions_spec.rb} +15 -15
- data/spec/integration/preview/understand/assistant/{intent/intent_statistics_spec.rb → task/task_statistics_spec.rb} +6 -6
- data/spec/integration/preview/understand/assistant/{intent_spec.rb → task_spec.rb} +53 -49
- data/spec/integration/preview/understand/assistant_spec.rb +12 -8
- data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +3 -7
- data/spec/integration/verify/v1/service_spec.rb +30 -0
- data/spec/integration/wireless/v1/command_spec.rb +99 -2
- data/spec/twiml/voice_response_spec.rb +25 -2
- metadata +78 -17
data/lib/twilio-ruby/rest/{preview/understand/assistant/intent.rb → autopilot/v1/assistant/task.rb}
RENAMED
@@ -8,27 +8,27 @@
|
|
8
8
|
|
9
9
|
module Twilio
|
10
10
|
module REST
|
11
|
-
class
|
12
|
-
class
|
11
|
+
class Autopilot < Domain
|
12
|
+
class V1 < Version
|
13
13
|
class AssistantContext < InstanceContext
|
14
14
|
##
|
15
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
|
16
|
+
class TaskList < ListResource
|
17
17
|
##
|
18
|
-
# Initialize the
|
18
|
+
# Initialize the TaskList
|
19
19
|
# @param [Version] version Version that contains the resource
|
20
20
|
# @param [String] assistant_sid The unique ID of the Assistant.
|
21
|
-
# @return [
|
21
|
+
# @return [TaskList] TaskList
|
22
22
|
def initialize(version, assistant_sid: nil)
|
23
23
|
super(version)
|
24
24
|
|
25
25
|
# Path Solution
|
26
26
|
@solution = {assistant_sid: assistant_sid}
|
27
|
-
@uri = "/Assistants/#{@solution[:assistant_sid]}/
|
27
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks"
|
28
28
|
end
|
29
29
|
|
30
30
|
##
|
31
|
-
# Lists
|
31
|
+
# Lists TaskInstance records from the API as a list.
|
32
32
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
33
|
# memory before returning.
|
34
34
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
@@ -43,7 +43,7 @@ module Twilio
|
|
43
43
|
end
|
44
44
|
|
45
45
|
##
|
46
|
-
# Streams
|
46
|
+
# Streams TaskInstance records from the API as an Enumerable.
|
47
47
|
# This operation lazily loads records as efficiently as possible until the limit
|
48
48
|
# is reached.
|
49
49
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
@@ -62,7 +62,7 @@ module Twilio
|
|
62
62
|
end
|
63
63
|
|
64
64
|
##
|
65
|
-
# When passed a block, yields
|
65
|
+
# When passed a block, yields TaskInstance records from the API.
|
66
66
|
# This operation lazily loads records as efficiently as possible until the limit
|
67
67
|
# is reached.
|
68
68
|
def each
|
@@ -76,12 +76,12 @@ module Twilio
|
|
76
76
|
end
|
77
77
|
|
78
78
|
##
|
79
|
-
# Retrieve a single page of
|
79
|
+
# Retrieve a single page of TaskInstance records from the API.
|
80
80
|
# Request is executed immediately.
|
81
81
|
# @param [String] page_token PageToken provided by the API
|
82
82
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
83
83
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
84
|
-
# @return [Page] Page of
|
84
|
+
# @return [Page] Page of TaskInstance
|
85
85
|
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
86
86
|
params = Twilio::Values.of({
|
87
87
|
'PageToken' => page_token,
|
@@ -93,36 +93,38 @@ module Twilio
|
|
93
93
|
@uri,
|
94
94
|
params
|
95
95
|
)
|
96
|
-
|
96
|
+
TaskPage.new(@version, response, @solution)
|
97
97
|
end
|
98
98
|
|
99
99
|
##
|
100
|
-
# Retrieve a single page of
|
100
|
+
# Retrieve a single page of TaskInstance records from the API.
|
101
101
|
# Request is executed immediately.
|
102
102
|
# @param [String] target_url API-generated URL for the requested results page
|
103
|
-
# @return [Page] Page of
|
103
|
+
# @return [Page] Page of TaskInstance
|
104
104
|
def get_page(target_url)
|
105
105
|
response = @version.domain.request(
|
106
106
|
'GET',
|
107
107
|
target_url
|
108
108
|
)
|
109
|
-
|
109
|
+
TaskPage.new(@version, response, @solution)
|
110
110
|
end
|
111
111
|
|
112
112
|
##
|
113
|
-
# Retrieve a single page of
|
113
|
+
# Retrieve a single page of TaskInstance records from the API.
|
114
114
|
# Request is executed immediately.
|
115
115
|
# @param [String] unique_name A user-provided string that uniquely identifies this
|
116
116
|
# resource as an alternative to the sid. Unique up to 64 characters long.
|
117
117
|
# @param [String] friendly_name A user-provided string that identifies this
|
118
|
-
# resource. It is non-unique and can up to 255 characters long.
|
118
|
+
# resource. It is non-unique and can be up to 255 characters long.
|
119
119
|
# @param [Hash] actions The actions
|
120
|
-
# @
|
121
|
-
|
120
|
+
# @param [String] actions_url The actions_url
|
121
|
+
# @return [TaskInstance] Newly created TaskInstance
|
122
|
+
def create(unique_name: nil, friendly_name: :unset, actions: :unset, actions_url: :unset)
|
122
123
|
data = Twilio::Values.of({
|
123
124
|
'UniqueName' => unique_name,
|
124
125
|
'FriendlyName' => friendly_name,
|
125
126
|
'Actions' => Twilio.serialize_object(actions),
|
127
|
+
'ActionsUrl' => actions_url,
|
126
128
|
})
|
127
129
|
|
128
130
|
payload = @version.create(
|
@@ -131,25 +133,25 @@ module Twilio
|
|
131
133
|
data: data
|
132
134
|
)
|
133
135
|
|
134
|
-
|
136
|
+
TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
135
137
|
end
|
136
138
|
|
137
139
|
##
|
138
140
|
# Provide a user friendly representation
|
139
141
|
def to_s
|
140
|
-
'#<Twilio.
|
142
|
+
'#<Twilio.Autopilot.V1.TaskList>'
|
141
143
|
end
|
142
144
|
end
|
143
145
|
|
144
146
|
##
|
145
147
|
# 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.
|
146
|
-
class
|
148
|
+
class TaskPage < Page
|
147
149
|
##
|
148
|
-
# Initialize the
|
150
|
+
# Initialize the TaskPage
|
149
151
|
# @param [Version] version Version that contains the resource
|
150
152
|
# @param [Response] response Response from the API
|
151
153
|
# @param [Hash] solution Path solution for the resource
|
152
|
-
# @return [
|
154
|
+
# @return [TaskPage] TaskPage
|
153
155
|
def initialize(version, response, solution)
|
154
156
|
super(version, response)
|
155
157
|
|
@@ -158,46 +160,46 @@ module Twilio
|
|
158
160
|
end
|
159
161
|
|
160
162
|
##
|
161
|
-
# Build an instance of
|
163
|
+
# Build an instance of TaskInstance
|
162
164
|
# @param [Hash] payload Payload response from the API
|
163
|
-
# @return [
|
165
|
+
# @return [TaskInstance] TaskInstance
|
164
166
|
def get_instance(payload)
|
165
|
-
|
167
|
+
TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
166
168
|
end
|
167
169
|
|
168
170
|
##
|
169
171
|
# Provide a user friendly representation
|
170
172
|
def to_s
|
171
|
-
'<Twilio.
|
173
|
+
'<Twilio.Autopilot.V1.TaskPage>'
|
172
174
|
end
|
173
175
|
end
|
174
176
|
|
175
177
|
##
|
176
178
|
# 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
|
179
|
+
class TaskContext < InstanceContext
|
178
180
|
##
|
179
|
-
# Initialize the
|
181
|
+
# Initialize the TaskContext
|
180
182
|
# @param [Version] version Version that contains the resource
|
181
183
|
# @param [String] assistant_sid The assistant_sid
|
182
184
|
# @param [String] sid The sid
|
183
|
-
# @return [
|
185
|
+
# @return [TaskContext] TaskContext
|
184
186
|
def initialize(version, assistant_sid, sid)
|
185
187
|
super(version)
|
186
188
|
|
187
189
|
# Path Solution
|
188
190
|
@solution = {assistant_sid: assistant_sid, sid: sid, }
|
189
|
-
@uri = "/Assistants/#{@solution[:assistant_sid]}/
|
191
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:sid]}"
|
190
192
|
|
191
193
|
# Dependents
|
192
194
|
@fields = nil
|
193
195
|
@samples = nil
|
194
|
-
@
|
196
|
+
@task_actions = nil
|
195
197
|
@statistics = nil
|
196
198
|
end
|
197
199
|
|
198
200
|
##
|
199
|
-
# Fetch a
|
200
|
-
# @return [
|
201
|
+
# Fetch a TaskInstance
|
202
|
+
# @return [TaskInstance] Fetched TaskInstance
|
201
203
|
def fetch
|
202
204
|
params = Twilio::Values.of({})
|
203
205
|
|
@@ -207,27 +209,24 @@ module Twilio
|
|
207
209
|
params,
|
208
210
|
)
|
209
211
|
|
210
|
-
|
211
|
-
@version,
|
212
|
-
payload,
|
213
|
-
assistant_sid: @solution[:assistant_sid],
|
214
|
-
sid: @solution[:sid],
|
215
|
-
)
|
212
|
+
TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
|
216
213
|
end
|
217
214
|
|
218
215
|
##
|
219
|
-
# Update the
|
216
|
+
# Update the TaskInstance
|
220
217
|
# @param [String] friendly_name A user-provided string that identifies this
|
221
|
-
# resource. It is non-unique and can up to 255 characters long.
|
218
|
+
# resource. It is non-unique and can be up to 255 characters long.
|
222
219
|
# @param [String] unique_name A user-provided string that uniquely identifies this
|
223
220
|
# resource as an alternative to the sid. Unique up to 64 characters long.
|
224
221
|
# @param [Hash] actions The actions
|
225
|
-
# @
|
226
|
-
|
222
|
+
# @param [String] actions_url The actions_url
|
223
|
+
# @return [TaskInstance] Updated TaskInstance
|
224
|
+
def update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset)
|
227
225
|
data = Twilio::Values.of({
|
228
226
|
'FriendlyName' => friendly_name,
|
229
227
|
'UniqueName' => unique_name,
|
230
228
|
'Actions' => Twilio.serialize_object(actions),
|
229
|
+
'ActionsUrl' => actions_url,
|
231
230
|
})
|
232
231
|
|
233
232
|
payload = @version.update(
|
@@ -236,16 +235,11 @@ module Twilio
|
|
236
235
|
data: data,
|
237
236
|
)
|
238
237
|
|
239
|
-
|
240
|
-
@version,
|
241
|
-
payload,
|
242
|
-
assistant_sid: @solution[:assistant_sid],
|
243
|
-
sid: @solution[:sid],
|
244
|
-
)
|
238
|
+
TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
|
245
239
|
end
|
246
240
|
|
247
241
|
##
|
248
|
-
# Deletes the
|
242
|
+
# Deletes the TaskInstance
|
249
243
|
# @return [Boolean] true if delete succeeds, true otherwise
|
250
244
|
def delete
|
251
245
|
@version.delete('delete', @uri)
|
@@ -266,7 +260,7 @@ module Twilio
|
|
266
260
|
@fields = FieldList.new(
|
267
261
|
@version,
|
268
262
|
assistant_sid: @solution[:assistant_sid],
|
269
|
-
|
263
|
+
task_sid: @solution[:sid],
|
270
264
|
)
|
271
265
|
end
|
272
266
|
|
@@ -288,7 +282,7 @@ module Twilio
|
|
288
282
|
@samples = SampleList.new(
|
289
283
|
@version,
|
290
284
|
assistant_sid: @solution[:assistant_sid],
|
291
|
-
|
285
|
+
task_sid: @solution[:sid],
|
292
286
|
)
|
293
287
|
end
|
294
288
|
|
@@ -296,39 +290,39 @@ module Twilio
|
|
296
290
|
end
|
297
291
|
|
298
292
|
##
|
299
|
-
# Access the
|
300
|
-
# @return [
|
301
|
-
# @return [
|
302
|
-
def
|
303
|
-
|
293
|
+
# Access the task_actions
|
294
|
+
# @return [TaskActionsList]
|
295
|
+
# @return [TaskActionsContext]
|
296
|
+
def task_actions
|
297
|
+
TaskActionsContext.new(@version, @solution[:assistant_sid], @solution[:sid], )
|
304
298
|
end
|
305
299
|
|
306
300
|
##
|
307
301
|
# Access the statistics
|
308
|
-
# @return [
|
309
|
-
# @return [
|
302
|
+
# @return [TaskStatisticsList]
|
303
|
+
# @return [TaskStatisticsContext]
|
310
304
|
def statistics
|
311
|
-
|
305
|
+
TaskStatisticsContext.new(@version, @solution[:assistant_sid], @solution[:sid], )
|
312
306
|
end
|
313
307
|
|
314
308
|
##
|
315
309
|
# Provide a user friendly representation
|
316
310
|
def to_s
|
317
311
|
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
318
|
-
"#<Twilio.
|
312
|
+
"#<Twilio.Autopilot.V1.TaskContext #{context}>"
|
319
313
|
end
|
320
314
|
end
|
321
315
|
|
322
316
|
##
|
323
317
|
# 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.
|
324
|
-
class
|
318
|
+
class TaskInstance < InstanceResource
|
325
319
|
##
|
326
|
-
# Initialize the
|
320
|
+
# Initialize the TaskInstance
|
327
321
|
# @param [Version] version Version that contains the resource
|
328
322
|
# @param [Hash] payload payload that contains response from Twilio
|
329
323
|
# @param [String] assistant_sid The unique ID of the Assistant.
|
330
324
|
# @param [String] sid The sid
|
331
|
-
# @return [
|
325
|
+
# @return [TaskInstance] TaskInstance
|
332
326
|
def initialize(version, payload, assistant_sid: nil, sid: nil)
|
333
327
|
super(version)
|
334
328
|
|
@@ -342,6 +336,7 @@ module Twilio
|
|
342
336
|
'assistant_sid' => payload['assistant_sid'],
|
343
337
|
'sid' => payload['sid'],
|
344
338
|
'unique_name' => payload['unique_name'],
|
339
|
+
'actions_url' => payload['actions_url'],
|
345
340
|
'url' => payload['url'],
|
346
341
|
}
|
347
342
|
|
@@ -353,16 +348,16 @@ module Twilio
|
|
353
348
|
##
|
354
349
|
# Generate an instance context for the instance, the context is capable of
|
355
350
|
# performing various actions. All instance actions are proxied to the context
|
356
|
-
# @return [
|
351
|
+
# @return [TaskContext] TaskContext for this TaskInstance
|
357
352
|
def context
|
358
353
|
unless @instance_context
|
359
|
-
@instance_context =
|
354
|
+
@instance_context = TaskContext.new(@version, @params['assistant_sid'], @params['sid'], )
|
360
355
|
end
|
361
356
|
@instance_context
|
362
357
|
end
|
363
358
|
|
364
359
|
##
|
365
|
-
# @return [String] The unique ID of the Account that created this
|
360
|
+
# @return [String] The unique ID of the Account that created this Task.
|
366
361
|
def account_sid
|
367
362
|
@properties['account_sid']
|
368
363
|
end
|
@@ -380,7 +375,7 @@ module Twilio
|
|
380
375
|
end
|
381
376
|
|
382
377
|
##
|
383
|
-
# @return [String] A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long.
|
378
|
+
# @return [String] A user-provided string that identifies this resource. It is non-unique and can be up to 255 characters long.
|
384
379
|
def friendly_name
|
385
380
|
@properties['friendly_name']
|
386
381
|
end
|
@@ -409,6 +404,12 @@ module Twilio
|
|
409
404
|
@properties['unique_name']
|
410
405
|
end
|
411
406
|
|
407
|
+
##
|
408
|
+
# @return [String] User-provided HTTP endpoint where the assistant can fetch actions.
|
409
|
+
def actions_url
|
410
|
+
@properties['actions_url']
|
411
|
+
end
|
412
|
+
|
412
413
|
##
|
413
414
|
# @return [String] The url
|
414
415
|
def url
|
@@ -416,26 +417,32 @@ module Twilio
|
|
416
417
|
end
|
417
418
|
|
418
419
|
##
|
419
|
-
# Fetch a
|
420
|
-
# @return [
|
420
|
+
# Fetch a TaskInstance
|
421
|
+
# @return [TaskInstance] Fetched TaskInstance
|
421
422
|
def fetch
|
422
423
|
context.fetch
|
423
424
|
end
|
424
425
|
|
425
426
|
##
|
426
|
-
# Update the
|
427
|
+
# Update the TaskInstance
|
427
428
|
# @param [String] friendly_name A user-provided string that identifies this
|
428
|
-
# resource. It is non-unique and can up to 255 characters long.
|
429
|
+
# resource. It is non-unique and can be up to 255 characters long.
|
429
430
|
# @param [String] unique_name A user-provided string that uniquely identifies this
|
430
431
|
# resource as an alternative to the sid. Unique up to 64 characters long.
|
431
432
|
# @param [Hash] actions The actions
|
432
|
-
# @
|
433
|
-
|
434
|
-
|
433
|
+
# @param [String] actions_url The actions_url
|
434
|
+
# @return [TaskInstance] Updated TaskInstance
|
435
|
+
def update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset)
|
436
|
+
context.update(
|
437
|
+
friendly_name: friendly_name,
|
438
|
+
unique_name: unique_name,
|
439
|
+
actions: actions,
|
440
|
+
actions_url: actions_url,
|
441
|
+
)
|
435
442
|
end
|
436
443
|
|
437
444
|
##
|
438
|
-
# Deletes the
|
445
|
+
# Deletes the TaskInstance
|
439
446
|
# @return [Boolean] true if delete succeeds, true otherwise
|
440
447
|
def delete
|
441
448
|
context.delete
|
@@ -456,10 +463,10 @@ module Twilio
|
|
456
463
|
end
|
457
464
|
|
458
465
|
##
|
459
|
-
# Access the
|
460
|
-
# @return [
|
461
|
-
def
|
462
|
-
context.
|
466
|
+
# Access the task_actions
|
467
|
+
# @return [task_actions] task_actions
|
468
|
+
def task_actions
|
469
|
+
context.task_actions
|
463
470
|
end
|
464
471
|
|
465
472
|
##
|
@@ -473,14 +480,14 @@ module Twilio
|
|
473
480
|
# Provide a user friendly representation
|
474
481
|
def to_s
|
475
482
|
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
476
|
-
"<Twilio.
|
483
|
+
"<Twilio.Autopilot.V1.TaskInstance #{values}>"
|
477
484
|
end
|
478
485
|
|
479
486
|
##
|
480
487
|
# Provide a detailed, user friendly representation
|
481
488
|
def inspect
|
482
489
|
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
483
|
-
"<Twilio.
|
490
|
+
"<Twilio.Autopilot.V1.TaskInstance #{values}>"
|
484
491
|
end
|
485
492
|
end
|
486
493
|
end
|
@@ -0,0 +1,377 @@
|
|
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 Autopilot < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class AssistantContext < InstanceContext
|
14
|
+
class TaskContext < 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 FieldList < ListResource
|
18
|
+
##
|
19
|
+
# Initialize the FieldList
|
20
|
+
# @param [Version] version Version that contains the resource
|
21
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
22
|
+
# @param [String] task_sid The unique ID of the Task associated with this Field.
|
23
|
+
# @return [FieldList] FieldList
|
24
|
+
def initialize(version, assistant_sid: nil, task_sid: nil)
|
25
|
+
super(version)
|
26
|
+
|
27
|
+
# Path Solution
|
28
|
+
@solution = {assistant_sid: assistant_sid, task_sid: task_sid}
|
29
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Fields"
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Lists FieldInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
|
37
|
+
# guarantees to never return more than limit. Default is no limit
|
38
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
39
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
40
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
41
|
+
# efficient page size, i.e. min(limit, 1000)
|
42
|
+
# @return [Array] Array of up to limit results
|
43
|
+
def list(limit: nil, page_size: nil)
|
44
|
+
self.stream(limit: limit, page_size: page_size).entries
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Streams FieldInstance records from the API as an Enumerable.
|
49
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
50
|
+
# is reached.
|
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 [Enumerable] Enumerable that will yield up to limit results
|
58
|
+
def stream(limit: nil, page_size: nil)
|
59
|
+
limits = @version.read_limits(limit, page_size)
|
60
|
+
|
61
|
+
page = self.page(page_size: limits[:page_size], )
|
62
|
+
|
63
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# When passed a block, yields FieldInstance records from the API.
|
68
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
69
|
+
# is reached.
|
70
|
+
def each
|
71
|
+
limits = @version.read_limits
|
72
|
+
|
73
|
+
page = self.page(page_size: limits[:page_size], )
|
74
|
+
|
75
|
+
@version.stream(page,
|
76
|
+
limit: limits[:limit],
|
77
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Retrieve a single page of FieldInstance records from the API.
|
82
|
+
# Request is executed immediately.
|
83
|
+
# @param [String] page_token PageToken provided by the API
|
84
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
85
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
86
|
+
# @return [Page] Page of FieldInstance
|
87
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
88
|
+
params = Twilio::Values.of({
|
89
|
+
'PageToken' => page_token,
|
90
|
+
'Page' => page_number,
|
91
|
+
'PageSize' => page_size,
|
92
|
+
})
|
93
|
+
response = @version.page(
|
94
|
+
'GET',
|
95
|
+
@uri,
|
96
|
+
params
|
97
|
+
)
|
98
|
+
FieldPage.new(@version, response, @solution)
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Retrieve a single page of FieldInstance records from the API.
|
103
|
+
# Request is executed immediately.
|
104
|
+
# @param [String] target_url API-generated URL for the requested results page
|
105
|
+
# @return [Page] Page of FieldInstance
|
106
|
+
def get_page(target_url)
|
107
|
+
response = @version.domain.request(
|
108
|
+
'GET',
|
109
|
+
target_url
|
110
|
+
)
|
111
|
+
FieldPage.new(@version, response, @solution)
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Retrieve a single page of FieldInstance records from the API.
|
116
|
+
# Request is executed immediately.
|
117
|
+
# @param [String] field_type The unique name or sid of the FieldType. It can be
|
118
|
+
# any [Built-in Field
|
119
|
+
# Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the
|
120
|
+
# unique_name or the Field Type sid of a custom Field Type.
|
121
|
+
# @param [String] unique_name A user-provided string that uniquely identifies this
|
122
|
+
# resource as an alternative to the sid. Unique up to 64 characters long.
|
123
|
+
# @return [FieldInstance] Newly created FieldInstance
|
124
|
+
def create(field_type: nil, unique_name: nil)
|
125
|
+
data = Twilio::Values.of({'FieldType' => field_type, 'UniqueName' => unique_name, })
|
126
|
+
|
127
|
+
payload = @version.create(
|
128
|
+
'POST',
|
129
|
+
@uri,
|
130
|
+
data: data
|
131
|
+
)
|
132
|
+
|
133
|
+
FieldInstance.new(
|
134
|
+
@version,
|
135
|
+
payload,
|
136
|
+
assistant_sid: @solution[:assistant_sid],
|
137
|
+
task_sid: @solution[:task_sid],
|
138
|
+
)
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Provide a user friendly representation
|
143
|
+
def to_s
|
144
|
+
'#<Twilio.Autopilot.V1.FieldList>'
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# 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.
|
150
|
+
class FieldPage < Page
|
151
|
+
##
|
152
|
+
# Initialize the FieldPage
|
153
|
+
# @param [Version] version Version that contains the resource
|
154
|
+
# @param [Response] response Response from the API
|
155
|
+
# @param [Hash] solution Path solution for the resource
|
156
|
+
# @return [FieldPage] FieldPage
|
157
|
+
def initialize(version, response, solution)
|
158
|
+
super(version, response)
|
159
|
+
|
160
|
+
# Path Solution
|
161
|
+
@solution = solution
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# Build an instance of FieldInstance
|
166
|
+
# @param [Hash] payload Payload response from the API
|
167
|
+
# @return [FieldInstance] FieldInstance
|
168
|
+
def get_instance(payload)
|
169
|
+
FieldInstance.new(
|
170
|
+
@version,
|
171
|
+
payload,
|
172
|
+
assistant_sid: @solution[:assistant_sid],
|
173
|
+
task_sid: @solution[:task_sid],
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Provide a user friendly representation
|
179
|
+
def to_s
|
180
|
+
'<Twilio.Autopilot.V1.FieldPage>'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# 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.
|
186
|
+
class FieldContext < InstanceContext
|
187
|
+
##
|
188
|
+
# Initialize the FieldContext
|
189
|
+
# @param [Version] version Version that contains the resource
|
190
|
+
# @param [String] assistant_sid The assistant_sid
|
191
|
+
# @param [String] task_sid The task_sid
|
192
|
+
# @param [String] sid The sid
|
193
|
+
# @return [FieldContext] FieldContext
|
194
|
+
def initialize(version, assistant_sid, task_sid, sid)
|
195
|
+
super(version)
|
196
|
+
|
197
|
+
# Path Solution
|
198
|
+
@solution = {assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, }
|
199
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Fields/#{@solution[:sid]}"
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# Fetch a FieldInstance
|
204
|
+
# @return [FieldInstance] Fetched FieldInstance
|
205
|
+
def fetch
|
206
|
+
params = Twilio::Values.of({})
|
207
|
+
|
208
|
+
payload = @version.fetch(
|
209
|
+
'GET',
|
210
|
+
@uri,
|
211
|
+
params,
|
212
|
+
)
|
213
|
+
|
214
|
+
FieldInstance.new(
|
215
|
+
@version,
|
216
|
+
payload,
|
217
|
+
assistant_sid: @solution[:assistant_sid],
|
218
|
+
task_sid: @solution[:task_sid],
|
219
|
+
sid: @solution[:sid],
|
220
|
+
)
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Deletes the FieldInstance
|
225
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
226
|
+
def delete
|
227
|
+
@version.delete('delete', @uri)
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Provide a user friendly representation
|
232
|
+
def to_s
|
233
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
234
|
+
"#<Twilio.Autopilot.V1.FieldContext #{context}>"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# 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.
|
240
|
+
class FieldInstance < InstanceResource
|
241
|
+
##
|
242
|
+
# Initialize the FieldInstance
|
243
|
+
# @param [Version] version Version that contains the resource
|
244
|
+
# @param [Hash] payload payload that contains response from Twilio
|
245
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
246
|
+
# @param [String] task_sid The unique ID of the Task associated with this Field.
|
247
|
+
# @param [String] sid The sid
|
248
|
+
# @return [FieldInstance] FieldInstance
|
249
|
+
def initialize(version, payload, assistant_sid: nil, task_sid: nil, sid: nil)
|
250
|
+
super(version)
|
251
|
+
|
252
|
+
# Marshaled Properties
|
253
|
+
@properties = {
|
254
|
+
'account_sid' => payload['account_sid'],
|
255
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
256
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
257
|
+
'field_type' => payload['field_type'],
|
258
|
+
'task_sid' => payload['task_sid'],
|
259
|
+
'assistant_sid' => payload['assistant_sid'],
|
260
|
+
'sid' => payload['sid'],
|
261
|
+
'unique_name' => payload['unique_name'],
|
262
|
+
'url' => payload['url'],
|
263
|
+
}
|
264
|
+
|
265
|
+
# Context
|
266
|
+
@instance_context = nil
|
267
|
+
@params = {
|
268
|
+
'assistant_sid' => assistant_sid,
|
269
|
+
'task_sid' => task_sid,
|
270
|
+
'sid' => sid || @properties['sid'],
|
271
|
+
}
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Generate an instance context for the instance, the context is capable of
|
276
|
+
# performing various actions. All instance actions are proxied to the context
|
277
|
+
# @return [FieldContext] FieldContext for this FieldInstance
|
278
|
+
def context
|
279
|
+
unless @instance_context
|
280
|
+
@instance_context = FieldContext.new(
|
281
|
+
@version,
|
282
|
+
@params['assistant_sid'],
|
283
|
+
@params['task_sid'],
|
284
|
+
@params['sid'],
|
285
|
+
)
|
286
|
+
end
|
287
|
+
@instance_context
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @return [String] The unique ID of the Account that created this Field.
|
292
|
+
def account_sid
|
293
|
+
@properties['account_sid']
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [Time] The date that this resource was created
|
298
|
+
def date_created
|
299
|
+
@properties['date_created']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [Time] The date that this resource was last updated
|
304
|
+
def date_updated
|
305
|
+
@properties['date_updated']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [String] The Field Type of this field. It can be any Built-in Field Type or unique_name or the Field Type sid of a custom Field Type.
|
310
|
+
def field_type
|
311
|
+
@properties['field_type']
|
312
|
+
end
|
313
|
+
|
314
|
+
##
|
315
|
+
# @return [String] The unique ID of the Task associated with this Field.
|
316
|
+
def task_sid
|
317
|
+
@properties['task_sid']
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# @return [String] The unique ID of the parent Assistant.
|
322
|
+
def assistant_sid
|
323
|
+
@properties['assistant_sid']
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# @return [String] A 34 character string that uniquely identifies this resource.
|
328
|
+
def sid
|
329
|
+
@properties['sid']
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
|
334
|
+
def unique_name
|
335
|
+
@properties['unique_name']
|
336
|
+
end
|
337
|
+
|
338
|
+
##
|
339
|
+
# @return [String] The url
|
340
|
+
def url
|
341
|
+
@properties['url']
|
342
|
+
end
|
343
|
+
|
344
|
+
##
|
345
|
+
# Fetch a FieldInstance
|
346
|
+
# @return [FieldInstance] Fetched FieldInstance
|
347
|
+
def fetch
|
348
|
+
context.fetch
|
349
|
+
end
|
350
|
+
|
351
|
+
##
|
352
|
+
# Deletes the FieldInstance
|
353
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
354
|
+
def delete
|
355
|
+
context.delete
|
356
|
+
end
|
357
|
+
|
358
|
+
##
|
359
|
+
# Provide a user friendly representation
|
360
|
+
def to_s
|
361
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
362
|
+
"<Twilio.Autopilot.V1.FieldInstance #{values}>"
|
363
|
+
end
|
364
|
+
|
365
|
+
##
|
366
|
+
# Provide a detailed, user friendly representation
|
367
|
+
def inspect
|
368
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
369
|
+
"<Twilio.Autopilot.V1.FieldInstance #{values}>"
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|