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.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 145

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

#contextOperatorAttachmentContext

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

Returns:



164
165
166
167
168
169
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 164

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

#createOperatorAttachmentInstance

Create the OperatorAttachmentInstance

Returns:



192
193
194
195
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 192

def create

    context.create
end

#deleteBoolean

Delete the OperatorAttachmentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



200
201
202
203
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 200

def delete

    context.delete
end

#inspectObject

Provide a detailed, user friendly representation



214
215
216
217
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 214

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

#operator_sidString

Returns The unique SID identifier of the Operator.

Returns:

  • (String)

    The unique SID identifier of the Operator.



179
180
181
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 179

def operator_sid
    @properties['operator_sid']
end

#service_sidString

Returns The unique SID identifier of the Service.

Returns:

  • (String)

    The unique SID identifier of the Service.



173
174
175
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 173

def service_sid
    @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



207
208
209
210
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 207

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



185
186
187
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 185

def url
    @properties['url']
end