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.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 170

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

#annotationannotation

Access the annotation

Returns:



246
247
248
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 246

def annotation
    context.annotation
end

#contextCallContext

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

Returns:



189
190
191
192
193
194
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 189

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

#eventsevents

Access the events

Returns:



232
233
234
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 232

def events
    context.events
end

#fetchCallInstance

Fetch the CallInstance

Returns:



217
218
219
220
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 217

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



259
260
261
262
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 259

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

Returns:

  • (Hash)


210
211
212
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 210

def links
    @properties['links']
end

#metricsmetrics

Access the metrics

Returns:



225
226
227
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 225

def metrics
    context.metrics
end

#sidString

Returns:

  • (String)


198
199
200
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 198

def sid
    @properties['sid']
end

#summarysummary

Access the summary

Returns:



239
240
241
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 239

def summary
    context.summary
end

#to_sObject

Provide a user friendly representation



252
253
254
255
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 252

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

#urlString

Returns:

  • (String)


204
205
206
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 204

def url
    @properties['url']
end