Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb

Defined Under Namespace

Classes: WorkflowCumulativeStatisticsContext, WorkflowCumulativeStatisticsInstance, WorkflowCumulativeStatisticsList, WorkflowCumulativeStatisticsPage, WorkflowRealTimeStatisticsContext, WorkflowRealTimeStatisticsInstance, WorkflowRealTimeStatisticsList, WorkflowRealTimeStatisticsPage, WorkflowStatisticsContext, WorkflowStatisticsInstance, WorkflowStatisticsList, WorkflowStatisticsPage

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, sid) ⇒ WorkflowContext

Initialize the WorkflowContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the Workflow to fetch.

  • sid (String)

    The SID of the Workflow resource to fetch.


193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 193

def initialize(version, workspace_sid, sid)
  super(version)

  # Path Solution
  @solution = {workspace_sid: workspace_sid, sid: sid, }
  @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workflows/#{@solution[:sid]}"

  # Dependents
  @statistics = nil
  @real_time_statistics = nil
  @cumulative_statistics = nil
end

Instance Method Details

#cumulative_statisticsWorkflowCumulativeStatisticsList, WorkflowCumulativeStatisticsContext

Access the cumulative_statistics


289
290
291
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 289

def cumulative_statistics
  WorkflowCumulativeStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
end

#deleteBoolean

Delete the WorkflowInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


265
266
267
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 265

def delete
   @version.delete('DELETE', @uri)
end

#fetchWorkflowInstance

Fetch the WorkflowInstance

Returns:


209
210
211
212
213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 209

def fetch
  payload = @version.fetch('GET', @uri)

  WorkflowInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


302
303
304
305
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 302

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.WorkflowContext #{context}>"
end

#real_time_statisticsWorkflowRealTimeStatisticsList, WorkflowRealTimeStatisticsContext

Access the real_time_statistics


281
282
283
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 281

def real_time_statistics
  WorkflowRealTimeStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
end

#statisticsWorkflowStatisticsList, WorkflowStatisticsContext

Access the statistics


273
274
275
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 273

def statistics
  WorkflowStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
end

#to_sObject

Provide a user friendly representation


295
296
297
298
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 295

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.WorkflowContext #{context}>"
end

#update(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset, re_evaluate_tasks: :unset) ⇒ WorkflowInstance

Update the WorkflowInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`.

  • assignment_callback_url (String) (defaults to: :unset)

    The URL from your application that will process task assignment events. See Handling Task Assignment Callback for more details.

  • fallback_assignment_callback_url (String) (defaults to: :unset)

    The URL that we should call when a call to the `assignment_callback_url` fails.

  • configuration (String) (defaults to: :unset)

    A JSON string that contains the rules to apply to the Workflow. See Configuring Workflows for more information.

  • task_reservation_timeout (String) (defaults to: :unset)

    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`.

  • re_evaluate_tasks (String) (defaults to: :unset)

    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.

Returns:


242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 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)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'AssignmentCallbackUrl' => assignment_callback_url,
      'FallbackAssignmentCallbackUrl' => fallback_assignment_callback_url,
      'Configuration' => configuration,
      'TaskReservationTimeout' => task_reservation_timeout,
      'ReEvaluateTasks' => re_evaluate_tasks,
  })

  payload = @version.update('POST', @uri, data: data)

  WorkflowInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      sid: @solution[:sid],
  )
end