class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowInstance
Public Class Methods
Initialize the WorkflowInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] workspace_sid
The SID of the Workspace that contains the
Workflow.
@param [String] sid The SID of the Workflow resource to fetch. @return [WorkflowInstance] WorkflowInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 317 def initialize(version, payload, workspace_sid: nil, sid: nil) 318 super(version) 319 320 # Marshaled Properties 321 @properties = { 322 'account_sid' => payload['account_sid'], 323 'assignment_callback_url' => payload['assignment_callback_url'], 324 'configuration' => payload['configuration'], 325 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 326 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 327 'document_content_type' => payload['document_content_type'], 328 'fallback_assignment_callback_url' => payload['fallback_assignment_callback_url'], 329 'friendly_name' => payload['friendly_name'], 330 'sid' => payload['sid'], 331 'task_reservation_timeout' => payload['task_reservation_timeout'].to_i, 332 'workspace_sid' => payload['workspace_sid'], 333 'url' => payload['url'], 334 'links' => payload['links'], 335 } 336 337 # Context 338 @instance_context = nil 339 @params = {'workspace_sid' => workspace_sid, 'sid' => sid || @properties['sid'], } 340 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 355 def account_sid 356 @properties['account_sid'] 357 end
@return [String] The URL that we call when a task managed by the Workflow is assigned to a Worker
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 361 def assignment_callback_url 362 @properties['assignment_callback_url'] 363 end
@return [String] A JSON string that contains the Workflow's configuration
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 367 def configuration 368 @properties['configuration'] 369 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 [WorkflowContext] WorkflowContext
for this WorkflowInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 346 def context 347 unless @instance_context 348 @instance_context = WorkflowContext.new(@version, @params['workspace_sid'], @params['sid'], ) 349 end 350 @instance_context 351 end
Access the cumulative_statistics
@return [cumulative_statistics] cumulative_statistics
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 495 def cumulative_statistics 496 context.cumulative_statistics 497 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.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/taskrouter/v1/workspace/workflow.rb 379 def date_updated 380 @properties['date_updated'] 381 end
Delete the WorkflowInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 474 def delete 475 context.delete 476 end
@return [String] The MIME type of the document
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 385 def document_content_type 386 @properties['document_content_type'] 387 end
@return [String] The URL that we call when a call to the `assignment_callback_url` fails
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 391 def fallback_assignment_callback_url 392 @properties['fallback_assignment_callback_url'] 393 end
Fetch the WorkflowInstance
@return [WorkflowInstance] Fetched WorkflowInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 434 def fetch 435 context.fetch 436 end
@return [String] The string that you assigned to describe the Workflow resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 397 def friendly_name 398 @properties['friendly_name'] 399 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 508 def inspect 509 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 510 "<Twilio.Taskrouter.V1.WorkflowInstance #{values}>" 511 end
@return [String] The URLs of related resources
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 427 def links 428 @properties['links'] 429 end
Access the real_time_statistics
@return [real_time_statistics] real_time_statistics
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 488 def real_time_statistics 489 context.real_time_statistics 490 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 403 def sid 404 @properties['sid'] 405 end
Access the statistics @return [statistics] statistics
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 481 def statistics 482 context.statistics 483 end
@return [String] How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 409 def task_reservation_timeout 410 @properties['task_reservation_timeout'] 411 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 501 def to_s 502 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 503 "<Twilio.Taskrouter.V1.WorkflowInstance #{values}>" 504 end
Update the WorkflowInstance
@param [String] friendly_name
A descriptive string that you create to describe
the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`.
@param [String] assignment_callback_url
The URL from your application that will
process task assignment events. See {Handling Task Assignment Callback}[https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks] for more details.
@param [String] fallback_assignment_callback_url
The URL that we should call
when a call to the `assignment_callback_url` fails.
@param [String] configuration A JSON string that contains the rules to apply to
the Workflow. See {Configuring Workflows}[https://www.twilio.com/docs/taskrouter/workflow-configuration] for more information.
@param [String] task_reservation_timeout
How long TaskRouter will wait for a
confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`.
@param [String] re_evaluate_tasks Whether or not to re-evaluate Tasks. The
default is `false`, which means Tasks in the Workflow will not be processed through the assignment loop again.
@return [WorkflowInstance] Updated WorkflowInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 460 def update(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset, re_evaluate_tasks: :unset) 461 context.update( 462 friendly_name: friendly_name, 463 assignment_callback_url: assignment_callback_url, 464 fallback_assignment_callback_url: fallback_assignment_callback_url, 465 configuration: configuration, 466 task_reservation_timeout: task_reservation_timeout, 467 re_evaluate_tasks: re_evaluate_tasks, 468 ) 469 end
@return [String] The absolute URL of the Workflow resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 421 def url 422 @properties['url'] 423 end
@return [String] The SID of the Workspace that contains the Workflow
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb 415 def workspace_sid 416 @properties['workspace_sid'] 417 end