Class: Twilio::REST::Assistants::V1::ToolContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/tool.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, id) ⇒ ToolContext

Initialize the ToolContext

Parameters:

  • version (Version)

    Version that contains the resource

  • id (String)


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

#deleteBoolean

Delete the ToolInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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_metadataBoolean

Delete the ToolInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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],
      )
      .new(@version, tool_instance, response.headers, response.status_code)
end

#fetchToolInstance

Fetch the ToolInstance

Returns:



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_metadataToolInstance

Fetch the ToolInstanceMetadata

Returns:



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],
    )
    .new(
        @version,
        tool_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

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_sObject

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

Parameters:

  • assistants_v1_service_update_tool_request (AssistantsV1ServiceUpdateToolRequest) (defaults to: :unset)

Returns:



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

Parameters:

  • assistants_v1_service_update_tool_request (AssistantsV1ServiceUpdateToolRequest) (defaults to: :unset)

Returns:



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],
    )
    .new(
        @version,
        tool_instance,
        response.headers,
        response.status_code
    )
end