Class: Twilio::REST::Assistants::V1::KnowledgeContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, id) ⇒ KnowledgeContext

Initialize the KnowledgeContext

Parameters:

  • version (Version)

    Version that contains the resource

  • id (String)


320
321
322
323
324
325
326
327
328
329
330
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 320

def initialize(version, id)
    super(version)

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

    # Dependents
    @chunks = nil
    @knowledge_status = nil
end

Instance Method Details

#chunksChunkList, ChunkContext

Access the chunks

Returns:

  • (ChunkList)
  • (ChunkContext)


387
388
389
390
391
392
393
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 387

def chunks
  unless @chunks
    @chunks = ChunkList.new(
            @version, )
  end
  @chunks
end

#deleteBoolean

Delete the KnowledgeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



334
335
336
337
338
339
340
341
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 334

def delete

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

#fetchKnowledgeInstance

Fetch the KnowledgeInstance

Returns:



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 346

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



414
415
416
417
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 414

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

#knowledge_statusKnowledgeStatusList, KnowledgeStatusContext

Access the knowledge_status

Returns:

  • (KnowledgeStatusList)
  • (KnowledgeStatusContext)


398
399
400
401
402
403
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 398

def knowledge_status
    KnowledgeStatusContext.new(
            @version,
            @solution[:id]
            )
end

#to_sObject

Provide a user friendly representation



407
408
409
410
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 407

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Assistants.V1.KnowledgeContext #{context}>"
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:



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge.rb', line 366

def update(assistants_v1_service_update_knowledge_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    payload = @version.update('PUT', @uri, headers: headers, data: assistants_v1_service_update_knowledge_request.to_json)
    KnowledgeInstance.new(
        @version,
        payload,
        id: @solution[:id],
    )
end