Class: Twilio::REST::Knowledge::V1::KnowledgeInstance

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



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

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

Returns The SID of the Account that created the Knowledge resource.

Returns:

  • (String) —

    The SID of the Account that created the Knowledge resource.



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

def 
    @properties['account_sid']
end

#chunks ⇒ chunks

Access the chunks

Returns:



836
837
838
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 836

def chunks
    context.chunks
end

#context ⇒ KnowledgeContext

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

Returns:



732
733
734
735
736
737
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 732

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

#date_created ⇒ Time

Returns The date and time in GMT when the Knowledge was created specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in GMT when the Knowledge was created specified in ISO 8601 format.



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

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The date and time in GMT when the Knowledge was last updated specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in GMT when the Knowledge was last updated specified in ISO 8601 format.



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

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the KnowledgeInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#description ⇒ String

Returns The type of knowledge source.

Returns:

  • (String) —

    The type of knowledge source.



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

def description
    @properties['description']
end

#embedding_model ⇒ String

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

Returns:

  • (String) —

    The embedding model to be used for the knowledge source.



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

def embedding_model
    @properties['embedding_model']
end

#fetch ⇒ KnowledgeInstance

Fetch the KnowledgeInstance

Returns:



816
817
818
819
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 816

def fetch

    context.fetch
end

#id ⇒ String

Returns The description of knowledge.

Returns:

  • (String) —

    The description of knowledge.



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

def id
    @properties['id']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



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

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

#knowledge_source_details ⇒ Hash

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

Returns:

  • (Hash) —

    The details of the knowledge source based on the type.



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

def knowledge_source_details
    @properties['knowledge_source_details']
end

#knowledge_status ⇒ knowledge_status

Access the knowledge_status

Returns:



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

def knowledge_status
    context.knowledge_status
end

#name ⇒ String

Returns The name of the knowledge source.

Returns:

  • (String) —

    The name of the knowledge source.



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

def name
    @properties['name']
end

#status ⇒ String

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



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

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



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

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

#type ⇒ String

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

Returns:

  • (String) —

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



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

def type
    @properties['type']
end

#update(knowledge_v1_service_update_knowledge_request: :unset) ⇒ KnowledgeInstance

Update the KnowledgeInstance

Parameters:

  • knowledge_v1_service_update_knowledge_request (KnowledgeV1ServiceUpdateKnowledgeRequest) (defaults to: :unset)

Returns:



825
826
827
828
829
830
831
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 825

def update(knowledge_v1_service_update_knowledge_request: :unset
)

    context.update(
        knowledge_v1_service_update_knowledge_request: knowledge_v1_service_update_knowledge_request, 
    )
end

#url ⇒ String

Returns The url of the knowledge resource.

Returns:

  • (String) —

    The url of the knowledge resource.



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

def url
    @properties['url']
end