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

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/assistant.rb,
lib/twilio-ruby/rest/assistants/v1/assistant/message.rb,
lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb,
lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb,
lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb

Defined Under Namespace

Classes: AssistantsKnowledgeContext, AssistantsKnowledgeInstance, AssistantsKnowledgeList, AssistantsKnowledgePage, AssistantsToolContext, AssistantsToolInstance, AssistantsToolList, AssistantsToolPage, FeedbackInstance, FeedbackList, FeedbackPage, MessageInstance, MessageList, MessagePage

Instance Method Summary collapse

Constructor Details

#initialize(version, id) ⇒ AssistantContext

Initialize the AssistantContext

Parameters:

  • version (Version)

    Version that contains the resource

  • id (String)


328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 328

def initialize(version, id)
    super(version)

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

    # Dependents
    @feedbacks = nil
    @messages = nil
    @assistants_tools = nil
    @assistants_knowledge = nil
end

Instance Method Details

#assistants_knowledge(id = :unset) ⇒ AssistantsKnowledgeList, AssistantsKnowledgeContext

Access the assistants_knowledge

Returns:

Raises:

  • (ArgumentError)


438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 438

def assistants_knowledge(id=:unset)

    raise ArgumentError, 'id cannot be nil' if id.nil?

    if id != :unset
        return AssistantsKnowledgeContext.new(@version, @solution[:id],id )
    end

    unless @assistants_knowledge
        @assistants_knowledge = AssistantsKnowledgeList.new(
            @version, )
    end

 @assistants_knowledge
end

#assistants_tools(id = :unset) ⇒ AssistantsToolList, AssistantsToolContext

Access the assistants_tools

Returns:

Raises:

  • (ArgumentError)


419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 419

def assistants_tools(id=:unset)

    raise ArgumentError, 'id cannot be nil' if id.nil?

    if id != :unset
        return AssistantsToolContext.new(@version, @solution[:id],id )
    end

    unless @assistants_tools
        @assistants_tools = AssistantsToolList.new(
            @version, )
    end

 @assistants_tools
end

#deleteBoolean

Delete the AssistantInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



344
345
346
347
348
349
350
351
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 344

def delete

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

#feedbacksFeedbackList, FeedbackContext

Access the feedbacks

Returns:



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

def feedbacks
  unless @feedbacks
    @feedbacks = FeedbackList.new(
            @version, id: @solution[:id], )
  end
  @feedbacks
end

#fetchAssistantInstance

Fetch the AssistantInstance

Returns:



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 356

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



463
464
465
466
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 463

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

#messagesMessageList, MessageContext

Access the messages

Returns:



408
409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 408

def messages
  unless @messages
    @messages = MessageList.new(
            @version, id: @solution[:id], )
  end
  @messages
end

#to_sObject

Provide a user friendly representation



456
457
458
459
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 456

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

#update(assistants_v1_service_update_assistant_request: :unset) ⇒ AssistantInstance

Update the AssistantInstance

Parameters:

  • assistants_v1_service_update_assistant_request (AssistantsV1ServiceUpdateAssistantRequest) (defaults to: :unset)

Returns:



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 376

def update(assistants_v1_service_update_assistant_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_assistant_request.to_json)
    AssistantInstance.new(
        @version,
        payload,
        id: @solution[:id],
    )
end