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
385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 385 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
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 568 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
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 549 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
402 403 404 405 406 407 408 409 410 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 402 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
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 415 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
527 528 529 530 531 532 533 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 527 def feedbacks unless @feedbacks @feedbacks = FeedbackList.new( @version, id: @solution[:id], ) end @feedbacks end |
#fetch ⇒ AssistantInstance
Fetch the AssistantInstance
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 434 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
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 453 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
593 594 595 596 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 593 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Assistants.V1.AssistantContext #{context}>" end |
#messages ⇒ MessageList, MessageContext
Access the messages
538 539 540 541 542 543 544 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 538 def unless @messages @messages = MessageList.new( @version, id: @solution[:id], ) end @messages end |
#to_s ⇒ Object
Provide a user friendly representation
586 587 588 589 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 586 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
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 479 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
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
# File 'lib/twilio-ruby/rest/assistants/v1/assistant.rb', line 500 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 |