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

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/preview/understand/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 sid



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

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'],
      'response_url' => payload['response_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.



388
389
390
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 388

def 
  @properties['account_sid']
end

#callback_eventsString

Returns The callback_events.

Returns:

  • (String)

    The callback_events



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

def callback_events
  @properties['callback_events']
end

#callback_urlString

Returns The callback_url.

Returns:

  • (String)

    The callback_url



454
455
456
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 454

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:



379
380
381
382
383
384
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 379

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



394
395
396
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 394

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



400
401
402
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 400

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the AssistantInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#fetchAssistantInstance

Fetch a AssistantInstance

Returns:



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

def fetch
  context.fetch
end

#field_typesfield_types

Access the field_types

Returns:



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

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.



406
407
408
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 406

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#intentsintents

Access the intents

Returns:



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

def intents
  context.intents
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.



412
413
414
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 412

def latest_model_build_sid
  @properties['latest_model_build_sid']
end

Returns The links.

Returns:

  • (String)

    The links



418
419
420
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 418

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.



424
425
426
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 424

def log_queries
  @properties['log_queries']
end

#model_buildsmodel_builds

Access the model_builds

Returns:



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

def model_builds
  context.model_builds
end

#queriesqueries

Access the queries

Returns:



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

def queries
  context.queries
end

#response_urlString

Returns The webhook URL called to fetch the response to an incoming communication expressed in Assistant TwiML.

Returns:

  • (String)

    The webhook URL called to fetch the response to an incoming communication expressed in Assistant TwiML.



448
449
450
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 448

def response_url
  @properties['response_url']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



430
431
432
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 430

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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.



436
437
438
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 436

def unique_name
  @properties['unique_name']
end

#update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, response_url: :unset, callback_url: :unset, callback_events: :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.

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

    The webhook URL called to fetch the response to an incoming communication expressed in Assistant TwiML.

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

    The callback_url

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

    The callback_events

Returns:



486
487
488
489
490
491
492
493
494
495
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 486

def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, response_url: :unset, callback_url: :unset, callback_events: :unset)
  context.update(
      friendly_name: friendly_name,
      log_queries: log_queries,
      unique_name: unique_name,
      response_url: response_url,
      callback_url: callback_url,
      callback_events: callback_events,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



442
443
444
# File 'lib/twilio-ruby/rest/preview/understand/assistant.rb', line 442

def url
  @properties['url']
end