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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, call_sid: nil) ⇒ FeedbackInstance

Initialize the FeedbackInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Feedback resource.

  • sid (String)

    The SID of the Call resource to fetch.



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 153

def initialize(version, payload , account_sid: nil, call_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'issues' => payload['issues'],
        'quality_score' => payload['quality_score'] == nil ? payload['quality_score'] : payload['quality_score'].to_i,
        'sid' => payload['sid'],
    }

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

Instance Method Details

#account_sidString

Returns The unique id of the [Account](www.twilio.com/docs/iam/api/account) responsible for this resource.

Returns:



184
185
186
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 184

def 
    @properties['account_sid']
end

#contextFeedbackContext

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

Returns:



175
176
177
178
179
180
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 175

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

#date_createdTime

Returns The date that this resource was created, given in [RFC 2822](www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.

Returns:



190
191
192
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 190

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated, given in [RFC 2822](www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.

Returns:



196
197
198
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 196

def date_updated
    @properties['date_updated']
end

#fetchFeedbackInstance

Fetch the FeedbackInstance

Returns:



221
222
223
224
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 221

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



251
252
253
254
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 251

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

#issuesArray<Issues>

Returns A list of 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:

  • (Array<Issues>)

    A list of 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`.



202
203
204
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 202

def issues
    @properties['issues']
end

#quality_scoreString

Returns ‘1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call.

Returns:

  • (String)

    ‘1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call.



208
209
210
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 208

def quality_score
    @properties['quality_score']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



214
215
216
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 214

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



244
245
246
247
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 244

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Api.V2010.FeedbackInstance #{values}>"
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[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:



231
232
233
234
235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb', line 231

def update(
    quality_score: :unset, 
    issue: :unset
)

    context.update(
        quality_score: quality_score, 
        issue: issue, 
    )
end