<commit_before>require 'faraday'
require 'nokogiri'

# @private
module FaradayMiddleware
  # @private
  class RaiseHttpException < Faraday::Middleware
    def call(env)
      @app.call(env).on_complete do |response|
        case response.status
        when 200
        when 400
          raise QboApi::BadRequest.new(error_message(response))
        when 401
          raise QboApi::Unauthorized.new(error_message(response))
        when 403
          raise QboApi::Forbidden.new(error_message(response))
        when 404
          raise QboApi::NotFound.new(error_message(response))
        when 429
          raise QboApi::TooManyRequests.new(error_message(response))
        when 500
          raise QboApi::InternalServerError.new(error_message(response))
        when 502
          raise QboApi::BadGateway.new({ error_message: response.reason_phrase })
        when 503
          raise QboApi::ServiceUnavailable.new(error_message(response))
        end
      end
    end

    def initialize(app)
      super app
    end

    private<commit_msg>Fix key name<commit_after>require 'faraday'
require 'nokogiri'

# @private
module FaradayMiddleware
  # @private
  class RaiseHttpException < Faraday::Middleware
    def call(env)
      @app.call(env).on_complete do |response|
        case response.status
        when 200
        when 400
          raise QboApi::BadRequest.new(error_message(response))
        when 401
          raise QboApi::Unauthorized.new(error_message(response))
        when 403
          raise QboApi::Forbidden.new(error_message(response))
        when 404
          raise QboApi::NotFound.new(error_message(response))
        when 429
          raise QboApi::TooManyRequests.new(error_message(response))
        when 500
          raise QboApi::InternalServerError.new(error_message(response))
        when 502
          raise QboApi::BadGateway.new({ error_body: response.reason_phrase })
        when 503
          raise QboApi::ServiceUnavailable.new(error_message(response))
        end
      end
    end

    def initialize(app)
      super app
    end

    private
{'fraction_non_alphanumeric': 0.08, 'fraction_numerical': 0.025714285714285714, 'mean_word_length': 2.5914529914529916, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5280564', 'n_tokens_mistral': 645, 'n_tokens_neox': 590, 'n_words': 127}