class Twilio::REST::Preview::Understand::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 unique ID of the parent Assistant. @param [String] sid A 34 character string that uniquely identifies this

resource.

@return [QueryInstance] QueryInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
280 def initialize(version, payload, assistant_sid: nil, sid: nil)
281   super(version)
282 
283   # Marshaled Properties
284   @properties = {
285       'account_sid' => payload['account_sid'],
286       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
287       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
288       'results' => payload['results'],
289       'language' => payload['language'],
290       'model_build_sid' => payload['model_build_sid'],
291       'query' => payload['query'],
292       'sample_sid' => payload['sample_sid'],
293       'assistant_sid' => payload['assistant_sid'],
294       'sid' => payload['sid'],
295       'status' => payload['status'],
296       'url' => payload['url'],
297       'source_channel' => payload['source_channel'],
298   }
299 
300   # Context
301   @instance_context = nil
302   @params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], }
303 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The unique ID of the Account that created this Query.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
318 def account_sid
319   @properties['account_sid']
320 end
assistant_sid() click to toggle source

@return [String] The unique ID of the parent Assistant.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
366 def assistant_sid
367   @properties['assistant_sid']
368 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/preview/understand/assistant/query.rb
309 def context
310   unless @instance_context
311     @instance_context = QueryContext.new(@version, @params['assistant_sid'], @params['sid'], )
312   end
313   @instance_context
314 end
date_created() click to toggle source

@return [Time] The date that this resource was created

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
324 def date_created
325   @properties['date_created']
326 end
date_updated() click to toggle source

@return [Time] The date that this resource was last updated

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
330 def date_updated
331   @properties['date_updated']
332 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
415 def delete
416   context.delete
417 end
fetch() click to toggle source

Fetch the QueryInstance @return [QueryInstance] Fetched QueryInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
397 def fetch
398   context.fetch
399 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
428 def inspect
429   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
430   "<Twilio.Preview.Understand.QueryInstance #{values}>"
431 end
language() click to toggle source

@return [String] An ISO language-country string of the sample.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
342 def language
343   @properties['language']
344 end
model_build_sid() click to toggle source

@return [String] The unique ID of the Model Build queried.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
348 def model_build_sid
349   @properties['model_build_sid']
350 end
query() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
354 def query
355   @properties['query']
356 end
results() click to toggle source

@return [Hash] The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
336 def results
337   @properties['results']
338 end
sample_sid() click to toggle source

@return [String] An optional reference to the Sample created from this query.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
360 def sample_sid
361   @properties['sample_sid']
362 end
sid() click to toggle source

@return [String] A 34 character string that uniquely identifies this resource.

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
372 def sid
373   @properties['sid']
374 end
source_channel() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
390 def source_channel
391   @properties['source_channel']
392 end
status() click to toggle source

@return [String] A string that described the query status. The values can be: pending_review, reviewed, discarded

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
378 def status
379   @properties['status']
380 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
421 def to_s
422   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
423   "<Twilio.Preview.Understand.QueryInstance #{values}>"
424 end
update(sample_sid: :unset, status: :unset) click to toggle source

Update the QueryInstance @param [String] sample_sid An optional reference to the Sample created from this

query.

@param [String] status A string that described the query status. The values can

be: pending_review, reviewed, discarded

@return [QueryInstance] Updated QueryInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
408 def update(sample_sid: :unset, status: :unset)
409   context.update(sample_sid: sample_sid, status: status, )
410 end
url() click to toggle source

@return [String] The url

    # File lib/twilio-ruby/rest/preview/understand/assistant/query.rb
384 def url
385   @properties['url']
386 end