class Twilio::REST::Autopilot::V1::AssistantContext::TaskInstance
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 TaskInstance
@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 Task
resource to fetch.
@return [TaskInstance] TaskInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 332 def initialize(version, payload, assistant_sid: nil, sid: nil) 333 super(version) 334 335 # Marshaled Properties 336 @properties = { 337 'account_sid' => payload['account_sid'], 338 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 339 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 340 'friendly_name' => payload['friendly_name'], 341 'links' => payload['links'], 342 'assistant_sid' => payload['assistant_sid'], 343 'sid' => payload['sid'], 344 'unique_name' => payload['unique_name'], 345 'actions_url' => payload['actions_url'], 346 'url' => payload['url'], 347 } 348 349 # Context 350 @instance_context = nil 351 @params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], } 352 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 367 def account_sid 368 @properties['account_sid'] 369 end
@return [String] The URL from which the Assistant can fetch actions
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 415 def actions_url 416 @properties['actions_url'] 417 end
@return [String] The SID of the Assistant that is the parent of the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 397 def assistant_sid 398 @properties['assistant_sid'] 399 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 [TaskContext] TaskContext
for this TaskInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 358 def context 359 unless @instance_context 360 @instance_context = TaskContext.new(@version, @params['assistant_sid'], @params['sid'], ) 361 end 362 @instance_context 363 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.rb 373 def date_created 374 @properties['date_created'] 375 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.rb 379 def date_updated 380 @properties['date_updated'] 381 end
Delete the TaskInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 457 def delete 458 context.delete 459 end
Fetch the TaskInstance
@return [TaskInstance] Fetched TaskInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 428 def fetch 429 context.fetch 430 end
Access the fields @return [fields] fields
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 464 def fields 465 context.fields 466 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 385 def friendly_name 386 @properties['friendly_name'] 387 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 498 def inspect 499 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 500 "<Twilio.Autopilot.V1.TaskInstance #{values}>" 501 end
@return [String] A list of the URLs of related resources
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 391 def links 392 @properties['links'] 393 end
Access the samples @return [samples] samples
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 471 def samples 472 context.samples 473 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 403 def sid 404 @properties['sid'] 405 end
Access the statistics @return [statistics] statistics
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 485 def statistics 486 context.statistics 487 end
Access the task_actions
@return [task_actions] task_actions
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 478 def task_actions 479 context.task_actions 480 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 491 def to_s 492 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 493 "<Twilio.Autopilot.V1.TaskInstance #{values}>" 494 end
@return [String] An application-defined string that uniquely identifies the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 409 def unique_name 410 @properties['unique_name'] 411 end
Update the TaskInstance
@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 [String] unique_name
An application-defined string that uniquely
identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource.
@param [Hash] actions The JSON string that specifies the
{actions}[https://www.twilio.com/docs/autopilot/actions] that instruct the Assistant on how to perform the task.
@param [String] actions_url
The URL from which the Assistant can fetch actions. @return [TaskInstance] Updated TaskInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 445 def update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset) 446 context.update( 447 friendly_name: friendly_name, 448 unique_name: unique_name, 449 actions: actions, 450 actions_url: actions_url, 451 ) 452 end
@return [String] The absolute URL of the Task resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb 421 def url 422 @properties['url'] 423 end