Class: Twilio::REST::Assistants::V1::AssistantContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Assistants::V1::AssistantContext
- 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, AssistantsKnowledgeInstanceMetadata, AssistantsKnowledgeList, AssistantsKnowledgeListResponse, AssistantsKnowledgePage, AssistantsKnowledgePageMetadata, AssistantsToolContext, AssistantsToolInstance, AssistantsToolInstanceMetadata, AssistantsToolList, AssistantsToolListResponse, AssistantsToolPage, AssistantsToolPageMetadata, FeedbackInstance, FeedbackList, FeedbackListResponse, FeedbackPage, FeedbackPageMetadata, MessageInstance, MessageList, MessageListResponse, MessagePage, MessagePageMetadata
Instance Method Summary collapse
-
#assistants_knowledge(id = :unset) ⇒ AssistantsKnowledgeList, AssistantsKnowledgeContext
Access the assistants_knowledge.
-
#assistants_tools(id = :unset) ⇒ AssistantsToolList, AssistantsToolContext
Access the assistants_tools.
-
#delete ⇒ Boolean
Delete the AssistantInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the AssistantInstanceMetadata.
-
#feedbacks ⇒ FeedbackList, FeedbackContext
Access the feedbacks.
-
#fetch ⇒ AssistantInstance
Fetch the AssistantInstance.
-
#fetch_with_metadata ⇒ AssistantInstance
Fetch the AssistantInstanceMetadata.
-
#initialize(version, id) ⇒ AssistantContext
constructor
Initialize the AssistantContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#messages ⇒ MessageList, MessageContext
Access the messages.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(assistants_v1_service_update_assistant_request: :unset) ⇒ AssistantInstance
Update the AssistantInstance.
-
#update_with_metadata(assistants_v1_service_update_assistant_request: :unset) ⇒ AssistantInstance
Update the AssistantInstanceMetadata.
Constructor Details
#initialize(version, id) ⇒ AssistantContext
Initialize the AssistantContext
377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 377 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
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 560 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
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 541 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 |
#delete ⇒ Boolean
Delete the AssistantInstance
394 395 396 397 398 399 400 401 402 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 394 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the AssistantInstanceMetadata
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 407 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) assistant_instance = AssistantInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) AssistantInstanceMetadata.new(@version, assistant_instance, response.headers, response.status_code) end |
#feedbacks ⇒ FeedbackList, FeedbackContext
Access the feedbacks
519 520 521 522 523 524 525 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 519 def feedbacks unless @feedbacks @feedbacks = FeedbackList.new( @version, id: @solution[:id], ) end @feedbacks end |
#fetch ⇒ AssistantInstance
Fetch the AssistantInstance
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 426 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 |
#fetch_with_metadata ⇒ AssistantInstance
Fetch the AssistantInstanceMetadata
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 445 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) assistant_instance = AssistantInstance.new( @version, response.body, id: @solution[:id], ) AssistantInstanceMetadata.new( @version, assistant_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
585 586 587 588 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 585 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Assistants.V1.AssistantContext #{context}>" end |
#messages ⇒ MessageList, MessageContext
Access the messages
530 531 532 533 534 535 536 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 530 def unless @messages @messages = MessageList.new( @version, id: @solution[:id], ) end @messages end |
#to_s ⇒ Object
Provide a user friendly representation
578 579 580 581 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 578 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
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 471 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 |
#update_with_metadata(assistants_v1_service_update_assistant_request: :unset) ⇒ AssistantInstance
Update the AssistantInstanceMetadata
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 492 def (assistants_v1_service_update_assistant_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('PUT', @uri, headers: headers, data: assistants_v1_service_update_assistant_request.to_json) assistant_instance = AssistantInstance.new( @version, response.body, id: @solution[:id], ) AssistantInstanceMetadata.new( @version, assistant_instance, response.headers, response.status_code ) end |