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

Inherits:
Twilio::REST::InstanceResource 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, payload, call_sid: nil) ⇒ AnnotationInstance

Initialize the AnnotationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • call_sid (String) (defaults to: nil)

    The unique SID identifier of the Call.



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 162

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, }
end

Instance Method Details

#account_sidString

Returns Account SID.

Returns:

  • (String)

    Account SID.



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

def 
  @properties['account_sid']
end

#answered_byannotation.AnsweredBy

Returns Indicates the answering entity as determined by Answering Machine Detection.

Returns:

  • (annotation.AnsweredBy)

    Indicates the answering entity as determined by Answering Machine Detection.



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

def answered_by
  @properties['answered_by']
end

#call_scoreString

Returns Call Score.

Returns:

  • (String)

    Call Score



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

def call_score
  @properties['call_score']
end

#call_sidString

Returns Call SID.

Returns:

  • (String)

    Call SID.



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

def call_sid
  @properties['call_sid']
end

#commentString

Returns User comments.

Returns:

  • (String)

    User comments



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

def comment
  @properties['comment']
end

#connectivity_issueannotation.ConnectivityIssue

Returns Indicates if the call had any connectivity issue.

Returns:

  • (annotation.ConnectivityIssue)

    Indicates if the call had any connectivity issue



215
216
217
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 215

def connectivity_issue
  @properties['connectivity_issue']
end

#contextAnnotationContext

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

Returns:



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

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

#fetchAnnotationInstance

Fetch the AnnotationInstance

Returns:



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

def fetch
  context.fetch
end

#incidentString

Returns Call tag for incidents or support ticket.

Returns:

  • (String)

    Call tag for incidents or support ticket



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

def incident
  @properties['incident']
end

#inspectObject

Provide a detailed, user friendly representation



313
314
315
316
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 313

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

#quality_issuesArray[String]

Returns Indicates if the call had audio quality issues.

Returns:

  • (Array[String])

    Indicates if the call had audio quality issues.



221
222
223
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 221

def quality_issues
  @properties['quality_issues']
end

#spamBoolean

Returns Call spam indicator.

Returns:

  • (Boolean)

    Call spam indicator



227
228
229
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 227

def spam
  @properties['spam']
end

#to_sObject

Provide a user friendly representation



306
307
308
309
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 306

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 (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:



285
286
287
288
289
290
291
292
293
294
295
# File 'lib/twilio-ruby/rest/insights/v1/call/annotation.rb', line 285

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



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

def url
  @properties['url']
end