Class: Twilio::REST::Assistants::V1::AssistantContext::AssistantsKnowledgeContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, assistant_id, id) ⇒ AssistantsKnowledgeContext

Initialize the AssistantsKnowledgeContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_id (String)

    The assistant ID.

  • id (String)

    The knowledge ID.



139
140
141
142
143
144
145
146
147
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 139

def initialize(version, assistant_id, id)
    super(version)

    # Path Solution
    @solution = { assistant_id: assistant_id, id: id,  }
    @uri = "/Assistants/#{@solution[:assistant_id]}/Knowledge/#{@solution[:id]}"

    
end

Instance Method Details

#createAssistantsKnowledgeInstance

Create the AssistantsKnowledgeInstance

Returns:



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 151

def create

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, headers: headers)
    AssistantsKnowledgeInstance.new(
        @version,
        payload,
        assistant_id: @solution[:assistant_id],
        id: @solution[:id],
    )
end

#deleteBoolean

Delete the AssistantsKnowledgeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



171
172
173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 171

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#inspectObject

Provide a detailed, user friendly representation



190
191
192
193
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 190

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Assistants.V1.AssistantsKnowledgeContext #{context}>"
end

#to_sObject

Provide a user friendly representation



183
184
185
186
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 183

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Assistants.V1.AssistantsKnowledgeContext #{context}>"
end