## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Api # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Api < ApiBase class V2010 < Version class AccountContext < InstanceContext class CallContext < InstanceContext class FeedbackList < ListResource ## # Initialize the FeedbackList # @param [Version] version Version that contains the resource # @return [FeedbackList] FeedbackList def initialize(version, account_sid: nil, call_sid: nil) super(version) # Path Solution @solution = { account_sid: account_sid, call_sid: call_sid } end # Provide a user friendly representation def to_s '#' end end class FeedbackContext < InstanceContext ## # Initialize the FeedbackContext # @param [Version] version Version that contains the resource # @param [String] account_sid The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. # @param [String] call_sid The call sid that uniquely identifies the call # @return [FeedbackContext] FeedbackContext def initialize(version, account_sid, call_sid) super(version) # Path Solution @solution = { account_sid: account_sid, call_sid: call_sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Feedback.json" end ## # Fetch the FeedbackInstance # @return [FeedbackInstance] Fetched FeedbackInstance def fetch payload = @version.fetch('GET', @uri) FeedbackInstance.new( @version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid], ) end ## # Update the FeedbackInstance # @param [String] quality_score The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. # @param [Array[Issues]] issue 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`. # @return [FeedbackInstance] Updated FeedbackInstance 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 ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end end class FeedbackPage < Page ## # Initialize the FeedbackPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [FeedbackPage] FeedbackPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of FeedbackInstance # @param [Hash] payload Payload response from the API # @return [FeedbackInstance] FeedbackInstance def get_instance(payload) FeedbackInstance.new(@version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid]) end ## # Provide a user friendly representation def to_s '' end end class FeedbackInstance < InstanceResource ## # Initialize the FeedbackInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The SID of the # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Feedback # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [FeedbackInstance] FeedbackInstance 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' => account_sid ,'call_sid' => call_sid || @properties['call_sid'] , } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [FeedbackContext] CallContext for this CallInstance def context unless @instance_context @instance_context = FeedbackContext.new(@version , @params['account_sid'], @params['call_sid']) end @instance_context end ## # @return [String] The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. def account_sid @properties['account_sid'] end ## # @return [Time] The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. def date_created @properties['date_created'] end ## # @return [Time] The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. def date_updated @properties['date_updated'] end ## # @return [Array] 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`. def issues @properties['issues'] end ## # @return [String] `1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call. def quality_score @properties['quality_score'] end ## # @return [String] A 34 character string that uniquely identifies this resource. def sid @properties['sid'] end ## # Fetch the FeedbackInstance # @return [FeedbackInstance] Fetched FeedbackInstance def fetch context.fetch end ## # Update the FeedbackInstance # @param [String] quality_score The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. # @param [Array[Issues]] issue 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`. # @return [FeedbackInstance] Updated FeedbackInstance def update( quality_score: :unset, issue: :unset ) context.update( quality_score: quality_score, issue: issue, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end end