<commit_before># encoding: utf-8

require 'typhoeus'
require 'socket'

module Carto
  # Wrapper on top of Typhoeus
  class HttpClient

    def self.get(tag, extra_options = {})
      logger = build_logger(tag, extra_options)
      new(logger)
    end

    def self.build_logger(tag, extra_options)
      if extra_options[:log_requests] && ResponseLogger.enabled?
        ResponseLogger.new(tag, Socket.gethostname)
      else
        NullLogger.new()
      end
    end

    # Returns a wrapper to a typhoeus request object
    def request(url, options = {})
      Request.new(@logger, url, options)
    end

    def get(url, options = {})
      request = Request.new(@logger, url, options.merge(method: :get))
      request.run
    end

    def post(url, options = {})
      request = Request.new(@logger, url, options.merge(method: :post))
      request.run
    end
<commit_msg>Make constructor actually private #3778<commit_after># encoding: utf-8

require 'typhoeus'
require 'socket'

module Carto
  # Wrapper on top of Typhoeus
  class HttpClient

    private_class_method :new

    def self.get(tag, extra_options = {})
      logger = build_logger(tag, extra_options)
      new(logger)
    end

    def self.build_logger(tag, extra_options)
      if extra_options[:log_requests] && ResponseLogger.enabled?
        ResponseLogger.new(tag, Socket.gethostname)
      else
        NullLogger.new()
      end
    end

    # Returns a wrapper to a typhoeus request object
    def request(url, options = {})
      Request.new(@logger, url, options)
    end

    def get(url, options = {})
      request = Request.new(@logger, url, options.merge(method: :get))
      request.run
    end

    def post(url, options = {})
      request = Request.new(@logger, url, options.merge(method: :post))
      request.run
    end

{'fraction_non_alphanumeric': 0.1046831955922865, 'fraction_numerical': 0.003305785123966942, 'mean_word_length': 2.847457627118644, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4592032', 'n_tokens_mistral': 565, 'n_tokens_neox': 561, 'n_words': 148}