class Twilio::REST::Autopilot::V1::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
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 SID of the
{Assistant}[https://www.twilio.com/docs/autopilot/api/assistant] that is the parent of the Task associated with the resource.
@param [String] task_sid
The SID of the
{Task}[https://www.twilio.com/docs/autopilot/api/task] associated with the resource.
@param [String] sid The Twilio-provided string that uniquely identifies the
Sample resource to fetch.
@return [SampleInstance] SampleInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 305 def initialize(version, payload, assistant_sid: nil, task_sid: nil, sid: nil) 306 super(version) 307 308 # Marshaled Properties 309 @properties = { 310 'account_sid' => payload['account_sid'], 311 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 312 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 313 'task_sid' => payload['task_sid'], 314 'language' => payload['language'], 315 'assistant_sid' => payload['assistant_sid'], 316 'sid' => payload['sid'], 317 'tagged_text' => payload['tagged_text'], 318 'url' => payload['url'], 319 'source_channel' => payload['source_channel'], 320 } 321 322 # Context 323 @instance_context = nil 324 @params = { 325 'assistant_sid' => assistant_sid, 326 'task_sid' => task_sid, 327 'sid' => sid || @properties['sid'], 328 } 329 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 349 def account_sid 350 @properties['account_sid'] 351 end
@return [String] The SID of the Assistant that is the parent of the Task associated with the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 379 def assistant_sid 380 @properties['assistant_sid'] 381 end
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/autopilot/v1/assistant/task/sample.rb 335 def context 336 unless @instance_context 337 @instance_context = SampleContext.new( 338 @version, 339 @params['assistant_sid'], 340 @params['task_sid'], 341 @params['sid'], 342 ) 343 end 344 @instance_context 345 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 355 def date_created 356 @properties['date_created'] 357 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 361 def date_updated 362 @properties['date_updated'] 363 end
Delete the SampleInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 433 def delete 434 context.delete 435 end
Fetch the SampleInstance
@return [SampleInstance] Fetched SampleInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 410 def fetch 411 context.fetch 412 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 446 def inspect 447 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 448 "<Twilio.Autopilot.V1.SampleInstance #{values}>" 449 end
@return [String] An ISO language-country string that specifies the language used for the sample
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 373 def language 374 @properties['language'] 375 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 385 def sid 386 @properties['sid'] 387 end
@return [String] The communication channel from which the sample was captured
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 403 def source_channel 404 @properties['source_channel'] 405 end
@return [String] The text example of how end users might express the task
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 391 def tagged_text 392 @properties['tagged_text'] 393 end
@return [String] The SID of the Task associated with the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 367 def task_sid 368 @properties['task_sid'] 369 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 439 def to_s 440 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 441 "<Twilio.Autopilot.V1.SampleInstance #{values}>" 442 end
Update the SampleInstance
@param [String] language The {ISO
language-country}[https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html] string that specifies the language used for the sample. For example: `en-US`.
@param [String] tagged_text
The text example of how end users might express the
task. The sample can contain {Field tag blocks}[https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging].
@param [String] source_channel
The communication channel from which the sample
was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included.
@return [SampleInstance] Updated SampleInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 426 def update(language: :unset, tagged_text: :unset, source_channel: :unset) 427 context.update(language: language, tagged_text: tagged_text, source_channel: source_channel, ) 428 end
@return [String] The absolute URL of the Sample resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb 397 def url 398 @properties['url'] 399 end