Class: Twilio::REST::Intelligence::V2::CustomOperatorInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the CustomOperatorInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 567

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 Custom Operator belongs to.

Returns:

  • (String)

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



605
606
607
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 605

def 
    @properties['account_sid']
end

#authorString

Returns The creator of the Custom Operator. Custom Operators can only be created by a Twilio Account.

Returns:

  • (String)

    The creator of the Custom Operator. Custom Operators can only be created by a Twilio Account.



629
630
631
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 629

def author
    @properties['author']
end

#availabilityAvailability

Returns:

  • (Availability)


647
648
649
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 647

def availability
    @properties['availability']
end

#configHash

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

Returns:

  • (Hash)

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



653
654
655
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 653

def config
    @properties['config']
end

#contextCustomOperatorContext

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

Returns:



596
597
598
599
600
601
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 596

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

#date_createdTime

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

Returns:

  • (Time)

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



659
660
661
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 659

def date_created
    @properties['date_created']
end

#date_updatedTime

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

Returns:

  • (Time)

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



665
666
667
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 665

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the CustomOperatorInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



678
679
680
681
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 678

def delete

    context.delete
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.



623
624
625
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 623

def description
    @properties['description']
end

#fetchCustomOperatorInstance

Fetch the CustomOperatorInstance

Returns:



686
687
688
689
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 686

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.



617
618
619
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 617

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



719
720
721
722
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 719

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



635
636
637
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 635

def operator_type
    @properties['operator_type']
end

#sidString

Returns A 34 character string that uniquely identifies this Custom Operator.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Custom Operator.



611
612
613
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 611

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



712
713
714
715
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 712

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

#update(friendly_name: nil, config: nil, if_match: :unset) ⇒ CustomOperatorInstance

Update the CustomOperatorInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

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

  • config (Object) (defaults to: nil)

    Operator configuration, following the schema defined by the Operator Type.

  • if_match (String) (defaults to: :unset)

    The If-Match HTTP request header

Returns:



697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 697

def update(
  friendly_name: nil, 
  config: nil, 
  if_match: :unset
)

    context.update(
        friendly_name: friendly_name, 
        config: config, 
        if_match: if_match, 
    )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



671
672
673
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 671

def url
    @properties['url']
end

#versionString

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

Returns:

  • (String)

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



641
642
643
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 641

def version
    @properties['version']
end