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.



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 404

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_sid ⇒ String

Returns The SID of the Account that created the resource.

Returns:

  • (String) —

    The SID of the Account that created the resource



441
442
443
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 441

def 
  @properties['account_sid']
end

#callback_events ⇒ String

Returns Reserved.

Returns:

  • (String) —

    Reserved



507
508
509
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 507

def callback_events
  @properties['callback_events']
end

#callback_url ⇒ String

Returns Reserved.

Returns:

  • (String) —

    Reserved



501
502
503
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 501

def callback_url
  @properties['callback_url']
end

#context ⇒ AssistantContext

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

Returns:



432
433
434
435
436
437
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 432

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

#date_created ⇒ Time

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



447
448
449
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 447

def date_created
  @properties['date_created']
end

#date_updated ⇒ Time

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



453
454
455
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 453

def date_updated
  @properties['date_updated']
end

#defaults ⇒ defaults

Access the defaults

Returns:



593
594
595
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 593

def defaults
  context.defaults
end

#delete ⇒ Boolean

Deletes the AssistantInstance

Returns:

  • (Boolean) —

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#dialogues ⇒ dialogues

Access the dialogues

Returns:



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

def dialogues
  context.dialogues
end

#fetch ⇒ AssistantInstance

Fetch a AssistantInstance

Returns:



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

def fetch
  context.fetch
end

#field_types ⇒ field_types

Access the field_types

Returns:



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

def field_types
  context.field_types
end

#friendly_name ⇒ String

Returns The string that you assigned to describe the resource.

Returns:

  • (String) —

    The string that you assigned to describe the resource



459
460
461
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 459

def friendly_name
  @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



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

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

#latest_model_build_sid ⇒ String

Returns Reserved.

Returns:

  • (String) —

    Reserved



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

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



471
472
473
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 471

def links
  @properties['links']
end

#log_queries ⇒ Boolean

Returns Whether queries should be logged and kept after training.

Returns:

  • (Boolean) —

    Whether queries should be logged and kept after training



477
478
479
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 477

def log_queries
  @properties['log_queries']
end

#model_builds ⇒ model_builds

Access the model_builds

Returns:



572
573
574
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 572

def model_builds
  context.model_builds
end

#queries ⇒ queries

Access the queries

Returns:



579
580
581
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 579

def queries
  context.queries
end

#sid ⇒ String

Returns The unique string that identifies the resource.

Returns:

  • (String) —

    The unique string that identifies the resource



483
484
485
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 483

def sid
  @properties['sid']
end

#style_sheet ⇒ style_sheet

Access the style_sheet

Returns:



586
587
588
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 586

def style_sheet
  context.style_sheet
end

#tasks ⇒ tasks

Access the tasks

Returns:



565
566
567
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 565

def tasks
  context.tasks
end

#to_s ⇒ Object

Provide a user friendly representation



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

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

#unique_name ⇒ String

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

Returns:

  • (String) —

    An application-defined string that uniquely identifies the resource



489
490
491
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 489

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) ⇒ 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

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

    A JSON object that defines the Assistant's default tasks for various scenarios, including initiation actions and fallback tasks.

Returns:



536
537
538
539
540
541
542
543
544
545
546
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 536

def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :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,
  )
end

#url ⇒ String

Returns The absolute URL of the Assistant resource.

Returns:

  • (String) —

    The absolute URL of the Assistant resource



495
496
497
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant.rb', line 495

def url
  @properties['url']
end