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 (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 Knowledge resource.

  • sid (String)

    The SID of the Call resource to fetch.



710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 710

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:



759
760
761
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 759

def 
    @properties['account_sid']
end

#chunkschunks

Access the chunks

Returns:



842
843
844
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 842

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:



738
739
740
741
742
743
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 738

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:



801
802
803
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 801

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:



807
808
809
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 807

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the KnowledgeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



814
815
816
817
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 814

def delete

    context.delete
end

#descriptionString

Returns The type of knowledge source.

Returns:

  • (String)

    The type of knowledge source.



747
748
749
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 747

def description
    @properties['description']
end

#embedding_modelString

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

Returns:

  • (String)

    The embedding model to be used for the knowledge source.



795
796
797
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 795

def embedding_model
    @properties['embedding_model']
end

#fetchKnowledgeInstance

Fetch the KnowledgeInstance

Returns:



822
823
824
825
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 822

def fetch

    context.fetch
end

#idString

Returns The description of knowledge.

Returns:

  • (String)

    The description of knowledge.



753
754
755
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 753

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



862
863
864
865
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 862

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:

  • (Hash)

    The details of the knowledge source based on the type.



765
766
767
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 765

def knowledge_source_details
    @properties['knowledge_source_details']
end

#knowledge_statusknowledge_status

Access the knowledge_status

Returns:



849
850
851
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 849

def knowledge_status
    context.knowledge_status
end

#nameString

Returns The name of the knowledge source.

Returns:

  • (String)

    The name of the knowledge source.



771
772
773
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 771

def name
    @properties['name']
end

#statusString

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

Returns:

  • (String)

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



777
778
779
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 777

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



855
856
857
858
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 855

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:

  • (String)

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



783
784
785
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 783

def type
    @properties['type']
end

#update(assistants_v1_service_update_knowledge_request: :unset) ⇒ KnowledgeInstance

Update the KnowledgeInstance

Parameters:

  • assistants_v1_service_update_knowledge_request (AssistantsV1ServiceUpdateKnowledgeRequest) (defaults to: :unset)

Returns:



831
832
833
834
835
836
837
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 831

def update(assistants_v1_service_update_knowledge_request: :unset
)

    context.update(
        assistants_v1_service_update_knowledge_request: assistants_v1_service_update_knowledge_request, 
    )
end

#urlString

Returns The url of the knowledge resource.

Returns:

  • (String)

    The url of the knowledge resource.



789
790
791
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 789

def url
    @properties['url']
end