class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowInstance

Public Class Methods

new(version, payload, workspace_sid: nil, sid: nil) click to toggle source

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

Calls superclass method 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

account_sid() click to toggle source

@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
assignment_callback_url() click to toggle source

@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
configuration() click to toggle source

@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
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 [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
cumulative_statistics() click to toggle source

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
date_created() click to toggle source

@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
date_updated() click to toggle source

@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() click to toggle source

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
document_content_type() click to toggle source

@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
fallback_assignment_callback_url() click to toggle source

@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() click to toggle source

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
friendly_name() click to toggle source

@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
inspect() click to toggle source

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
real_time_statistics() click to toggle source

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
sid() click to toggle source

@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
statistics() click to toggle source

Access the statistics @return [statistics] statistics

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
481 def statistics
482   context.statistics
483 end
task_reservation_timeout() click to toggle source

@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
to_s() click to toggle source

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(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset, re_evaluate_tasks: :unset) click to toggle source

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
url() click to toggle source

@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
workspace_sid() click to toggle source

@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