Class: Twilio::REST::Assistants::V1::AssistantContext::AssistantsToolInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, assistant_id: nil, id: nil) ⇒ AssistantsToolInstance

Initialize the AssistantsToolInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this AssistantsTool resource.

  • sid (String)

    The SID of the Call resource to fetch.



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 412

def initialize(version, payload , assistant_id: nil, id: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'description' => payload['description'],
        'enabled' => payload['enabled'],
        'id' => payload['id'],
        'meta' => payload['meta'],
        'name' => payload['name'],
        'requires_auth' => payload['requires_auth'],
        'type' => payload['type'],
        'url' => payload['url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

    # Context
    @instance_context = nil
    @params = { 'assistant_id' => assistant_id  || @properties['assistant_id']  ,'id' => id  || @properties['id']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Tool resource.

Returns:



449
450
451
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 449

def 
    @properties['account_sid']
end

#contextAssistantsToolContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



440
441
442
443
444
445
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 440

def context
    unless @instance_context
        @instance_context = AssistantsToolContext.new(@version , @params['assistant_id'], @params['id'])
    end
    @instance_context
end

#createAssistantsToolInstance

Create the AssistantsToolInstance

Returns:



516
517
518
519
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 516

def create

    context.create
end

#date_createdTime

Returns The date and time in GMT when the Tool was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



503
504
505
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 503

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the Tool was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



509
510
511
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 509

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the AssistantsToolInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



524
525
526
527
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 524

def delete

    context.delete
end

#descriptionString

Returns The description of the tool.

Returns:

  • (String)

    The description of the tool.



455
456
457
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 455

def description
    @properties['description']
end

#enabledBoolean

Returns True if the tool is enabled.

Returns:

  • (Boolean)

    True if the tool is enabled.



461
462
463
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 461

def enabled
    @properties['enabled']
end

#idString

Returns The tool ID.

Returns:

  • (String)

    The tool ID.



467
468
469
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 467

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



538
539
540
541
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 538

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Assistants.V1.AssistantsToolInstance #{values}>"
end

#metaHash

Returns The metadata related to method, url, input_schema to used with the Tool.

Returns:

  • (Hash)

    The metadata related to method, url, input_schema to used with the Tool.



473
474
475
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 473

def meta
    @properties['meta']
end

#nameString

Returns The name of the tool.

Returns:

  • (String)

    The name of the tool.



479
480
481
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 479

def name
    @properties['name']
end

#requires_authBoolean

Returns The authentication requirement for the tool.

Returns:

  • (Boolean)

    The authentication requirement for the tool.



485
486
487
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 485

def requires_auth
    @properties['requires_auth']
end

#to_sObject

Provide a user friendly representation



531
532
533
534
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 531

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Assistants.V1.AssistantsToolInstance #{values}>"
end

#typeString

Returns The type of the tool. (‘WEBHOOK’).

Returns:

  • (String)

    The type of the tool. (‘WEBHOOK’)



491
492
493
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 491

def type
    @properties['type']
end

#urlString

Returns The url of the tool resource.

Returns:

  • (String)

    The url of the tool resource.



497
498
499
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 497

def url
    @properties['url']
end