Class: Twilio::REST::Studio::V2::FlowInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/studio/v2/flow.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ FlowInstance

Initialize the FlowInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The SID of the Flow resource to fetch.



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 310

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

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'friendly_name' => payload['friendly_name'],
      'definition' => payload['definition'],
      'status' => payload['status'],
      'revision' => payload['revision'].to_i,
      'commit_message' => payload['commit_message'],
      'valid' => payload['valid'],
      'errors' => payload['errors'],
      'warnings' => payload['warnings'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'webhook_url' => payload['webhook_url'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



356
357
358
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 356

def 
  @properties['account_sid']
end

#commit_messageString

Returns Description on change made in the revision.

Returns:

  • (String)

    Description on change made in the revision



386
387
388
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 386

def commit_message
  @properties['commit_message']
end

#contextFlowContext

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

Returns:



341
342
343
344
345
346
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 341

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

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created



410
411
412
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 410

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was last updated



416
417
418
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 416

def date_updated
  @properties['date_updated']
end

#definitionHash

Returns JSON representation of flow definition.

Returns:

  • (Hash)

    JSON representation of flow definition



368
369
370
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 368

def definition
  @properties['definition']
end

#deleteBoolean

Deletes the FlowInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



465
466
467
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 465

def delete
  context.delete
end

#errorsHash

Returns List of error in the flow definition.

Returns:

  • (Hash)

    List of error in the flow definition



398
399
400
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 398

def errors
  @properties['errors']
end

#executionsexecutions

Access the executions

Returns:



486
487
488
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 486

def executions
  context.executions
end

#fetchFlowInstance

Fetch a FlowInstance

Returns:



458
459
460
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 458

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the Flow.

Returns:

  • (String)

    The string that you assigned to describe the Flow



362
363
364
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 362

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



499
500
501
502
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 499

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

Returns Nested resource URLs.

Returns:

  • (String)

    Nested resource URLs



434
435
436
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 434

def links
  @properties['links']
end

#revisionString

Returns The latest revision number of the Flow’s definition.

Returns:

  • (String)

    The latest revision number of the Flow’s definition



380
381
382
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 380

def revision
  @properties['revision']
end

#revisionsrevisions

Access the revisions

Returns:



472
473
474
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 472

def revisions
  context.revisions
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



350
351
352
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 350

def sid
  @properties['sid']
end

#statusflow.Status

Returns The status of the Flow.

Returns:

  • (flow.Status)

    The status of the Flow



374
375
376
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 374

def status
  @properties['status']
end

#test_userstest_users

Access the test_users

Returns:



479
480
481
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 479

def test_users
  context.test_users
end

#to_sObject

Provide a user friendly representation



492
493
494
495
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 492

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

#update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance

Update the FlowInstance

Parameters:

  • status (flow.Status) (defaults to: nil)

    The status of the Flow. Can be: ‘draft` or `published`.

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

    The string that you assigned to describe the Flow.

  • definition (Hash) (defaults to: :unset)

    JSON representation of flow definition.

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

    Description on change made in the revision.

Returns:



446
447
448
449
450
451
452
453
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 446

def update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset)
  context.update(
      status: status,
      friendly_name: friendly_name,
      definition: definition,
      commit_message: commit_message,
  )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



428
429
430
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 428

def url
  @properties['url']
end

#validBoolean

Returns Boolean if the flow definition is valid.

Returns:

  • (Boolean)

    Boolean if the flow definition is valid



392
393
394
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 392

def valid
  @properties['valid']
end

#warningsHash

Returns List of warnings in the flow definition.

Returns:

  • (Hash)

    List of warnings in the flow definition



404
405
406
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 404

def warnings
  @properties['warnings']
end

#webhook_urlString

Returns The webhook_url.

Returns:

  • (String)

    The webhook_url



422
423
424
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 422

def webhook_url
  @properties['webhook_url']
end