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
389 390 391 392 393 394 395 396 397 398 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 389 def initialize(version, id) super(version) # Path Solution @solution = { id: id, } @uri = "/Tools/#{@solution[:id]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ToolInstance
402 403 404 405 406 407 408 409 410 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.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 ToolInstanceMetadata
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 415 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
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 434 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
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/tool.rb', line 453 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
533 534 535 536 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 533 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Assistants.V1.ToolContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
526 527 528 529 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 526 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
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 479 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
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/tool.rb', line 500 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 |