Class: Twilio::REST::Autopilot::V1::AssistantInstance

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Assistant resource to fetch.



435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 435

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'],
      'development_stage' => payload['development_stage'],
      'needs_model_build' => payload['needs_model_build'],
      '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 SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



474
475
476
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 474

def 
  @properties['account_sid']
end

#callback_eventsString

Returns Reserved.

Returns:

  • (String)

    Reserved



552
553
554
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 552

def callback_events
  @properties['callback_events']
end

#callback_urlString

Returns Reserved.

Returns:

  • (String)

    Reserved



546
547
548
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 546

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:



465
466
467
468
469
470
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 465

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

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created



480
481
482
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 480

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was last updated



486
487
488
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 486

def date_updated
  @properties['date_updated']
end

#defaultsdefaults

Access the defaults

Returns:



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

def defaults
  context.defaults
end

#deleteBoolean

Deletes the AssistantInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



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

def delete
  context.delete
end

#development_stageString

Returns A string describing the state of the assistant.

Returns:

  • (String)

    A string describing the state of the assistant.



516
517
518
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 516

def development_stage
  @properties['development_stage']
end

#dialoguesdialogues

Access the dialogues

Returns:



648
649
650
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 648

def dialogues
  context.dialogues
end

#export_assistantexport_assistant

Access the export_assistant

Returns:



662
663
664
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 662

def export_assistant
  context.export_assistant
end

#fetchAssistantInstance

Fetch a AssistantInstance

Returns:



559
560
561
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 559

def fetch
  context.fetch
end

#field_typesfield_types

Access the field_types

Returns:



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

def field_types
  context.field_types
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource



492
493
494
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 492

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



675
676
677
678
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 675

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

#latest_model_build_sidString

Returns Reserved.

Returns:

  • (String)

    Reserved



498
499
500
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 498

def latest_model_build_sid
  @properties['latest_model_build_sid']
end

Returns A list of the URLs of the Assistant’s related resources.

Returns:

  • (String)

    A list of the URLs of the Assistant’s related resources



504
505
506
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 504

def links
  @properties['links']
end

#log_queriesBoolean

Returns Whether queries should be logged and kept after training.

Returns:

  • (Boolean)

    Whether queries should be logged and kept after training



510
511
512
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 510

def log_queries
  @properties['log_queries']
end

#model_buildsmodel_builds

Access the model_builds

Returns:



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

def model_builds
  context.model_builds
end

#needs_model_buildBoolean

Returns Whether model needs to be rebuilt.

Returns:

  • (Boolean)

    Whether model needs to be rebuilt



522
523
524
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 522

def needs_model_build
  @properties['needs_model_build']
end

#queriesqueries

Access the queries

Returns:



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

def queries
  context.queries
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



528
529
530
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 528

def sid
  @properties['sid']
end

#style_sheetstyle_sheet

Access the style_sheet

Returns:



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

def style_sheet
  context.style_sheet
end

#taskstasks

Access the tasks

Returns:



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

def tasks
  context.tasks
end

#to_sObject

Provide a user friendly representation



668
669
670
671
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 668

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

#unique_nameString

Returns An application-defined string that uniquely identifies the resource.

Returns:

  • (String)

    An application-defined string that uniquely identifies the resource



534
535
536
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 534

def unique_name
  @properties['unique_name']
end

#update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset, development_stage: :unset) ⇒ AssistantInstance

Update the AssistantInstance

Parameters:

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

    A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.

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

    Whether queries should be logged and kept after training. Can be: ‘true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored.

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

    An application-defined string that uniquely identifies the resource. It can be used as an alternative to the ‘sid` in the URL path to address the resource. The first 64 characters must be unique.

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

    Reserved.

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

    Reserved.

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

    The JSON string that defines the Assistant’s [style sheet](www.twilio.com/docs/autopilot/api/assistant/stylesheet)

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

    A JSON object that defines the Assistant’s [default tasks](www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks.

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

    A string describing the state of the assistant.

Returns:



583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 583

def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset, development_stage: :unset)
  context.update(
      friendly_name: friendly_name,
      log_queries: log_queries,
      unique_name: unique_name,
      callback_url: callback_url,
      callback_events: callback_events,
      style_sheet: style_sheet,
      defaults: defaults,
      development_stage: development_stage,
  )
end

#urlString

Returns The absolute URL of the Assistant resource.

Returns:

  • (String)

    The absolute URL of the Assistant resource



540
541
542
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 540

def url
  @properties['url']
end

#webhookswebhooks

Access the webhooks

Returns:



655
656
657
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 655

def webhooks
  context.webhooks
end