Class: Twilio::REST::Insights::V1::CallContext::AnnotationContext

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, call_sid) ⇒ AnnotationContext

Initialize the AnnotationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • call_sid (String)

    The unique SID identifier of the Call.



75
76
77
78
79
80
81
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 75

def initialize(version, call_sid)
  super(version)

  # Path Solution
  @solution = {call_sid: call_sid, }
  @uri = "/Voice/#{@solution[:call_sid]}/Annotation"
end

Instance Method Details

#fetchAnnotationInstance

Fetch the AnnotationInstance

Returns:



132
133
134
135
136
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 132

def fetch
  payload = @version.fetch('GET', @uri)

  AnnotationInstance.new(@version, payload, call_sid: @solution[:call_sid], )
end

#inspectObject

Provide a detailed, user friendly representation



147
148
149
150
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 147

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Insights.V1.AnnotationContext #{context}>"
end

#to_sObject

Provide a user friendly representation



140
141
142
143
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 140

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Insights.V1.AnnotationContext #{context}>"
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 (annotation.AnsweredBy) (defaults to: :unset)

    Which entity answered the call as determined by Answering Machine Detection. Use this to provide feedback on Answering Machine Detection accuracy. Possible enumerated values, one of: human, machine. human indicates the call was answered by a person. machine indicates the call was answered by an answering machine.

  • connectivity_issue (annotation.ConnectivityIssue) (defaults to: :unset)

    Specify if the call had any connectivity issues. Possible enumerated values, one : no_connectivity_issue, invalid_number, caller_id, dropped_call, number_reachability.

  • 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)

    Specify 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.

  • 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. This of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here.

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

    Associate this call with an incident or support ticket. This is of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here.

Returns:



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 113

def update(answered_by: :unset, connectivity_issue: :unset, quality_issues: :unset, spam: :unset, call_score: :unset, comment: :unset, incident: :unset)
  data = Twilio::Values.of({
      'AnsweredBy' => answered_by,
      'ConnectivityIssue' => connectivity_issue,
      'QualityIssues' => quality_issues,
      'Spam' => spam,
      'CallScore' => call_score,
      'Comment' => comment,
      'Incident' => incident,
  })

  payload = @version.update('POST', @uri, data: data)

  AnnotationInstance.new(@version, payload, call_sid: @solution[:call_sid], )
end