class Twilio::REST::Autopilot::V1::AssistantContext::QueryInstance

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, payload, assistant_sid: nil, sid: nil) click to toggle source

Initialize the QueryInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] assistant_sid The SID of the

{Assistant}[https://www.twilio.com/docs/autopilot/api/assistant] that is the
parent of the resource.

@param [String] sid The Twilio-provided string that uniquely identifies the

Query resource to fetch.

@return [QueryInstance] QueryInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
304 def initialize(version, payload, assistant_sid: nil, sid: nil)
305   super(version)
306 
307   # Marshaled Properties
308   @properties = {
309       'account_sid' => payload['account_sid'],
310       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
311       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
312       'results' => payload['results'],
313       'language' => payload['language'],
314       'model_build_sid' => payload['model_build_sid'],
315       'query' => payload['query'],
316       'sample_sid' => payload['sample_sid'],
317       'assistant_sid' => payload['assistant_sid'],
318       'sid' => payload['sid'],
319       'status' => payload['status'],
320       'url' => payload['url'],
321       'source_channel' => payload['source_channel'],
322       'dialogue_sid' => payload['dialogue_sid'],
323   }
324 
325   # Context
326   @instance_context = nil
327   @params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], }
328 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
343 def account_sid
344   @properties['account_sid']
345 end
assistant_sid() click to toggle source

@return [String] The SID of the Assistant that is the parent of the resource

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
391 def assistant_sid
392   @properties['assistant_sid']
393 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [QueryContext] QueryContext for this QueryInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
334 def context
335   unless @instance_context
336     @instance_context = QueryContext.new(@version, @params['assistant_sid'], @params['sid'], )
337   end
338   @instance_context
339 end
date_created() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
349 def date_created
350   @properties['date_created']
351 end
date_updated() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
355 def date_updated
356   @properties['date_updated']
357 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
447 def delete
448   context.delete
449 end
dialogue_sid() click to toggle source

@return [String] The SID of the Dialogue.

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
421 def dialogue_sid
422   @properties['dialogue_sid']
423 end
fetch() click to toggle source

Fetch the QueryInstance @return [QueryInstance] Fetched QueryInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
428 def fetch
429   context.fetch
430 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
460 def inspect
461   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
462   "<Twilio.Autopilot.V1.QueryInstance #{values}>"
463 end
language() click to toggle source

@return [String] The ISO language-country string that specifies the language used by the Query

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
367 def language
368   @properties['language']
369 end
model_build_sid() click to toggle source

@return [String] The SID of the Model Build queried

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
373 def model_build_sid
374   @properties['model_build_sid']
375 end
query() click to toggle source

@return [String] The end-user's natural language input

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
379 def query
380   @properties['query']
381 end
results() click to toggle source

@return [Hash] The natural language analysis results that include the Task recognized and a list of identified Fields

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
361 def results
362   @properties['results']
363 end
sample_sid() click to toggle source

@return [String] The SID of an optional reference to the Sample created from the query

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
385 def sample_sid
386   @properties['sample_sid']
387 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
397 def sid
398   @properties['sid']
399 end
source_channel() click to toggle source

@return [String] The communication channel from where the end-user input came

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
415 def source_channel
416   @properties['source_channel']
417 end
status() click to toggle source

@return [String] The status of the Query

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
403 def status
404   @properties['status']
405 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
453 def to_s
454   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
455   "<Twilio.Autopilot.V1.QueryInstance #{values}>"
456 end
update(sample_sid: :unset, status: :unset) click to toggle source

Update the QueryInstance @param [String] sample_sid The SID of an optional reference to the

{Sample}[https://www.twilio.com/docs/autopilot/api/task-sample] created from the
query.

@param [String] status The new status of the resource. Can be: `pending-review`,

`reviewed`, or `discarded`

@return [QueryInstance] Updated QueryInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
440 def update(sample_sid: :unset, status: :unset)
441   context.update(sample_sid: sample_sid, status: status, )
442 end
url() click to toggle source

@return [String] The absolute URL of the Query resource

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb
409 def url
410   @properties['url']
411 end