Class: Twilio::REST::Insights::V1::CallContext::AnnotationInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, call_sid: nil) ⇒ AnnotationInstance

Initialize the AnnotationInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 303

def initialize(version, payload , call_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'call_sid' => payload['call_sid'],
        'account_sid' => payload['account_sid'],
        'answered_by' => payload['answered_by'],
        'connectivity_issue' => payload['connectivity_issue'],
        'quality_issues' => payload['quality_issues'],
        'spam' => payload['spam'],
        'call_score' => payload['call_score'] == nil ? payload['call_score'] : payload['call_score'].to_i,
        'comment' => payload['comment'],
        'incident' => payload['incident'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sid ⇒ String

Returns The unique SID identifier of the Account.

Returns:

  • (String) —

    The unique SID identifier of the Account.



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

def 
    @properties['account_sid']
end

#answered_by ⇒ AnsweredBy

Returns:

  • (AnsweredBy)


351
352
353
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 351

def answered_by
    @properties['answered_by']
end

#call_score ⇒ String

Returns Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].

Returns:

  • (String) —

    Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].



375
376
377
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 375

def call_score
    @properties['call_score']
end

#call_sid ⇒ String

Returns The unique SID identifier of the Call.

Returns:

  • (String) —

    The unique SID identifier of the Call.



339
340
341
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 339

def call_sid
    @properties['call_sid']
end

#comment ⇒ String

Returns Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments.

Returns:

  • (String) —

    Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments.



381
382
383
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 381

def comment
    @properties['comment']
end

#connectivity_issue ⇒ ConnectivityIssue

Returns:

  • (ConnectivityIssue)


357
358
359
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 357

def connectivity_issue
    @properties['connectivity_issue']
end

#context ⇒ AnnotationContext

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

Returns:



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

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

#fetch ⇒ AnnotationInstance

Fetch the AnnotationInstance

Returns:



400
401
402
403
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 400

def fetch

    context.fetch
end

#incident ⇒ String

Returns Incident or support ticket associated with this call. The incident property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in incident.

Returns:

  • (String) —

    Incident or support ticket associated with this call. The incident property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in incident.



387
388
389
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 387

def incident
    @properties['incident']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



445
446
447
448
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 445

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

#quality_issues ⇒ Array<String>

Returns Specifies if the call had any subjective quality issues. Possible values are one or more of no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, or static_noise.

Returns:

  • (Array<String>) —

    Specifies if the call had any subjective quality issues. Possible values are one or more of no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, or static_noise.



363
364
365
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 363

def quality_issues
    @properties['quality_issues']
end

#spam ⇒ Boolean

Returns Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call.

Returns:

  • (Boolean) —

    Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call.



369
370
371
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 369

def spam
    @properties['spam']
end

#to_s ⇒ Object

Provide a user friendly representation



438
439
440
441
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 438

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

#update(answered_by: :unset, connectivity_issue: :unset, quality_issues: :unset, spam: :unset, call_score: :unset, comment: :unset, incident: :unset) ⇒ AnnotationInstance

Update the AnnotationInstance

Parameters:

  • answered_by (AnsweredBy) (defaults to: :unset)
  • connectivity_issue (ConnectivityIssue) (defaults to: :unset)
  • quality_issues (String) (defaults to: :unset) —

    Specify if the call had any subjective quality issues. Possible values, one or more of no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, static_noise. Use comma separated values to indicate multiple quality issues for the same call.

  • spam (Boolean) (defaults to: :unset) —

    A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use true if the call was a spam call.

  • call_score (String) (defaults to: :unset) —

    Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].

  • comment (String) (defaults to: :unset) —

    Specify any comments pertaining to the call. comment has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the comment.

  • incident (String) (defaults to: :unset) —

    Associate this call with an incident or support ticket. The incident parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in incident.

Returns:



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 415

def update(
  answered_by: :unset, 
  connectivity_issue: :unset, 
  quality_issues: :unset, 
  spam: :unset, 
  call_score: :unset, 
  comment: :unset, 
  incident: :unset
)

    context.update(
        answered_by: answered_by, 
        connectivity_issue: connectivity_issue, 
        quality_issues: quality_issues, 
        spam: spam, 
        call_score: call_score, 
        comment: comment, 
        incident: incident, 
    )
end

#url ⇒ String

Returns:

  • (String)


393
394
395
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 393

def url
    @properties['url']
end