Class: Twilio::REST::Assistants::V1::ToolInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, id: nil) ⇒ ToolInstance

Initialize the ToolInstance

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 Tool resource.

  • sid (String)

    The SID of the Call resource to fetch.



434
435
436
437
438
439
440
441
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 434

def initialize(version, payload , 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']),
        'policies' => payload['policies'],
    }

    # Context
    @instance_context = nil
    @params = { '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:



471
472
473
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 471

def 
    @properties['account_sid']
end

#contextToolContext

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

Returns:



462
463
464
465
466
467
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 462

def context
    unless @instance_context
        @instance_context = ToolContext.new(@version , @params['id'])
    end
    @instance_context
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:



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

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:



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ToolInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



544
545
546
547
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 544

def delete

    context.delete
end

#descriptionString

Returns The description of the tool.

Returns:

  • (String)

    The description of the tool.



477
478
479
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 477

def description
    @properties['description']
end

#enabledBoolean

Returns True if the tool is enabled.

Returns:

  • (Boolean)

    True if the tool is enabled.



483
484
485
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 483

def enabled
    @properties['enabled']
end

#fetchToolInstance

Fetch the ToolInstance

Returns:



552
553
554
555
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 552

def fetch

    context.fetch
end

#idString

Returns The tool ID.

Returns:

  • (String)

    The tool ID.



489
490
491
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 489

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



577
578
579
580
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 577

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Assistants.V1.ToolInstance #{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.



495
496
497
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 495

def meta
    @properties['meta']
end

#nameString

Returns The name of the tool.

Returns:

  • (String)

    The name of the tool.



501
502
503
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 501

def name
    @properties['name']
end

#policiesArray<AssistantsV1ServicePolicy>

Returns The Policies associated with the tool.

Returns:

  • (Array<AssistantsV1ServicePolicy>)

    The Policies associated with the tool.



537
538
539
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 537

def policies
    @properties['policies']
end

#requires_authBoolean

Returns The authentication requirement for the tool.

Returns:

  • (Boolean)

    The authentication requirement for the tool.



507
508
509
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 507

def requires_auth
    @properties['requires_auth']
end

#to_sObject

Provide a user friendly representation



570
571
572
573
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 570

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

#typeString

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

Returns:

  • (String)

    The type of the tool. (‘WEBHOOK’)



513
514
515
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 513

def type
    @properties['type']
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:



561
562
563
564
565
566
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 561

def update(assistants_v1_service_update_tool_request: :unset
)

    context.update(
    )
end

#urlString

Returns The url of the tool resource.

Returns:

  • (String)

    The url of the tool resource.



519
520
521
# File 'lib/twilio-ruby/rest/assistants/v1/tool.rb', line 519

def url
    @properties['url']
end