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)


338
339
340
341
342
343
344
345
346
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 338

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



350
351
352
353
354
355
356
357
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 350

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchToolInstance

Fetch the ToolInstance

Returns:



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 362

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

#inspectObject

Provide a detailed, user friendly representation



409
410
411
412
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 409

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Assistants.V1.ToolContext #{context}>"
end

#to_sObject

Provide a user friendly representation



402
403
404
405
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 402

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:



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 382

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