Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, workspace_sid: nil, sid: nil) ⇒ WorkflowInstance

Initialize the WorkflowInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • workspace_sid (String) (defaults to: nil)

    The workspace_sid

  • sid (String) (defaults to: nil)

    The sid



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 329

def initialize(version, payload, workspace_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'assignment_callback_url' => payload['assignment_callback_url'],
      'configuration' => payload['configuration'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'document_content_type' => payload['document_content_type'],
      'fallback_assignment_callback_url' => payload['fallback_assignment_callback_url'],
      'friendly_name' => payload['friendly_name'],
      'sid' => payload['sid'],
      'task_reservation_timeout' => payload['task_reservation_timeout'].to_i,
      'workspace_sid' => payload['workspace_sid'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {
      'workspace_sid' => workspace_sid,
      'sid' => sid || @properties['sid'],
  }
end

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



374
375
376
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 374

def 
  @properties['account_sid']
end

#assignment_callback_urlString

Returns The assignment_callback_url.

Returns:

  • (String)

    The assignment_callback_url



380
381
382
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 380

def assignment_callback_url
  @properties['assignment_callback_url']
end

#configurationString

Returns The configuration.

Returns:

  • (String)

    The configuration



386
387
388
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 386

def configuration
  @properties['configuration']
end

#contextWorkflowContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



361
362
363
364
365
366
367
368
369
370
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 361

def context
  unless @instance_context
    @instance_context = WorkflowContext.new(
        @version,
        @params['workspace_sid'],
        @params['sid'],
    )
  end
  @instance_context
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created



392
393
394
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 392

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated



398
399
400
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 398

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the WorkflowInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



479
480
481
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 479

def delete
  context.delete
end

#document_content_typeString

Returns The document_content_type.

Returns:

  • (String)

    The document_content_type



404
405
406
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 404

def document_content_type
  @properties['document_content_type']
end

#fallback_assignment_callback_urlString

Returns The fallback_assignment_callback_url.

Returns:

  • (String)

    The fallback_assignment_callback_url



410
411
412
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 410

def fallback_assignment_callback_url
  @properties['fallback_assignment_callback_url']
end

#fetchWorkflowInstance

Fetch a WorkflowInstance

Returns:



453
454
455
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 453

def fetch
  context.fetch
end

#friendly_nameString

Returns The friendly_name.

Returns:

  • (String)

    The friendly_name



416
417
418
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 416

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



513
514
515
516
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 513

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Taskrouter.V1.WorkflowInstance #{values}>"
end

Returns The links.

Returns:

  • (String)

    The links



446
447
448
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 446

def links
  @properties['links']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



422
423
424
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 422

def sid
  @properties['sid']
end

#statisticsstatistics

Access the statistics

Returns:



486
487
488
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 486

def statistics
  context.statistics
end

#task_reservation_timeoutString

Returns The task_reservation_timeout.

Returns:

  • (String)

    The task_reservation_timeout



428
429
430
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 428

def task_reservation_timeout
  @properties['task_reservation_timeout']
end

#to_sObject

Provide a user friendly representation



506
507
508
509
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 506

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Taskrouter.V1.WorkflowInstance #{values}>"
end

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

Update the WorkflowInstance

Parameters:

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

    The friendly_name

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

    The assignment_callback_url

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

    The fallback_assignment_callback_url

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

    The configuration

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

    The task_reservation_timeout

Returns:



466
467
468
469
470
471
472
473
474
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 466

def update(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset)
  context.update(
      friendly_name: friendly_name,
      assignment_callback_url: assignment_callback_url,
      fallback_assignment_callback_url: fallback_assignment_callback_url,
      configuration: configuration,
      task_reservation_timeout: task_reservation_timeout,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



440
441
442
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 440

def url
  @properties['url']
end

#workflow_cumulative_statisticsworkflow_cumulative_statistics

Access the workflow_cumulative_statistics

Returns:



500
501
502
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 500

def workflow_cumulative_statistics
  context.workflow_cumulative_statistics
end

#workflow_real_time_statisticsworkflow_real_time_statistics

Access the workflow_real_time_statistics

Returns:



493
494
495
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 493

def workflow_real_time_statistics
  context.workflow_real_time_statistics
end

#workspace_sidString

Returns The workspace_sid.

Returns:

  • (String)

    The workspace_sid



434
435
436
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb', line 434

def workspace_sid
  @properties['workspace_sid']
end