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
@@ -0,0 +1,443 @@
|
|
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
|
+
##
|
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 QueryList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the QueryList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
21
|
+
# @return [QueryList] QueryList
|
22
|
+
def initialize(version, assistant_sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {assistant_sid: assistant_sid}
|
27
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Queries"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Lists QueryInstance records from the API as a list.
|
32
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
|
+
# memory before returning.
|
34
|
+
# @param [String] language An ISO language-country string that specifies the
|
35
|
+
# language used for this query. For example: en-US.
|
36
|
+
# @param [String] model_build The Model Build Sid or unique name of the Model
|
37
|
+
# Build to be queried.
|
38
|
+
# @param [String] status A string that described the query status. The values can
|
39
|
+
# be: `pending_review`, `reviewed`, `discarded`
|
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(language: :unset, model_build: :unset, status: :unset, limit: nil, page_size: nil)
|
48
|
+
self.stream(
|
49
|
+
language: language,
|
50
|
+
model_build: model_build,
|
51
|
+
status: status,
|
52
|
+
limit: limit,
|
53
|
+
page_size: page_size
|
54
|
+
).entries
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Streams QueryInstance records from the API as an Enumerable.
|
59
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
60
|
+
# is reached.
|
61
|
+
# @param [String] language An ISO language-country string that specifies the
|
62
|
+
# language used for this query. For example: en-US.
|
63
|
+
# @param [String] model_build The Model Build Sid or unique name of the Model
|
64
|
+
# Build to be queried.
|
65
|
+
# @param [String] status A string that described the query status. The values can
|
66
|
+
# be: `pending_review`, `reviewed`, `discarded`
|
67
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
68
|
+
# guarantees to never return more than limit. Default is no limit.
|
69
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
70
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
71
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
72
|
+
# efficient page size, i.e. min(limit, 1000)
|
73
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
74
|
+
def stream(language: :unset, model_build: :unset, status: :unset, limit: nil, page_size: nil)
|
75
|
+
limits = @version.read_limits(limit, page_size)
|
76
|
+
|
77
|
+
page = self.page(
|
78
|
+
language: language,
|
79
|
+
model_build: model_build,
|
80
|
+
status: 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 QueryInstance 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 QueryInstance records from the API.
|
103
|
+
# Request is executed immediately.
|
104
|
+
# @param [String] language An ISO language-country string that specifies the
|
105
|
+
# language used for this query. For example: en-US.
|
106
|
+
# @param [String] model_build The Model Build Sid or unique name of the Model
|
107
|
+
# Build to be queried.
|
108
|
+
# @param [String] status A string that described the query status. The values can
|
109
|
+
# be: `pending_review`, `reviewed`, `discarded`
|
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 QueryInstance
|
114
|
+
def page(language: :unset, model_build: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
115
|
+
params = Twilio::Values.of({
|
116
|
+
'Language' => language,
|
117
|
+
'ModelBuild' => model_build,
|
118
|
+
'Status' => status,
|
119
|
+
'PageToken' => page_token,
|
120
|
+
'Page' => page_number,
|
121
|
+
'PageSize' => page_size,
|
122
|
+
})
|
123
|
+
response = @version.page(
|
124
|
+
'GET',
|
125
|
+
@uri,
|
126
|
+
params
|
127
|
+
)
|
128
|
+
QueryPage.new(@version, response, @solution)
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Retrieve a single page of QueryInstance records from the API.
|
133
|
+
# Request is executed immediately.
|
134
|
+
# @param [String] target_url API-generated URL for the requested results page
|
135
|
+
# @return [Page] Page of QueryInstance
|
136
|
+
def get_page(target_url)
|
137
|
+
response = @version.domain.request(
|
138
|
+
'GET',
|
139
|
+
target_url
|
140
|
+
)
|
141
|
+
QueryPage.new(@version, response, @solution)
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# Retrieve a single page of QueryInstance records from the API.
|
146
|
+
# Request is executed immediately.
|
147
|
+
# @param [String] language An ISO language-country string that specifies the
|
148
|
+
# language used for this query. For example: en-US.
|
149
|
+
# @param [String] query A user-provided string that uniquely identifies this
|
150
|
+
# resource as an alternative to the sid. It can be up to 2048 characters long.
|
151
|
+
# @param [String] tasks Constraints the query to a set of tasks. Useful when you
|
152
|
+
# need to constrain the paths the user can take. Tasks should be comma separated
|
153
|
+
# *task-unique-name-1*, *task-unique-name-2*
|
154
|
+
# @param [String] model_build The Model Build Sid or unique name of the Model
|
155
|
+
# Build to be queried.
|
156
|
+
# @return [QueryInstance] Newly created QueryInstance
|
157
|
+
def create(language: nil, query: nil, tasks: :unset, model_build: :unset)
|
158
|
+
data = Twilio::Values.of({
|
159
|
+
'Language' => language,
|
160
|
+
'Query' => query,
|
161
|
+
'Tasks' => tasks,
|
162
|
+
'ModelBuild' => model_build,
|
163
|
+
})
|
164
|
+
|
165
|
+
payload = @version.create(
|
166
|
+
'POST',
|
167
|
+
@uri,
|
168
|
+
data: data
|
169
|
+
)
|
170
|
+
|
171
|
+
QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Provide a user friendly representation
|
176
|
+
def to_s
|
177
|
+
'#<Twilio.Autopilot.V1.QueryList>'
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# 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.
|
183
|
+
class QueryPage < Page
|
184
|
+
##
|
185
|
+
# Initialize the QueryPage
|
186
|
+
# @param [Version] version Version that contains the resource
|
187
|
+
# @param [Response] response Response from the API
|
188
|
+
# @param [Hash] solution Path solution for the resource
|
189
|
+
# @return [QueryPage] QueryPage
|
190
|
+
def initialize(version, response, solution)
|
191
|
+
super(version, response)
|
192
|
+
|
193
|
+
# Path Solution
|
194
|
+
@solution = solution
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Build an instance of QueryInstance
|
199
|
+
# @param [Hash] payload Payload response from the API
|
200
|
+
# @return [QueryInstance] QueryInstance
|
201
|
+
def get_instance(payload)
|
202
|
+
QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
203
|
+
end
|
204
|
+
|
205
|
+
##
|
206
|
+
# Provide a user friendly representation
|
207
|
+
def to_s
|
208
|
+
'<Twilio.Autopilot.V1.QueryPage>'
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
##
|
213
|
+
# 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.
|
214
|
+
class QueryContext < InstanceContext
|
215
|
+
##
|
216
|
+
# Initialize the QueryContext
|
217
|
+
# @param [Version] version Version that contains the resource
|
218
|
+
# @param [String] assistant_sid The assistant_sid
|
219
|
+
# @param [String] sid The sid
|
220
|
+
# @return [QueryContext] QueryContext
|
221
|
+
def initialize(version, assistant_sid, sid)
|
222
|
+
super(version)
|
223
|
+
|
224
|
+
# Path Solution
|
225
|
+
@solution = {assistant_sid: assistant_sid, sid: sid, }
|
226
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Queries/#{@solution[:sid]}"
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# Fetch a QueryInstance
|
231
|
+
# @return [QueryInstance] Fetched QueryInstance
|
232
|
+
def fetch
|
233
|
+
params = Twilio::Values.of({})
|
234
|
+
|
235
|
+
payload = @version.fetch(
|
236
|
+
'GET',
|
237
|
+
@uri,
|
238
|
+
params,
|
239
|
+
)
|
240
|
+
|
241
|
+
QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# Update the QueryInstance
|
246
|
+
# @param [String] sample_sid The sample_sid
|
247
|
+
# @param [String] status A string that described the query status. The values can
|
248
|
+
# be: `pending_review`, `reviewed`, `discarded`
|
249
|
+
# @return [QueryInstance] Updated QueryInstance
|
250
|
+
def update(sample_sid: :unset, status: :unset)
|
251
|
+
data = Twilio::Values.of({'SampleSid' => sample_sid, 'Status' => status, })
|
252
|
+
|
253
|
+
payload = @version.update(
|
254
|
+
'POST',
|
255
|
+
@uri,
|
256
|
+
data: data,
|
257
|
+
)
|
258
|
+
|
259
|
+
QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# Deletes the QueryInstance
|
264
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
265
|
+
def delete
|
266
|
+
@version.delete('delete', @uri)
|
267
|
+
end
|
268
|
+
|
269
|
+
##
|
270
|
+
# Provide a user friendly representation
|
271
|
+
def to_s
|
272
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
273
|
+
"#<Twilio.Autopilot.V1.QueryContext #{context}>"
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
##
|
278
|
+
# 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.
|
279
|
+
class QueryInstance < InstanceResource
|
280
|
+
##
|
281
|
+
# Initialize the QueryInstance
|
282
|
+
# @param [Version] version Version that contains the resource
|
283
|
+
# @param [Hash] payload payload that contains response from Twilio
|
284
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
285
|
+
# @param [String] sid The sid
|
286
|
+
# @return [QueryInstance] QueryInstance
|
287
|
+
def initialize(version, payload, assistant_sid: nil, sid: nil)
|
288
|
+
super(version)
|
289
|
+
|
290
|
+
# Marshaled Properties
|
291
|
+
@properties = {
|
292
|
+
'account_sid' => payload['account_sid'],
|
293
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
294
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
295
|
+
'results' => payload['results'],
|
296
|
+
'language' => payload['language'],
|
297
|
+
'model_build_sid' => payload['model_build_sid'],
|
298
|
+
'query' => payload['query'],
|
299
|
+
'sample_sid' => payload['sample_sid'],
|
300
|
+
'assistant_sid' => payload['assistant_sid'],
|
301
|
+
'sid' => payload['sid'],
|
302
|
+
'status' => payload['status'],
|
303
|
+
'url' => payload['url'],
|
304
|
+
'source_channel' => payload['source_channel'],
|
305
|
+
}
|
306
|
+
|
307
|
+
# Context
|
308
|
+
@instance_context = nil
|
309
|
+
@params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], }
|
310
|
+
end
|
311
|
+
|
312
|
+
##
|
313
|
+
# Generate an instance context for the instance, the context is capable of
|
314
|
+
# performing various actions. All instance actions are proxied to the context
|
315
|
+
# @return [QueryContext] QueryContext for this QueryInstance
|
316
|
+
def context
|
317
|
+
unless @instance_context
|
318
|
+
@instance_context = QueryContext.new(@version, @params['assistant_sid'], @params['sid'], )
|
319
|
+
end
|
320
|
+
@instance_context
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# @return [String] The unique ID of the Account that created this Query.
|
325
|
+
def account_sid
|
326
|
+
@properties['account_sid']
|
327
|
+
end
|
328
|
+
|
329
|
+
##
|
330
|
+
# @return [Time] The date that this resource was created
|
331
|
+
def date_created
|
332
|
+
@properties['date_created']
|
333
|
+
end
|
334
|
+
|
335
|
+
##
|
336
|
+
# @return [Time] The date that this resource was last updated
|
337
|
+
def date_updated
|
338
|
+
@properties['date_updated']
|
339
|
+
end
|
340
|
+
|
341
|
+
##
|
342
|
+
# @return [Hash] The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields.
|
343
|
+
def results
|
344
|
+
@properties['results']
|
345
|
+
end
|
346
|
+
|
347
|
+
##
|
348
|
+
# @return [String] An ISO language-country string that specifies the language used for this query. For example: en-US
|
349
|
+
def language
|
350
|
+
@properties['language']
|
351
|
+
end
|
352
|
+
|
353
|
+
##
|
354
|
+
# @return [String] The unique ID of the Model Build queried.
|
355
|
+
def model_build_sid
|
356
|
+
@properties['model_build_sid']
|
357
|
+
end
|
358
|
+
|
359
|
+
##
|
360
|
+
# @return [String] The end-user's natural language input.
|
361
|
+
def query
|
362
|
+
@properties['query']
|
363
|
+
end
|
364
|
+
|
365
|
+
##
|
366
|
+
# @return [String] An optional reference to the Sample created from this query.
|
367
|
+
def sample_sid
|
368
|
+
@properties['sample_sid']
|
369
|
+
end
|
370
|
+
|
371
|
+
##
|
372
|
+
# @return [String] The unique ID of the parent Assistant.
|
373
|
+
def assistant_sid
|
374
|
+
@properties['assistant_sid']
|
375
|
+
end
|
376
|
+
|
377
|
+
##
|
378
|
+
# @return [String] A 34 character string that uniquely identifies this resource.
|
379
|
+
def sid
|
380
|
+
@properties['sid']
|
381
|
+
end
|
382
|
+
|
383
|
+
##
|
384
|
+
# @return [String] A string that describes the query status. The values can be: `pending_review`, `reviewed`, `discarded`
|
385
|
+
def status
|
386
|
+
@properties['status']
|
387
|
+
end
|
388
|
+
|
389
|
+
##
|
390
|
+
# @return [String] The url
|
391
|
+
def url
|
392
|
+
@properties['url']
|
393
|
+
end
|
394
|
+
|
395
|
+
##
|
396
|
+
# @return [String] The communication channel where this end-user input came from
|
397
|
+
def source_channel
|
398
|
+
@properties['source_channel']
|
399
|
+
end
|
400
|
+
|
401
|
+
##
|
402
|
+
# Fetch a QueryInstance
|
403
|
+
# @return [QueryInstance] Fetched QueryInstance
|
404
|
+
def fetch
|
405
|
+
context.fetch
|
406
|
+
end
|
407
|
+
|
408
|
+
##
|
409
|
+
# Update the QueryInstance
|
410
|
+
# @param [String] sample_sid The sample_sid
|
411
|
+
# @param [String] status A string that described the query status. The values can
|
412
|
+
# be: `pending_review`, `reviewed`, `discarded`
|
413
|
+
# @return [QueryInstance] Updated QueryInstance
|
414
|
+
def update(sample_sid: :unset, status: :unset)
|
415
|
+
context.update(sample_sid: sample_sid, status: status, )
|
416
|
+
end
|
417
|
+
|
418
|
+
##
|
419
|
+
# Deletes the QueryInstance
|
420
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
421
|
+
def delete
|
422
|
+
context.delete
|
423
|
+
end
|
424
|
+
|
425
|
+
##
|
426
|
+
# Provide a user friendly representation
|
427
|
+
def to_s
|
428
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
429
|
+
"<Twilio.Autopilot.V1.QueryInstance #{values}>"
|
430
|
+
end
|
431
|
+
|
432
|
+
##
|
433
|
+
# Provide a detailed, user friendly representation
|
434
|
+
def inspect
|
435
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
436
|
+
"<Twilio.Autopilot.V1.QueryInstance #{values}>"
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
@@ -0,0 +1,215 @@
|
|
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
|
+
##
|
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 StyleSheetList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the StyleSheetList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] assistant_sid The unique ID of the Assistant
|
21
|
+
# @return [StyleSheetList] StyleSheetList
|
22
|
+
def initialize(version, assistant_sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {assistant_sid: assistant_sid}
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Provide a user friendly representation
|
31
|
+
def to_s
|
32
|
+
'#<Twilio.Autopilot.V1.StyleSheetList>'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# 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.
|
38
|
+
class StyleSheetPage < Page
|
39
|
+
##
|
40
|
+
# Initialize the StyleSheetPage
|
41
|
+
# @param [Version] version Version that contains the resource
|
42
|
+
# @param [Response] response Response from the API
|
43
|
+
# @param [Hash] solution Path solution for the resource
|
44
|
+
# @return [StyleSheetPage] StyleSheetPage
|
45
|
+
def initialize(version, response, solution)
|
46
|
+
super(version, response)
|
47
|
+
|
48
|
+
# Path Solution
|
49
|
+
@solution = solution
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Build an instance of StyleSheetInstance
|
54
|
+
# @param [Hash] payload Payload response from the API
|
55
|
+
# @return [StyleSheetInstance] StyleSheetInstance
|
56
|
+
def get_instance(payload)
|
57
|
+
StyleSheetInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Provide a user friendly representation
|
62
|
+
def to_s
|
63
|
+
'<Twilio.Autopilot.V1.StyleSheetPage>'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# 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.
|
69
|
+
class StyleSheetContext < InstanceContext
|
70
|
+
##
|
71
|
+
# Initialize the StyleSheetContext
|
72
|
+
# @param [Version] version Version that contains the resource
|
73
|
+
# @param [String] assistant_sid The unique ID of the Assistant
|
74
|
+
# @return [StyleSheetContext] StyleSheetContext
|
75
|
+
def initialize(version, assistant_sid)
|
76
|
+
super(version)
|
77
|
+
|
78
|
+
# Path Solution
|
79
|
+
@solution = {assistant_sid: assistant_sid, }
|
80
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/StyleSheet"
|
81
|
+
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Fetch a StyleSheetInstance
|
85
|
+
# @return [StyleSheetInstance] Fetched StyleSheetInstance
|
86
|
+
def fetch
|
87
|
+
params = Twilio::Values.of({})
|
88
|
+
|
89
|
+
payload = @version.fetch(
|
90
|
+
'GET',
|
91
|
+
@uri,
|
92
|
+
params,
|
93
|
+
)
|
94
|
+
|
95
|
+
StyleSheetInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Update the StyleSheetInstance
|
100
|
+
# @param [Hash] style_sheet The JSON Style sheet string
|
101
|
+
# @return [StyleSheetInstance] Updated StyleSheetInstance
|
102
|
+
def update(style_sheet: :unset)
|
103
|
+
data = Twilio::Values.of({'StyleSheet' => Twilio.serialize_object(style_sheet), })
|
104
|
+
|
105
|
+
payload = @version.update(
|
106
|
+
'POST',
|
107
|
+
@uri,
|
108
|
+
data: data,
|
109
|
+
)
|
110
|
+
|
111
|
+
StyleSheetInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Provide a user friendly representation
|
116
|
+
def to_s
|
117
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
118
|
+
"#<Twilio.Autopilot.V1.StyleSheetContext #{context}>"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# 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.
|
124
|
+
class StyleSheetInstance < InstanceResource
|
125
|
+
##
|
126
|
+
# Initialize the StyleSheetInstance
|
127
|
+
# @param [Version] version Version that contains the resource
|
128
|
+
# @param [Hash] payload payload that contains response from Twilio
|
129
|
+
# @param [String] assistant_sid The unique ID of the Assistant
|
130
|
+
# @return [StyleSheetInstance] StyleSheetInstance
|
131
|
+
def initialize(version, payload, assistant_sid: nil)
|
132
|
+
super(version)
|
133
|
+
|
134
|
+
# Marshaled Properties
|
135
|
+
@properties = {
|
136
|
+
'account_sid' => payload['account_sid'],
|
137
|
+
'assistant_sid' => payload['assistant_sid'],
|
138
|
+
'url' => payload['url'],
|
139
|
+
'data' => payload['data'],
|
140
|
+
}
|
141
|
+
|
142
|
+
# Context
|
143
|
+
@instance_context = nil
|
144
|
+
@params = {'assistant_sid' => assistant_sid, }
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# Generate an instance context for the instance, the context is capable of
|
149
|
+
# performing various actions. All instance actions are proxied to the context
|
150
|
+
# @return [StyleSheetContext] StyleSheetContext for this StyleSheetInstance
|
151
|
+
def context
|
152
|
+
unless @instance_context
|
153
|
+
@instance_context = StyleSheetContext.new(@version, @params['assistant_sid'], )
|
154
|
+
end
|
155
|
+
@instance_context
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# @return [String] The unique ID of the Account that created this Assistant
|
160
|
+
def account_sid
|
161
|
+
@properties['account_sid']
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# @return [String] The unique ID of the Assistant
|
166
|
+
def assistant_sid
|
167
|
+
@properties['assistant_sid']
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# @return [String] The url
|
172
|
+
def url
|
173
|
+
@properties['url']
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# @return [Hash] The JSON style sheet object
|
178
|
+
def data
|
179
|
+
@properties['data']
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# Fetch a StyleSheetInstance
|
184
|
+
# @return [StyleSheetInstance] Fetched StyleSheetInstance
|
185
|
+
def fetch
|
186
|
+
context.fetch
|
187
|
+
end
|
188
|
+
|
189
|
+
##
|
190
|
+
# Update the StyleSheetInstance
|
191
|
+
# @param [Hash] style_sheet The JSON Style sheet string
|
192
|
+
# @return [StyleSheetInstance] Updated StyleSheetInstance
|
193
|
+
def update(style_sheet: :unset)
|
194
|
+
context.update(style_sheet: style_sheet, )
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Provide a user friendly representation
|
199
|
+
def to_s
|
200
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
201
|
+
"<Twilio.Autopilot.V1.StyleSheetInstance #{values}>"
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# Provide a detailed, user friendly representation
|
206
|
+
def inspect
|
207
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
208
|
+
"<Twilio.Autopilot.V1.StyleSheetInstance #{values}>"
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|