twilio-ruby 5.14.1 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +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
|
@@ -0,0 +1,442 @@
|
|
|
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 SampleList < ListResource
|
|
18
|
+
##
|
|
19
|
+
# Initialize the SampleList
|
|
20
|
+
# @param [Version] version Version that contains the resource
|
|
21
|
+
# @param [String] assistant_sid The unique ID of the Assistant.
|
|
22
|
+
# @param [String] task_sid The unique ID of the Task associated with this Sample.
|
|
23
|
+
# @return [SampleList] SampleList
|
|
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]}/Samples"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
##
|
|
33
|
+
# Lists SampleInstance 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] language An ISO language-country string that specifies the
|
|
37
|
+
# language used for this sample. For example: en-US.
|
|
38
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
39
|
+
# guarantees to never return more than limit. Default is no limit
|
|
40
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
41
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
42
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
43
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
44
|
+
# @return [Array] Array of up to limit results
|
|
45
|
+
def list(language: :unset, limit: nil, page_size: nil)
|
|
46
|
+
self.stream(language: language, limit: limit, page_size: page_size).entries
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
##
|
|
50
|
+
# Streams SampleInstance records from the API as an Enumerable.
|
|
51
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
52
|
+
# is reached.
|
|
53
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
54
|
+
# language used for this sample. For example: en-US.
|
|
55
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
56
|
+
# guarantees to never return more than limit. Default is no limit.
|
|
57
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
58
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
59
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
60
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
61
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
62
|
+
def stream(language: :unset, limit: nil, page_size: nil)
|
|
63
|
+
limits = @version.read_limits(limit, page_size)
|
|
64
|
+
|
|
65
|
+
page = self.page(language: language, page_size: limits[:page_size], )
|
|
66
|
+
|
|
67
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
##
|
|
71
|
+
# When passed a block, yields SampleInstance records from the API.
|
|
72
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
73
|
+
# is reached.
|
|
74
|
+
def each
|
|
75
|
+
limits = @version.read_limits
|
|
76
|
+
|
|
77
|
+
page = self.page(page_size: limits[:page_size], )
|
|
78
|
+
|
|
79
|
+
@version.stream(page,
|
|
80
|
+
limit: limits[:limit],
|
|
81
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
##
|
|
85
|
+
# Retrieve a single page of SampleInstance records from the API.
|
|
86
|
+
# Request is executed immediately.
|
|
87
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
88
|
+
# language used for this sample. For example: en-US.
|
|
89
|
+
# @param [String] page_token PageToken provided by the API
|
|
90
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
91
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
92
|
+
# @return [Page] Page of SampleInstance
|
|
93
|
+
def page(language: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
|
94
|
+
params = Twilio::Values.of({
|
|
95
|
+
'Language' => language,
|
|
96
|
+
'PageToken' => page_token,
|
|
97
|
+
'Page' => page_number,
|
|
98
|
+
'PageSize' => page_size,
|
|
99
|
+
})
|
|
100
|
+
response = @version.page(
|
|
101
|
+
'GET',
|
|
102
|
+
@uri,
|
|
103
|
+
params
|
|
104
|
+
)
|
|
105
|
+
SamplePage.new(@version, response, @solution)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
##
|
|
109
|
+
# Retrieve a single page of SampleInstance records from the API.
|
|
110
|
+
# Request is executed immediately.
|
|
111
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
112
|
+
# @return [Page] Page of SampleInstance
|
|
113
|
+
def get_page(target_url)
|
|
114
|
+
response = @version.domain.request(
|
|
115
|
+
'GET',
|
|
116
|
+
target_url
|
|
117
|
+
)
|
|
118
|
+
SamplePage.new(@version, response, @solution)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
##
|
|
122
|
+
# Retrieve a single page of SampleInstance records from the API.
|
|
123
|
+
# Request is executed immediately.
|
|
124
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
125
|
+
# language used for this sample. For example: en-US.
|
|
126
|
+
# @param [String] tagged_text The text example of how end-users may express this
|
|
127
|
+
# task. The sample may contain Field tag blocks.
|
|
128
|
+
# @param [String] source_channel The communication channel from which the sample
|
|
129
|
+
# was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or
|
|
130
|
+
# *slack*. If not included the value will be null
|
|
131
|
+
# @return [SampleInstance] Newly created SampleInstance
|
|
132
|
+
def create(language: nil, tagged_text: nil, source_channel: :unset)
|
|
133
|
+
data = Twilio::Values.of({
|
|
134
|
+
'Language' => language,
|
|
135
|
+
'TaggedText' => tagged_text,
|
|
136
|
+
'SourceChannel' => source_channel,
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
payload = @version.create(
|
|
140
|
+
'POST',
|
|
141
|
+
@uri,
|
|
142
|
+
data: data
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
SampleInstance.new(
|
|
146
|
+
@version,
|
|
147
|
+
payload,
|
|
148
|
+
assistant_sid: @solution[:assistant_sid],
|
|
149
|
+
task_sid: @solution[:task_sid],
|
|
150
|
+
)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
##
|
|
154
|
+
# Provide a user friendly representation
|
|
155
|
+
def to_s
|
|
156
|
+
'#<Twilio.Autopilot.V1.SampleList>'
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
##
|
|
161
|
+
# 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.
|
|
162
|
+
class SamplePage < Page
|
|
163
|
+
##
|
|
164
|
+
# Initialize the SamplePage
|
|
165
|
+
# @param [Version] version Version that contains the resource
|
|
166
|
+
# @param [Response] response Response from the API
|
|
167
|
+
# @param [Hash] solution Path solution for the resource
|
|
168
|
+
# @return [SamplePage] SamplePage
|
|
169
|
+
def initialize(version, response, solution)
|
|
170
|
+
super(version, response)
|
|
171
|
+
|
|
172
|
+
# Path Solution
|
|
173
|
+
@solution = solution
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
##
|
|
177
|
+
# Build an instance of SampleInstance
|
|
178
|
+
# @param [Hash] payload Payload response from the API
|
|
179
|
+
# @return [SampleInstance] SampleInstance
|
|
180
|
+
def get_instance(payload)
|
|
181
|
+
SampleInstance.new(
|
|
182
|
+
@version,
|
|
183
|
+
payload,
|
|
184
|
+
assistant_sid: @solution[:assistant_sid],
|
|
185
|
+
task_sid: @solution[:task_sid],
|
|
186
|
+
)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
##
|
|
190
|
+
# Provide a user friendly representation
|
|
191
|
+
def to_s
|
|
192
|
+
'<Twilio.Autopilot.V1.SamplePage>'
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
##
|
|
197
|
+
# 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.
|
|
198
|
+
class SampleContext < InstanceContext
|
|
199
|
+
##
|
|
200
|
+
# Initialize the SampleContext
|
|
201
|
+
# @param [Version] version Version that contains the resource
|
|
202
|
+
# @param [String] assistant_sid The assistant_sid
|
|
203
|
+
# @param [String] task_sid The task_sid
|
|
204
|
+
# @param [String] sid The sid
|
|
205
|
+
# @return [SampleContext] SampleContext
|
|
206
|
+
def initialize(version, assistant_sid, task_sid, sid)
|
|
207
|
+
super(version)
|
|
208
|
+
|
|
209
|
+
# Path Solution
|
|
210
|
+
@solution = {assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, }
|
|
211
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples/#{@solution[:sid]}"
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
##
|
|
215
|
+
# Fetch a SampleInstance
|
|
216
|
+
# @return [SampleInstance] Fetched SampleInstance
|
|
217
|
+
def fetch
|
|
218
|
+
params = Twilio::Values.of({})
|
|
219
|
+
|
|
220
|
+
payload = @version.fetch(
|
|
221
|
+
'GET',
|
|
222
|
+
@uri,
|
|
223
|
+
params,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
SampleInstance.new(
|
|
227
|
+
@version,
|
|
228
|
+
payload,
|
|
229
|
+
assistant_sid: @solution[:assistant_sid],
|
|
230
|
+
task_sid: @solution[:task_sid],
|
|
231
|
+
sid: @solution[:sid],
|
|
232
|
+
)
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
##
|
|
236
|
+
# Update the SampleInstance
|
|
237
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
238
|
+
# language used for this sample. For example: en-US.
|
|
239
|
+
# @param [String] tagged_text The text example of how end-users may express this
|
|
240
|
+
# task. The sample may contain Field tag blocks.
|
|
241
|
+
# @param [String] source_channel The communication channel from which the sample
|
|
242
|
+
# was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or
|
|
243
|
+
# *slack*. If not included the value will be null
|
|
244
|
+
# @return [SampleInstance] Updated SampleInstance
|
|
245
|
+
def update(language: :unset, tagged_text: :unset, source_channel: :unset)
|
|
246
|
+
data = Twilio::Values.of({
|
|
247
|
+
'Language' => language,
|
|
248
|
+
'TaggedText' => tagged_text,
|
|
249
|
+
'SourceChannel' => source_channel,
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
payload = @version.update(
|
|
253
|
+
'POST',
|
|
254
|
+
@uri,
|
|
255
|
+
data: data,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
SampleInstance.new(
|
|
259
|
+
@version,
|
|
260
|
+
payload,
|
|
261
|
+
assistant_sid: @solution[:assistant_sid],
|
|
262
|
+
task_sid: @solution[:task_sid],
|
|
263
|
+
sid: @solution[:sid],
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
##
|
|
268
|
+
# Deletes the SampleInstance
|
|
269
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
270
|
+
def delete
|
|
271
|
+
@version.delete('delete', @uri)
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
##
|
|
275
|
+
# Provide a user friendly representation
|
|
276
|
+
def to_s
|
|
277
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
278
|
+
"#<Twilio.Autopilot.V1.SampleContext #{context}>"
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
##
|
|
283
|
+
# 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.
|
|
284
|
+
class SampleInstance < InstanceResource
|
|
285
|
+
##
|
|
286
|
+
# Initialize the SampleInstance
|
|
287
|
+
# @param [Version] version Version that contains the resource
|
|
288
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
289
|
+
# @param [String] assistant_sid The unique ID of the Assistant.
|
|
290
|
+
# @param [String] task_sid The unique ID of the Task associated with this Sample.
|
|
291
|
+
# @param [String] sid The sid
|
|
292
|
+
# @return [SampleInstance] SampleInstance
|
|
293
|
+
def initialize(version, payload, assistant_sid: nil, task_sid: nil, sid: nil)
|
|
294
|
+
super(version)
|
|
295
|
+
|
|
296
|
+
# Marshaled Properties
|
|
297
|
+
@properties = {
|
|
298
|
+
'account_sid' => payload['account_sid'],
|
|
299
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
300
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
301
|
+
'task_sid' => payload['task_sid'],
|
|
302
|
+
'language' => payload['language'],
|
|
303
|
+
'assistant_sid' => payload['assistant_sid'],
|
|
304
|
+
'sid' => payload['sid'],
|
|
305
|
+
'tagged_text' => payload['tagged_text'],
|
|
306
|
+
'url' => payload['url'],
|
|
307
|
+
'source_channel' => payload['source_channel'],
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
# Context
|
|
311
|
+
@instance_context = nil
|
|
312
|
+
@params = {
|
|
313
|
+
'assistant_sid' => assistant_sid,
|
|
314
|
+
'task_sid' => task_sid,
|
|
315
|
+
'sid' => sid || @properties['sid'],
|
|
316
|
+
}
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
##
|
|
320
|
+
# Generate an instance context for the instance, the context is capable of
|
|
321
|
+
# performing various actions. All instance actions are proxied to the context
|
|
322
|
+
# @return [SampleContext] SampleContext for this SampleInstance
|
|
323
|
+
def context
|
|
324
|
+
unless @instance_context
|
|
325
|
+
@instance_context = SampleContext.new(
|
|
326
|
+
@version,
|
|
327
|
+
@params['assistant_sid'],
|
|
328
|
+
@params['task_sid'],
|
|
329
|
+
@params['sid'],
|
|
330
|
+
)
|
|
331
|
+
end
|
|
332
|
+
@instance_context
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
##
|
|
336
|
+
# @return [String] The unique ID of the Account that created this Sample.
|
|
337
|
+
def account_sid
|
|
338
|
+
@properties['account_sid']
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
##
|
|
342
|
+
# @return [Time] The date that this resource was created
|
|
343
|
+
def date_created
|
|
344
|
+
@properties['date_created']
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
##
|
|
348
|
+
# @return [Time] The date that this resource was last updated
|
|
349
|
+
def date_updated
|
|
350
|
+
@properties['date_updated']
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
##
|
|
354
|
+
# @return [String] The unique ID of the Task associated with this Sample.
|
|
355
|
+
def task_sid
|
|
356
|
+
@properties['task_sid']
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
##
|
|
360
|
+
# @return [String] An ISO language-country string that specifies the language used for this sample. For example: en-US.
|
|
361
|
+
def language
|
|
362
|
+
@properties['language']
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
##
|
|
366
|
+
# @return [String] The unique ID of the Assistant.
|
|
367
|
+
def assistant_sid
|
|
368
|
+
@properties['assistant_sid']
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
##
|
|
372
|
+
# @return [String] A 34 character string that uniquely identifies this resource.
|
|
373
|
+
def sid
|
|
374
|
+
@properties['sid']
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
##
|
|
378
|
+
# @return [String] The text example of how end-users may express this task. The sample may contain Field tag blocks.
|
|
379
|
+
def tagged_text
|
|
380
|
+
@properties['tagged_text']
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
##
|
|
384
|
+
# @return [String] The url
|
|
385
|
+
def url
|
|
386
|
+
@properties['url']
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
##
|
|
390
|
+
# @return [String] The communication channel from which the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included the value will be null
|
|
391
|
+
def source_channel
|
|
392
|
+
@properties['source_channel']
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
##
|
|
396
|
+
# Fetch a SampleInstance
|
|
397
|
+
# @return [SampleInstance] Fetched SampleInstance
|
|
398
|
+
def fetch
|
|
399
|
+
context.fetch
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
##
|
|
403
|
+
# Update the SampleInstance
|
|
404
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
405
|
+
# language used for this sample. For example: en-US.
|
|
406
|
+
# @param [String] tagged_text The text example of how end-users may express this
|
|
407
|
+
# task. The sample may contain Field tag blocks.
|
|
408
|
+
# @param [String] source_channel The communication channel from which the sample
|
|
409
|
+
# was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or
|
|
410
|
+
# *slack*. If not included the value will be null
|
|
411
|
+
# @return [SampleInstance] Updated SampleInstance
|
|
412
|
+
def update(language: :unset, tagged_text: :unset, source_channel: :unset)
|
|
413
|
+
context.update(language: language, tagged_text: tagged_text, source_channel: source_channel, )
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
##
|
|
417
|
+
# Deletes the SampleInstance
|
|
418
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
419
|
+
def delete
|
|
420
|
+
context.delete
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
##
|
|
424
|
+
# Provide a user friendly representation
|
|
425
|
+
def to_s
|
|
426
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
427
|
+
"<Twilio.Autopilot.V1.SampleInstance #{values}>"
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
##
|
|
431
|
+
# Provide a detailed, user friendly representation
|
|
432
|
+
def inspect
|
|
433
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
434
|
+
"<Twilio.Autopilot.V1.SampleInstance #{values}>"
|
|
435
|
+
end
|
|
436
|
+
end
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
end
|
|
441
|
+
end
|
|
442
|
+
end
|
|
@@ -0,0 +1,244 @@
|
|
|
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 TaskActionsList < ListResource
|
|
18
|
+
##
|
|
19
|
+
# Initialize the TaskActionsList
|
|
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.
|
|
23
|
+
# @return [TaskActionsList] TaskActionsList
|
|
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
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Provide a user friendly representation
|
|
33
|
+
def to_s
|
|
34
|
+
'#<Twilio.Autopilot.V1.TaskActionsList>'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# 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.
|
|
40
|
+
class TaskActionsPage < Page
|
|
41
|
+
##
|
|
42
|
+
# Initialize the TaskActionsPage
|
|
43
|
+
# @param [Version] version Version that contains the resource
|
|
44
|
+
# @param [Response] response Response from the API
|
|
45
|
+
# @param [Hash] solution Path solution for the resource
|
|
46
|
+
# @return [TaskActionsPage] TaskActionsPage
|
|
47
|
+
def initialize(version, response, solution)
|
|
48
|
+
super(version, response)
|
|
49
|
+
|
|
50
|
+
# Path Solution
|
|
51
|
+
@solution = solution
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Build an instance of TaskActionsInstance
|
|
56
|
+
# @param [Hash] payload Payload response from the API
|
|
57
|
+
# @return [TaskActionsInstance] TaskActionsInstance
|
|
58
|
+
def get_instance(payload)
|
|
59
|
+
TaskActionsInstance.new(
|
|
60
|
+
@version,
|
|
61
|
+
payload,
|
|
62
|
+
assistant_sid: @solution[:assistant_sid],
|
|
63
|
+
task_sid: @solution[:task_sid],
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
##
|
|
68
|
+
# Provide a user friendly representation
|
|
69
|
+
def to_s
|
|
70
|
+
'<Twilio.Autopilot.V1.TaskActionsPage>'
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
##
|
|
75
|
+
# 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.
|
|
76
|
+
class TaskActionsContext < InstanceContext
|
|
77
|
+
##
|
|
78
|
+
# Initialize the TaskActionsContext
|
|
79
|
+
# @param [Version] version Version that contains the resource
|
|
80
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
|
81
|
+
# @param [String] task_sid The unique ID of the Task.
|
|
82
|
+
# @return [TaskActionsContext] TaskActionsContext
|
|
83
|
+
def initialize(version, assistant_sid, task_sid)
|
|
84
|
+
super(version)
|
|
85
|
+
|
|
86
|
+
# Path Solution
|
|
87
|
+
@solution = {assistant_sid: assistant_sid, task_sid: task_sid, }
|
|
88
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Actions"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
##
|
|
92
|
+
# Fetch a TaskActionsInstance
|
|
93
|
+
# @return [TaskActionsInstance] Fetched TaskActionsInstance
|
|
94
|
+
def fetch
|
|
95
|
+
params = Twilio::Values.of({})
|
|
96
|
+
|
|
97
|
+
payload = @version.fetch(
|
|
98
|
+
'GET',
|
|
99
|
+
@uri,
|
|
100
|
+
params,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
TaskActionsInstance.new(
|
|
104
|
+
@version,
|
|
105
|
+
payload,
|
|
106
|
+
assistant_sid: @solution[:assistant_sid],
|
|
107
|
+
task_sid: @solution[:task_sid],
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
##
|
|
112
|
+
# Update the TaskActionsInstance
|
|
113
|
+
# @param [Hash] actions The JSON actions that instruct the Assistant how to
|
|
114
|
+
# perform this task.
|
|
115
|
+
# @return [TaskActionsInstance] Updated TaskActionsInstance
|
|
116
|
+
def update(actions: :unset)
|
|
117
|
+
data = Twilio::Values.of({'Actions' => Twilio.serialize_object(actions), })
|
|
118
|
+
|
|
119
|
+
payload = @version.update(
|
|
120
|
+
'POST',
|
|
121
|
+
@uri,
|
|
122
|
+
data: data,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
TaskActionsInstance.new(
|
|
126
|
+
@version,
|
|
127
|
+
payload,
|
|
128
|
+
assistant_sid: @solution[:assistant_sid],
|
|
129
|
+
task_sid: @solution[:task_sid],
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
# Provide a user friendly representation
|
|
135
|
+
def to_s
|
|
136
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
137
|
+
"#<Twilio.Autopilot.V1.TaskActionsContext #{context}>"
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
##
|
|
142
|
+
# 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.
|
|
143
|
+
class TaskActionsInstance < InstanceResource
|
|
144
|
+
##
|
|
145
|
+
# Initialize the TaskActionsInstance
|
|
146
|
+
# @param [Version] version Version that contains the resource
|
|
147
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
148
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
|
149
|
+
# @param [String] task_sid The unique ID of the Task.
|
|
150
|
+
# @return [TaskActionsInstance] TaskActionsInstance
|
|
151
|
+
def initialize(version, payload, assistant_sid: nil, task_sid: nil)
|
|
152
|
+
super(version)
|
|
153
|
+
|
|
154
|
+
# Marshaled Properties
|
|
155
|
+
@properties = {
|
|
156
|
+
'account_sid' => payload['account_sid'],
|
|
157
|
+
'assistant_sid' => payload['assistant_sid'],
|
|
158
|
+
'task_sid' => payload['task_sid'],
|
|
159
|
+
'url' => payload['url'],
|
|
160
|
+
'data' => payload['data'],
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
# Context
|
|
164
|
+
@instance_context = nil
|
|
165
|
+
@params = {'assistant_sid' => assistant_sid, 'task_sid' => task_sid, }
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
##
|
|
169
|
+
# Generate an instance context for the instance, the context is capable of
|
|
170
|
+
# performing various actions. All instance actions are proxied to the context
|
|
171
|
+
# @return [TaskActionsContext] TaskActionsContext for this TaskActionsInstance
|
|
172
|
+
def context
|
|
173
|
+
unless @instance_context
|
|
174
|
+
@instance_context = TaskActionsContext.new(@version, @params['assistant_sid'], @params['task_sid'], )
|
|
175
|
+
end
|
|
176
|
+
@instance_context
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
##
|
|
180
|
+
# @return [String] The unique ID of the Account that created this Field.
|
|
181
|
+
def account_sid
|
|
182
|
+
@properties['account_sid']
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
##
|
|
186
|
+
# @return [String] The unique ID of the parent Assistant.
|
|
187
|
+
def assistant_sid
|
|
188
|
+
@properties['assistant_sid']
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
##
|
|
192
|
+
# @return [String] The unique ID of the Task.
|
|
193
|
+
def task_sid
|
|
194
|
+
@properties['task_sid']
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
##
|
|
198
|
+
# @return [String] The url
|
|
199
|
+
def url
|
|
200
|
+
@properties['url']
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
##
|
|
204
|
+
# @return [Hash] The data
|
|
205
|
+
def data
|
|
206
|
+
@properties['data']
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
##
|
|
210
|
+
# Fetch a TaskActionsInstance
|
|
211
|
+
# @return [TaskActionsInstance] Fetched TaskActionsInstance
|
|
212
|
+
def fetch
|
|
213
|
+
context.fetch
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
##
|
|
217
|
+
# Update the TaskActionsInstance
|
|
218
|
+
# @param [Hash] actions The JSON actions that instruct the Assistant how to
|
|
219
|
+
# perform this task.
|
|
220
|
+
# @return [TaskActionsInstance] Updated TaskActionsInstance
|
|
221
|
+
def update(actions: :unset)
|
|
222
|
+
context.update(actions: actions, )
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
##
|
|
226
|
+
# Provide a user friendly representation
|
|
227
|
+
def to_s
|
|
228
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
229
|
+
"<Twilio.Autopilot.V1.TaskActionsInstance #{values}>"
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
##
|
|
233
|
+
# Provide a detailed, user friendly representation
|
|
234
|
+
def inspect
|
|
235
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
236
|
+
"<Twilio.Autopilot.V1.TaskActionsInstance #{values}>"
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|