Class: Twilio::REST::Api::V2010::AccountContext::CallContext::FeedbackContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, call_sid) ⇒ FeedbackContext

Initialize the FeedbackContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The unique id of the Account responsible for this resource.

  • call_sid (String)

    The call sid that uniquely identifies the call


82
83
84
85
86
87
88
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 82

def initialize(version, , call_sid)
  super(version)

  # Path Solution
  @solution = {account_sid: , call_sid: call_sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Feedback.json"
end

Instance Method Details

#create(quality_score: nil, issue: :unset) ⇒ FeedbackInstance

Create the FeedbackInstance

Parameters:

  • quality_score (String) (defaults to: nil)

    The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call.

  • issue (Array[feedback.Issues]) (defaults to: :unset)

    A list of one or more issues experienced during the call. Issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`.

Returns:


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 114

def create(quality_score: nil, issue: :unset)
  data = Twilio::Values.of({
      'QualityScore' => quality_score,
      'Issue' => Twilio.serialize_list(issue) { |e| e },
  })

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

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

#fetchFeedbackInstance

Fetch the FeedbackInstance

Returns:


93
94
95
96
97
98
99
100
101
102
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 93

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

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

#inspectObject

Provide a detailed, user friendly representation


165
166
167
168
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 165

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

#to_sObject

Provide a user friendly representation


158
159
160
161
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 158

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.FeedbackContext #{context}>"
end

#update(quality_score: :unset, issue: :unset) ⇒ FeedbackInstance

Update the FeedbackInstance

Parameters:

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

    The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call.

  • issue (Array[feedback.Issues]) (defaults to: :unset)

    One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`.

Returns:


140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 140

def update(quality_score: :unset, issue: :unset)
  data = Twilio::Values.of({
      'QualityScore' => quality_score,
      'Issue' => Twilio.serialize_list(issue) { |e| e },
  })

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

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