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

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

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

  • account_sid (String)

    The SID of the Account that created this Flow resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 350

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'] == nil ? payload['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](www.twilio.com/docs/iam/api/account) that created the Flow resource.

Returns:



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

def 
    @properties['account_sid']
end

#commit_messageString

Returns Description of change made in the revision.

Returns:

  • (String)

    Description of change made in the revision.



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

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:



381
382
383
384
385
386
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 381

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



450
451
452
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 450

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



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

def date_updated
    @properties['date_updated']
end

#definitionHash

Returns JSON representation of flow definition.

Returns:

  • (Hash)

    JSON representation of flow definition.



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

def definition
    @properties['definition']
end

#deleteBoolean

Delete the FlowInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



481
482
483
484
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 481

def delete

    context.delete
end

#errorsArray<Hash>

Returns List of error in the flow definition.

Returns:

  • (Array<Hash>)

    List of error in the flow definition.



438
439
440
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 438

def errors
    @properties['errors']
end

#executionsexecutions

Access the executions

Returns:



519
520
521
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 519

def executions
    context.executions
end

#fetchFlowInstance

Fetch the FlowInstance

Returns:



489
490
491
492
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 489

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.



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



546
547
548
549
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 546

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

Returns The URLs of the Flow’s nested resources.

Returns:

  • (Hash)

    The URLs of the Flow’s nested resources.



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

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.



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

def revision
    @properties['revision']
end

#revisionsrevisions

Access the revisions

Returns:



533
534
535
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 533

def revisions
    context.revisions
end

#sidString

Returns The unique string that we created to identify the Flow resource.

Returns:

  • (String)

    The unique string that we created to identify the Flow resource.



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

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#test_userstest_users

Access the test_users

Returns:



526
527
528
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 526

def test_users
    context.test_users
end

#to_sObject

Provide a user friendly representation



539
540
541
542
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 539

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 (Status) (defaults to: nil)
  • friendly_name (String) (defaults to: :unset)

    The string that you assigned to describe the Flow.

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

    JSON representation of flow definition.

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

    Description of change made in the revision.

Returns:



501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 501

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.



468
469
470
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 468

def url
    @properties['url']
end

#validBoolean

Returns Boolean if the flow definition is valid.

Returns:

  • (Boolean)

    Boolean if the flow definition is valid.



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

def valid
    @properties['valid']
end

#warningsArray<Hash>

Returns List of warnings in the flow definition.

Returns:

  • (Array<Hash>)

    List of warnings in the flow definition.



444
445
446
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 444

def warnings
    @properties['warnings']
end

#webhook_urlString

Returns:

  • (String)


462
463
464
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 462

def webhook_url
    @properties['webhook_url']
end