class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowContext

Public Class Methods

new(version, workspace_sid, sid) click to toggle source

Initialize the WorkflowContext @param [Version] version Version that contains the resource @param [String] workspace_sid The SID of the Workspace with the Workflow to

fetch.

@param [String] sid The SID of the Workflow resource to fetch. @return [WorkflowContext] WorkflowContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
193 def initialize(version, workspace_sid, sid)
194   super(version)
195 
196   # Path Solution
197   @solution = {workspace_sid: workspace_sid, sid: sid, }
198   @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workflows/#{@solution[:sid]}"
199 
200   # Dependents
201   @statistics = nil
202   @real_time_statistics = nil
203   @cumulative_statistics = nil
204 end

Public Instance Methods

cumulative_statistics() click to toggle source

Access the cumulative_statistics @return [WorkflowCumulativeStatisticsList] @return [WorkflowCumulativeStatisticsContext]

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
289 def cumulative_statistics
290   WorkflowCumulativeStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
291 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
265 def delete
266    @version.delete('DELETE', @uri)
267 end
fetch() click to toggle source

Fetch the WorkflowInstance @return [WorkflowInstance] Fetched WorkflowInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
209 def fetch
210   payload = @version.fetch('GET', @uri)
211 
212   WorkflowInstance.new(
213       @version,
214       payload,
215       workspace_sid: @solution[:workspace_sid],
216       sid: @solution[:sid],
217   )
218 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
302 def inspect
303   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
304   "#<Twilio.Taskrouter.V1.WorkflowContext #{context}>"
305 end
real_time_statistics() click to toggle source

Access the real_time_statistics @return [WorkflowRealTimeStatisticsList] @return [WorkflowRealTimeStatisticsContext]

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
281 def real_time_statistics
282   WorkflowRealTimeStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
283 end
statistics() click to toggle source

Access the statistics @return [WorkflowStatisticsList] @return [WorkflowStatisticsContext]

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
273 def statistics
274   WorkflowStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
275 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb
295 def to_s
296   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
297   "#<Twilio.Taskrouter.V1.WorkflowContext #{context}>"
298 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
242 def update(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset, re_evaluate_tasks: :unset)
243   data = Twilio::Values.of({
244       'FriendlyName' => friendly_name,
245       'AssignmentCallbackUrl' => assignment_callback_url,
246       'FallbackAssignmentCallbackUrl' => fallback_assignment_callback_url,
247       'Configuration' => configuration,
248       'TaskReservationTimeout' => task_reservation_timeout,
249       'ReEvaluateTasks' => re_evaluate_tasks,
250   })
251 
252   payload = @version.update('POST', @uri, data: data)
253 
254   WorkflowInstance.new(
255       @version,
256       payload,
257       workspace_sid: @solution[:workspace_sid],
258       sid: @solution[:sid],
259   )
260 end