class Twilio::REST::Preview::Understand::AssistantContext::TaskContext::SampleInstance

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

Initialize the SampleInstance @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 Assistant. @param [String] task_sid The unique ID of the Task associated with this Sample. @param [String] sid A 34 character string that uniquely identifies this

resource.

@return [SampleInstance] SampleInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
280 def initialize(version, payload, assistant_sid: nil, task_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       'task_sid' => payload['task_sid'],
289       'language' => payload['language'],
290       'assistant_sid' => payload['assistant_sid'],
291       'sid' => payload['sid'],
292       'tagged_text' => payload['tagged_text'],
293       'url' => payload['url'],
294       'source_channel' => payload['source_channel'],
295   }
296 
297   # Context
298   @instance_context = nil
299   @params = {
300       'assistant_sid' => assistant_sid,
301       'task_sid' => task_sid,
302       'sid' => sid || @properties['sid'],
303   }
304 end

Public Instance Methods

account_sid() click to toggle source

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

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

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
354 def assistant_sid
355   @properties['assistant_sid']
356 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 [SampleContext] SampleContext for this SampleInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
310 def context
311   unless @instance_context
312     @instance_context = SampleContext.new(
313         @version,
314         @params['assistant_sid'],
315         @params['task_sid'],
316         @params['sid'],
317     )
318   end
319   @instance_context
320 end
date_created() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
330 def date_created
331   @properties['date_created']
332 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/task/sample.rb
336 def date_updated
337   @properties['date_updated']
338 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
405 def delete
406   context.delete
407 end
fetch() click to toggle source

Fetch the SampleInstance @return [SampleInstance] Fetched SampleInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
385 def fetch
386   context.fetch
387 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
418 def inspect
419   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
420   "<Twilio.Preview.Understand.SampleInstance #{values}>"
421 end
language() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
348 def language
349   @properties['language']
350 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/task/sample.rb
360 def sid
361   @properties['sid']
362 end
source_channel() click to toggle source

@return [String] The communication channel the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included the value will be null

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

@return [String] The text example of how end-users may express this task. The sample may contain Field tag blocks.

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
366 def tagged_text
367   @properties['tagged_text']
368 end
task_sid() click to toggle source

@return [String] The unique ID of the Task associated with this Sample.

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

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
411 def to_s
412   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
413   "<Twilio.Preview.Understand.SampleInstance #{values}>"
414 end
update(language: :unset, tagged_text: :unset, source_channel: :unset) click to toggle source

Update the SampleInstance @param [String] language An ISO language-country string of the sample. @param [String] tagged_text The text example of how end-users may express this

task. The sample may contain Field tag blocks.

@param [String] source_channel The communication channel the sample was

captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or
*slack*. If not included the value will be null

@return [SampleInstance] Updated SampleInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
398 def update(language: :unset, tagged_text: :unset, source_channel: :unset)
399   context.update(language: language, tagged_text: tagged_text, source_channel: source_channel, )
400 end
url() click to toggle source

@return [String] The url

    # File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb
372 def url
373   @properties['url']
374 end