class Twilio::REST::Preview::Understand::AssistantContext

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.

Public Class Methods

new(version, sid) click to toggle source

Initialize the AssistantContext @param [Version] version Version that contains the resource @param [String] sid A 34 character string that uniquely identifies this

resource.

@return [AssistantContext] AssistantContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
192 def initialize(version, sid)
193   super(version)
194 
195   # Path Solution
196   @solution = {sid: sid, }
197   @uri = "/Assistants/#{@solution[:sid]}"
198 
199   # Dependents
200   @field_types = nil
201   @tasks = nil
202   @model_builds = nil
203   @queries = nil
204   @assistant_fallback_actions = nil
205   @assistant_initiation_actions = nil
206   @dialogues = nil
207   @style_sheet = nil
208 end

Public Instance Methods

assistant_fallback_actions() click to toggle source

Access the assistant_fallback_actions @return [AssistantFallbackActionsList] @return [AssistantFallbackActionsContext]

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
339 def assistant_fallback_actions
340   AssistantFallbackActionsContext.new(@version, @solution[:sid], )
341 end
assistant_initiation_actions() click to toggle source

Access the assistant_initiation_actions @return [AssistantInitiationActionsList] @return [AssistantInitiationActionsContext]

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
347 def assistant_initiation_actions
348   AssistantInitiationActionsContext.new(@version, @solution[:sid], )
349 end
delete() click to toggle source

Delete the AssistantInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
259 def delete
260    @version.delete('DELETE', @uri)
261 end
dialogues(sid=:unset) click to toggle source

Access the dialogues @return [DialogueList] @return [DialogueContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
355 def dialogues(sid=:unset)
356   raise ArgumentError, 'sid cannot be nil' if sid.nil?
357 
358   if sid != :unset
359     return DialogueContext.new(@version, @solution[:sid], sid, )
360   end
361 
362   unless @dialogues
363     @dialogues = DialogueList.new(@version, assistant_sid: @solution[:sid], )
364   end
365 
366   @dialogues
367 end
fetch() click to toggle source

Fetch the AssistantInstance @return [AssistantInstance] Fetched AssistantInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
213 def fetch
214   payload = @version.fetch('GET', @uri)
215 
216   AssistantInstance.new(@version, payload, sid: @solution[:sid], )
217 end
field_types(sid=:unset) click to toggle source

Access the field_types @return [FieldTypeList] @return [FieldTypeContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
267 def field_types(sid=:unset)
268   raise ArgumentError, 'sid cannot be nil' if sid.nil?
269 
270   if sid != :unset
271     return FieldTypeContext.new(@version, @solution[:sid], sid, )
272   end
273 
274   unless @field_types
275     @field_types = FieldTypeList.new(@version, assistant_sid: @solution[:sid], )
276   end
277 
278   @field_types
279 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
386 def inspect
387   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
388   "#<Twilio.Preview.Understand.AssistantContext #{context}>"
389 end
model_builds(sid=:unset) click to toggle source

Access the model_builds @return [ModelBuildList] @return [ModelBuildContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
303 def model_builds(sid=:unset)
304   raise ArgumentError, 'sid cannot be nil' if sid.nil?
305 
306   if sid != :unset
307     return ModelBuildContext.new(@version, @solution[:sid], sid, )
308   end
309 
310   unless @model_builds
311     @model_builds = ModelBuildList.new(@version, assistant_sid: @solution[:sid], )
312   end
313 
314   @model_builds
315 end
queries(sid=:unset) click to toggle source

Access the queries @return [QueryList] @return [QueryContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
321 def queries(sid=:unset)
322   raise ArgumentError, 'sid cannot be nil' if sid.nil?
323 
324   if sid != :unset
325     return QueryContext.new(@version, @solution[:sid], sid, )
326   end
327 
328   unless @queries
329     @queries = QueryList.new(@version, assistant_sid: @solution[:sid], )
330   end
331 
332   @queries
333 end
style_sheet() click to toggle source

Access the style_sheet @return [StyleSheetList] @return [StyleSheetContext]

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
373 def style_sheet
374   StyleSheetContext.new(@version, @solution[:sid], )
375 end
tasks(sid=:unset) click to toggle source

Access the tasks @return [TaskList] @return [TaskContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
285 def tasks(sid=:unset)
286   raise ArgumentError, 'sid cannot be nil' if sid.nil?
287 
288   if sid != :unset
289     return TaskContext.new(@version, @solution[:sid], sid, )
290   end
291 
292   unless @tasks
293     @tasks = TaskList.new(@version, assistant_sid: @solution[:sid], )
294   end
295 
296   @tasks
297 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
379 def to_s
380   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
381   "#<Twilio.Preview.Understand.AssistantContext #{context}>"
382 end
update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset, style_sheet: :unset) click to toggle source

Update the AssistantInstance @param [String] friendly_name A text description for the Assistant. It is

non-unique and can up to 255 characters long.

@param [Boolean] log_queries A boolean that specifies whether queries should be

logged for 30 days further training. If false, no queries will be stored, if
true, queries will be stored for 30 days and deleted thereafter. Defaults to
true if no value is provided.

@param [String] unique_name A user-provided string that uniquely identifies this

resource as an alternative to the sid. Unique up to 64 characters long.

@param [String] callback_url A user-provided URL to send event callbacks to. @param [String] callback_events Space-separated list of callback events that

will trigger callbacks.

@param [Hash] fallback_actions The JSON actions to be executed when the user's

input is not recognized as matching any Task.

@param [Hash] initiation_actions The JSON actions to be executed on inbound

phone calls when the Assistant has to say something first.

@param [Hash] style_sheet The JSON object that holds the style sheet for the

assistant

@return [AssistantInstance] Updated AssistantInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant.rb
239 def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset, style_sheet: :unset)
240   data = Twilio::Values.of({
241       'FriendlyName' => friendly_name,
242       'LogQueries' => log_queries,
243       'UniqueName' => unique_name,
244       'CallbackUrl' => callback_url,
245       'CallbackEvents' => callback_events,
246       'FallbackActions' => Twilio.serialize_object(fallback_actions),
247       'InitiationActions' => Twilio.serialize_object(initiation_actions),
248       'StyleSheet' => Twilio.serialize_object(style_sheet),
249   })
250 
251   payload = @version.update('POST', @uri, data: data)
252 
253   AssistantInstance.new(@version, payload, sid: @solution[:sid], )
254 end