Class: Twilio::REST::Insights::V1::CallInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/insights/v1/call.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the CallInstance

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

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 253

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

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

Instance Method Details

#annotation ⇒ annotation

Access the annotation

Returns:



330
331
332
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 330

def annotation
    context.annotation
end

#context ⇒ CallContext

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

Returns:



273
274
275
276
277
278
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 273

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

#events ⇒ events

Access the events

Returns:



316
317
318
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 316

def events
    context.events
end

#fetch ⇒ CallInstance

Fetch the CallInstance

Returns:



301
302
303
304
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 301

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



343
344
345
346
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 343

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

Returns:

  • (Hash)


294
295
296
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 294

def links
    @properties['links']
end

#metrics ⇒ metrics

Access the metrics

Returns:



309
310
311
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 309

def metrics
    context.metrics
end

#sid ⇒ String

Returns:

  • (String)


282
283
284
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 282

def sid
    @properties['sid']
end

#summary ⇒ summary

Access the summary

Returns:



323
324
325
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 323

def summary
    context.summary
end

#to_s ⇒ Object

Provide a user friendly representation



336
337
338
339
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 336

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

#url ⇒ String

Returns:

  • (String)


288
289
290
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 288

def url
    @properties['url']
end