Class: Twilio::REST::Assistants::V1::ToolContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Assistants::V1::ToolContext
- Defined in:
- lib/twilio-ruby/rest/assistants/v1/tool.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ToolInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ToolInstanceMetadata.
-
#fetch ⇒ ToolInstance
Fetch the ToolInstance.
-
#fetch_with_metadata ⇒ ToolInstance
Fetch the ToolInstanceMetadata.
-
#initialize(version, id) ⇒ ToolContext
constructor
Initialize the ToolContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(assistants_v1_service_update_tool_request: :unset) ⇒ ToolInstance
Update the ToolInstance.
-
#update_with_metadata(assistants_v1_service_update_tool_request: :unset) ⇒ ToolInstance
Update the ToolInstanceMetadata.
Constructor Details
#initialize(version, id) ⇒ ToolContext
Initialize the ToolContext
397 398 399 400 401 402 403 404 405 406 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 397 def initialize(version, id) super(version) # Path Solution @solution = { id: id, } @uri = "/Tools/#{@solution[:id]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ToolInstance
410 411 412 413 414 415 416 417 418 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 410 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 ToolInstanceMetadata
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 423 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) tool_instance = ToolInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ToolInstanceMetadata.new(@version, tool_instance, response.headers, response.status_code) end |
#fetch ⇒ ToolInstance
Fetch the ToolInstance
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 442 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ToolInstance.new( @version, payload, id: @solution[:id], ) end |
#fetch_with_metadata ⇒ ToolInstance
Fetch the ToolInstanceMetadata
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 461 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) tool_instance = ToolInstance.new( @version, response.body, id: @solution[:id], ) ToolInstanceMetadata.new( @version, tool_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
541 542 543 544 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 541 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Assistants.V1.ToolContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
534 535 536 537 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 534 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Assistants.V1.ToolContext #{context}>" end |
#update(assistants_v1_service_update_tool_request: :unset) ⇒ ToolInstance
Update the ToolInstance
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 487 def update(assistants_v1_service_update_tool_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_tool_request.to_json) ToolInstance.new( @version, payload, id: @solution[:id], ) end |
#update_with_metadata(assistants_v1_service_update_tool_request: :unset) ⇒ ToolInstance
Update the ToolInstanceMetadata
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 508 def (assistants_v1_service_update_tool_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_tool_request.to_json) tool_instance = ToolInstance.new( @version, response.body, id: @solution[:id], ) ToolInstanceMetadata.new( @version, tool_instance, response.headers, response.status_code ) end |