<commit_before>module Rapidash
  class Client
    include Resourceable

    attr_accessor :extension

    def initialize
      raise ConfigurationError.new "Missing Method, define using `method` on your client"
    end

    class << self
      attr_accessor :patch, :raise_error, :extension, :encoder

      def method(method)
        case method
        when :http then include HTTPClient
        when :oauth then include OAuthClient
        when :test then include TestClient
        else
          raise ConfigurationError.new "Invalid API Authentication Method"
        end
      end

      def use_patch
        @patch = true
      end

      def extension(extension = nil)
        @extension ||= extension
      end

      def site(site = nil)
        @site ||= site
      end

      def raise_errors
        @raise_error = true
      end

      # How should the request body for POST and PUT requests
      # be formatted
      #
      # key - Symbol. One of :url_encoded, :multipart, :json
      #
      # Returns String of set format
      def encode_post_data_with(format)
        @encoder ||= format
      end
    end

    # Instance methods

    def site
      return @site if @site
      self.class.respond_to?(:site) && self.class.site
    end

    def site=(value)
      @site = value
      @connection = nil
    end

    def normalize_url(url)
      if extension
        "#{url}.#{extension}"
      elsif self.class.respond_to?(:extension) && self.class.extension
        "#{url}.#{self.class.extension}"
      else<commit_msg>Better name for class method<commit_after>module Rapidash
  class Client
    include Resourceable

    attr_accessor :extension

    def initialize
      raise ConfigurationError.new "Missing Method, define using `method` on your client"
    end

    class << self
      attr_accessor :patch, :raise_error, :extension, :encoder

      def method(method)
        case method
        when :http then include HTTPClient
        when :oauth then include OAuthClient
        when :test then include TestClient
        else
          raise ConfigurationError.new "Invalid API Authentication Method"
        end
      end

      def use_patch
        @patch = true
      end

      def extension(extension = nil)
        @extension ||= extension
      end

      def site(site = nil)
        @site ||= site
      end

      def raise_errors
        @raise_error = true
      end

      # How should the request body for POST and PUT requests
      # be formatted
      #
      # key - Symbol. One of :url_encoded, :multipart, :json
      #
      # Returns String of set format
      def encode_request_with(format)
        @encoder ||= format
      end
    end

    # Instance methods

    def site
      return @site if @site
      self.class.respond_to?(:site) && self.class.site
    end

    def site=(value)
      @site = value
      @connection = nil
    end

    def normalize_url(url)
      if extension
        "#{url}.#{extension}"
      elsif self.class.respond_to?(:extension) && self.class.extension
        "#{url}.#{self.class.extension}"
      else
{'fraction_non_alphanumeric': 0.07486285898676992, 'fraction_numerical': 0.0, 'mean_word_length': 2.024390243902439, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5358398', 'n_tokens_mistral': 860, 'n_tokens_neox': 834, 'n_words': 275}