Class: Twilio::REST::Assistants::V1::KnowledgeInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, id: nil) ⇒ KnowledgeInstance

Initialize the KnowledgeInstance

Parameters:

  • Version that contains the resource

  • payload that contains response from Twilio

  • The SID of the Account that created this Knowledge resource.

  • The SID of the Call resource to fetch.



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 470

def initialize(version, payload , id: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'description' => payload['description'],
        'id' => payload['id'],
        'account_sid' => payload['account_sid'],
        'knowledge_source_details' => payload['knowledge_source_details'],
        'name' => payload['name'],
        'status' => payload['status'],
        'type' => payload['type'],
        'url' => payload['url'],
        'embedding_model' => payload['embedding_model'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Knowledge resource.

Returns:



518
519
520
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 518

def 
    @properties['account_sid']
end

#chunkschunks

Access the chunks

Returns:

  • chunks



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

def chunks
    context.chunks
end

#contextKnowledgeContext

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

Returns:

  • CallContext for this CallInstance



497
498
499
500
501
502
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 497

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

#date_createdTime

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

Returns:



560
561
562
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 560

def date_created
    @properties['date_created']
end

#date_updatedTime

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

Returns:



566
567
568
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 566

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the KnowledgeInstance

Returns:

  • True if delete succeeds, false otherwise



573
574
575
576
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 573

def delete

    context.delete
end

#descriptionString

Returns The type of knowledge source.

Returns:

  • The type of knowledge source.



506
507
508
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 506

def description
    @properties['description']
end

#embedding_modelString

Returns The embedding model to be used for the knowledge source.

Returns:

  • The embedding model to be used for the knowledge source.



554
555
556
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 554

def embedding_model
    @properties['embedding_model']
end

#fetchKnowledgeInstance

Fetch the KnowledgeInstance

Returns:

  • Fetched KnowledgeInstance



581
582
583
584
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 581

def fetch

    context.fetch
end

#idString

Returns The description of knowledge.

Returns:

  • The description of knowledge.



512
513
514
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 512

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



620
621
622
623
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 620

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

#knowledge_source_detailsHash

Returns The details of the knowledge source based on the type.

Returns:

  • The details of the knowledge source based on the type.



524
525
526
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 524

def knowledge_source_details
    @properties['knowledge_source_details']
end

#knowledge_statusknowledge_status

Access the knowledge_status

Returns:

  • knowledge_status



607
608
609
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 607

def knowledge_status
    context.knowledge_status
end

#nameString

Returns The name of the knowledge source.

Returns:

  • The name of the knowledge source.



530
531
532
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 530

def name
    @properties['name']
end

#statusString

Returns The status of processing the knowledge source (‘QUEUED’, ‘PROCESSING’, ‘COMPLETED’, ‘FAILED’).

Returns:

  • The status of processing the knowledge source (‘QUEUED’, ‘PROCESSING’, ‘COMPLETED’, ‘FAILED’)



536
537
538
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 536

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#typeString

Returns The type of knowledge source (‘Web’, ‘Database’, ‘Text’, ‘File’).

Returns:

  • The type of knowledge source (‘Web’, ‘Database’, ‘Text’, ‘File’)



542
543
544
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 542

def type
    @properties['type']
end

#update(assistants_v1_service_update_knowledge_request: :unset) ⇒ KnowledgeInstance

Update the KnowledgeInstance

Parameters:

  • (defaults to: :unset)

Returns:

  • Updated KnowledgeInstance



590
591
592
593
594
595
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 590

def update(assistants_v1_service_update_knowledge_request: :unset
)

    context.update(
    )
end

#urlString

Returns The url of the knowledge resource.

Returns:

  • The url of the knowledge resource.



548
549
550
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 548

def url
    @properties['url']
end