class Twilio::REST::Autopilot::V1::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 The Twilio-provided string that uniquely identifies the

Assistant resource to fetch.

@return [AssistantContext] AssistantContext

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

Public Instance Methods

defaults() click to toggle source

Access the defaults @return [DefaultsList] @return [DefaultsContext]

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
344 def defaults
345   DefaultsContext.new(@version, @solution[:sid], )
346 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
256 def delete
257    @version.delete('DELETE', @uri)
258 end
dialogues(sid=:unset) click to toggle source

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

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

Fetch the AssistantInstance @return [AssistantInstance] Fetched AssistantInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
210 def fetch
211   payload = @version.fetch('GET', @uri)
212 
213   AssistantInstance.new(@version, payload, sid: @solution[:sid], )
214 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/autopilot/v1/assistant.rb
264 def field_types(sid=:unset)
265   raise ArgumentError, 'sid cannot be nil' if sid.nil?
266 
267   if sid != :unset
268     return FieldTypeContext.new(@version, @solution[:sid], sid, )
269   end
270 
271   unless @field_types
272     @field_types = FieldTypeList.new(@version, assistant_sid: @solution[:sid], )
273   end
274 
275   @field_types
276 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
393 def inspect
394   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
395   "#<Twilio.Autopilot.V1.AssistantContext #{context}>"
396 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/autopilot/v1/assistant.rb
300 def model_builds(sid=:unset)
301   raise ArgumentError, 'sid cannot be nil' if sid.nil?
302 
303   if sid != :unset
304     return ModelBuildContext.new(@version, @solution[:sid], sid, )
305   end
306 
307   unless @model_builds
308     @model_builds = ModelBuildList.new(@version, assistant_sid: @solution[:sid], )
309   end
310 
311   @model_builds
312 end
queries(sid=:unset) click to toggle source

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

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

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

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
336 def style_sheet
337   StyleSheetContext.new(@version, @solution[:sid], )
338 end
tasks(sid=:unset) click to toggle source

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

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

Provide a user friendly representation

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
386 def to_s
387   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
388   "#<Twilio.Autopilot.V1.AssistantContext #{context}>"
389 end
update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset, development_stage: :unset) click to toggle source

Update the AssistantInstance @param [String] friendly_name A descriptive string that you create to describe

the resource. It is not unique and can be up to 255 characters long.

@param [Boolean] log_queries Whether queries should be logged and kept after

training. Can be: `true` or `false` and defaults to `true`. If `true`, queries
are stored for 30 days, and then deleted. If `false`, no queries are stored.

@param [String] unique_name An application-defined string that uniquely

identifies the resource. It can be used as an alternative to the `sid` in the
URL path to address the resource. The first 64 characters must be unique.

@param [String] callback_url Reserved. @param [String] callback_events Reserved. @param [Hash] style_sheet The JSON string that defines the Assistant's {style

sheet}[https://www.twilio.com/docs/autopilot/api/assistant/stylesheet]

@param [Hash] defaults A JSON object that defines the Assistant's {default

tasks}[https://www.twilio.com/docs/autopilot/api/assistant/defaults] for various
scenarios, including initiation actions and fallback tasks.

@param [String] development_stage A string describing the state of the

assistant.

@return [AssistantInstance] Updated AssistantInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
236 def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset, development_stage: :unset)
237   data = Twilio::Values.of({
238       'FriendlyName' => friendly_name,
239       'LogQueries' => log_queries,
240       'UniqueName' => unique_name,
241       'CallbackUrl' => callback_url,
242       'CallbackEvents' => callback_events,
243       'StyleSheet' => Twilio.serialize_object(style_sheet),
244       'Defaults' => Twilio.serialize_object(defaults),
245       'DevelopmentStage' => development_stage,
246   })
247 
248   payload = @version.update('POST', @uri, data: data)
249 
250   AssistantInstance.new(@version, payload, sid: @solution[:sid], )
251 end
webhooks(sid=:unset) click to toggle source

Access the webhooks @return [WebhookList] @return [WebhookContext] if sid was passed.

    # File lib/twilio-ruby/rest/autopilot/v1/assistant.rb
370 def webhooks(sid=:unset)
371   raise ArgumentError, 'sid cannot be nil' if sid.nil?
372 
373   if sid != :unset
374     return WebhookContext.new(@version, @solution[:sid], sid, )
375   end
376 
377   unless @webhooks
378     @webhooks = WebhookList.new(@version, assistant_sid: @solution[:sid], )
379   end
380 
381   @webhooks
382 end