Class: Twilio::REST::Intelligence::V2::OperatorInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/intelligence/v2/operator.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ OperatorInstance

Initialize the OperatorInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 391

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'sid' => payload['sid'],
        'friendly_name' => payload['friendly_name'],
        'description' => payload['description'],
        'author' => payload['author'],
        'operator_type' => payload['operator_type'],
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
        'availability' => payload['availability'],
        'config' => payload['config'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The unique SID identifier of the Account the Operator belongs to.

Returns:

  • (String)

    The unique SID identifier of the Account the Operator belongs to.



429
430
431
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 429

def 
    @properties['account_sid']
end

#authorString

Returns The creator of the Operator. Either Twilio or the creating Account.

Returns:

  • (String)

    The creator of the Operator. Either Twilio or the creating Account.



453
454
455
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 453

def author
    @properties['author']
end

#availabilityAvailability

Returns:

  • (Availability)


471
472
473
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 471

def availability
    @properties['availability']
end

#configHash

Returns Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account.

Returns:

  • (Hash)

    Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account.



477
478
479
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 477

def config
    @properties['config']
end

#contextOperatorContext

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

Returns:



420
421
422
423
424
425
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 420

def context
    unless @instance_context
        @instance_context = OperatorContext.new(@version , @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date that this Operator was created, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this Operator was created, given in ISO 8601 format.



483
484
485
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 483

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this Operator was updated, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this Operator was updated, given in ISO 8601 format.



489
490
491
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 489

def date_updated
    @properties['date_updated']
end

#descriptionString

Returns A human-readable description of this resource, longer than the friendly name.

Returns:

  • (String)

    A human-readable description of this resource, longer than the friendly name.



447
448
449
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 447

def description
    @properties['description']
end

#fetchOperatorInstance

Fetch the OperatorInstance

Returns:



502
503
504
505
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 502

def fetch

    context.fetch
end

#friendly_nameString

Returns A human-readable name of this resource, up to 64 characters.

Returns:

  • (String)

    A human-readable name of this resource, up to 64 characters.



441
442
443
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 441

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



516
517
518
519
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 516

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

#operator_typeString

Returns Operator Type for this Operator. References an existing Operator Type resource.

Returns:

  • (String)

    Operator Type for this Operator. References an existing Operator Type resource.



459
460
461
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 459

def operator_type
    @properties['operator_type']
end

#sidString

Returns A 34 character string that uniquely identifies this Operator.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Operator.



435
436
437
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 435

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



509
510
511
512
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 509

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



495
496
497
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 495

def url
    @properties['url']
end

#versionString

Returns Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator.

Returns:

  • (String)

    Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator.



465
466
467
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 465

def version
    @properties['version']
end