Class: Twilio::REST::Preview::Understand::AssistantInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/preview/understand/assistant.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the AssistantInstance

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 Assistant resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 432

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'friendly_name' => payload['friendly_name'],
        'latest_model_build_sid' => payload['latest_model_build_sid'],
        'links' => payload['links'],
        'log_queries' => payload['log_queries'],
        'sid' => payload['sid'],
        'unique_name' => payload['unique_name'],
        'url' => payload['url'],
        'callback_url' => payload['callback_url'],
        'callback_events' => payload['callback_events'],
    }

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

Instance Method Details

#account_sidString

Returns The unique ID of the Account that created this Assistant.

Returns:

  • (String)

    The unique ID of the Account that created this Assistant.



469
470
471
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 469

def 
    @properties['account_sid']
end

#assistant_fallback_actionsassistant_fallback_actions

Access the assistant_fallback_actions

Returns:



599
600
601
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 599

def assistant_fallback_actions
    context.assistant_fallback_actions
end

#assistant_initiation_actionsassistant_initiation_actions

Access the assistant_initiation_actions

Returns:



620
621
622
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 620

def assistant_initiation_actions
    context.assistant_initiation_actions
end

#callback_eventsString

Returns Space-separated list of callback events that will trigger callbacks.

Returns:

  • (String)

    Space-separated list of callback events that will trigger callbacks.



535
536
537
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 535

def callback_events
    @properties['callback_events']
end

#callback_urlString

Returns A user-provided URL to send event callbacks to.

Returns:

  • (String)

    A user-provided URL to send event callbacks to.



529
530
531
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 529

def callback_url
    @properties['callback_url']
end

#contextAssistantContext

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

Returns:



460
461
462
463
464
465
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 460

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

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created



475
476
477
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 475

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated.

Returns:

  • (Time)

    The date that this resource was last updated



481
482
483
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 481

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the AssistantInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



542
543
544
545
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 542

def delete

    context.delete
end

#dialoguesdialogues

Access the dialogues

Returns:



613
614
615
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 613

def dialogues
    context.dialogues
end

#fetchAssistantInstance

Fetch the AssistantInstance

Returns:



550
551
552
553
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 550

def fetch

    context.fetch
end

#field_typesfield_types

Access the field_types

Returns:



592
593
594
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 592

def field_types
    context.field_types
end

#friendly_nameString

Returns A text description for the Assistant. It is non-unique and can up to 255 characters long.

Returns:

  • (String)

    A text description for the Assistant. It is non-unique and can up to 255 characters long.



487
488
489
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 487

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



654
655
656
657
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 654

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

#latest_model_build_sidString

Returns The unique ID (Sid) of the latest model build. Null if no model has been built.

Returns:

  • (String)

    The unique ID (Sid) of the latest model build. Null if no model has been built.



493
494
495
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 493

def latest_model_build_sid
    @properties['latest_model_build_sid']
end

Returns:

  • (Hash)


499
500
501
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 499

def links
    @properties['links']
end

#log_queriesBoolean

Returns A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter.

Returns:

  • (Boolean)

    A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter.



505
506
507
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 505

def log_queries
    @properties['log_queries']
end

#model_buildsmodel_builds

Access the model_builds

Returns:



627
628
629
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 627

def model_builds
    context.model_builds
end

#queriesqueries

Access the queries

Returns:



641
642
643
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 641

def queries
    context.queries
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



511
512
513
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 511

def sid
    @properties['sid']
end

#style_sheetstyle_sheet

Access the style_sheet

Returns:



634
635
636
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 634

def style_sheet
    context.style_sheet
end

#taskstasks

Access the tasks

Returns:



606
607
608
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 606

def tasks
    context.tasks
end

#to_sObject

Provide a user friendly representation



647
648
649
650
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 647

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

#unique_nameString

Returns A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long.

Returns:

  • (String)

    A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long.



517
518
519
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 517

def unique_name
    @properties['unique_name']
end

#update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset, style_sheet: :unset) ⇒ AssistantInstance

Update the AssistantInstance

Parameters:

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

    A text description for the Assistant. It is non-unique and can up to 255 characters long.

  • log_queries (Boolean) (defaults to: :unset)

    A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided.

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

    A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.

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

    A user-provided URL to send event callbacks to.

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

    Space-separated list of callback events that will trigger callbacks.

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

    The JSON actions to be executed when the user’s input is not recognized as matching any Task.

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

    The JSON actions to be executed on inbound phone calls when the Assistant has to say something first.

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

    The JSON object that holds the style sheet for the assistant

Returns:



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 566

def update(
    friendly_name: :unset, 
    log_queries: :unset, 
    unique_name: :unset, 
    callback_url: :unset, 
    callback_events: :unset, 
    fallback_actions: :unset, 
    initiation_actions: :unset, 
    style_sheet: :unset
)

    context.update(
        friendly_name: friendly_name, 
        log_queries: log_queries, 
        unique_name: unique_name, 
        callback_url: callback_url, 
        callback_events: callback_events, 
        fallback_actions: fallback_actions, 
        initiation_actions: initiation_actions, 
        style_sheet: style_sheet, 
    )
end

#urlString

Returns:

  • (String)


523
524
525
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 523

def url
    @properties['url']
end