Class: Twilio::REST::Intelligence::V2::OperatorAttachmentInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, operator_sid: nil) ⇒ OperatorAttachmentInstance

Initialize the OperatorAttachmentInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 242

def initialize(version, payload , service_sid: nil, operator_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'service_sid' => payload['service_sid'],
        'operator_sid' => payload['operator_sid'],
        'url' => payload['url'],
    }

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

Instance Method Details

#context ⇒ OperatorAttachmentContext

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

Returns:



262
263
264
265
266
267
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 262

def context
    unless @instance_context
        @instance_context = OperatorAttachmentContext.new(@version , @params['service_sid'], @params['operator_sid'])
    end
    @instance_context
end

#create ⇒ OperatorAttachmentInstance

Create the OperatorAttachmentInstance

Returns:



290
291
292
293
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 290

def create

    context.create
end

#delete ⇒ Boolean

Delete the OperatorAttachmentInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



298
299
300
301
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 298

def delete

    context.delete
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



312
313
314
315
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 312

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

#operator_sid ⇒ String

Returns The unique SID identifier of the Operator.

Returns:

  • (String) —

    The unique SID identifier of the Operator.



277
278
279
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 277

def operator_sid
    @properties['operator_sid']
end

#service_sid ⇒ String

Returns The unique SID identifier of the Service.

Returns:

  • (String) —

    The unique SID identifier of the Service.



271
272
273
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 271

def service_sid
    @properties['service_sid']
end

#to_s ⇒ Object

Provide a user friendly representation



305
306
307
308
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 305

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

#url ⇒ String

Returns The URL of this resource.

Returns:

  • (String) —

    The URL of this resource.



283
284
285
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 283

def url
    @properties['url']
end