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.



702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 702

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:



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

def 
    @properties['account_sid']
end

#chunkschunks

Access the chunks

Returns:



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

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:



730
731
732
733
734
735
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 730

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:



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

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:



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the KnowledgeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#descriptionString

Returns The type of knowledge source.

Returns:

  • (String)

    The type of knowledge source.



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

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.



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

def embedding_model
    @properties['embedding_model']
end

#fetchKnowledgeInstance

Fetch the KnowledgeInstance

Returns:



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

def fetch

    context.fetch
end

#idString

Returns The description of knowledge.

Returns:

  • (String)

    The description of knowledge.



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

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



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

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.



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

def knowledge_source_details
    @properties['knowledge_source_details']
end

#knowledge_statusknowledge_status

Access the knowledge_status

Returns:



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

def knowledge_status
    context.knowledge_status
end

#nameString

Returns The name of the knowledge source.

Returns:

  • (String)

    The name of the knowledge source.



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

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



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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



846
847
848
849
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 846

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



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

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:



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

def update(assistants_v1_service_update_knowledge_request: :unset
)

    context.update(
    )
end

#urlString

Returns The url of the knowledge resource.

Returns:

  • (String)

    The url of the knowledge resource.



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

def url
    @properties['url']
end