<commit_before># encoding: utf-8

require 'typhoeus'

module Carto
  # Wrapper on top of Typhoeus
  module Http

    class Request

      def initialize(url, options = {})
        # TODO: default params here
        @typhoeus_request = Typhoeus::Request.new(url, options)
      end

      def run
        # TODO: timing here
        @typhoeus_request.run
      end

    end

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

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

    def self.head(url, options = {})
      request = Request.new(url, options.merge(method: :head))
      request.run
    end

    def self.put(url, options = {})
      request = Request.new(url, options.merge(method: :put))
      request.run
    end
<commit_msg>Add a couple of methods used in tests #3778<commit_after># encoding: utf-8

require 'typhoeus'

module Carto
  # Wrapper on top of Typhoeus
  module Http

    class Request

      def initialize(url, options = {})
        # TODO: default params here
        @typhoeus_request = Typhoeus::Request.new(url, options)
      end

      def run
        # TODO: timing here
        @typhoeus_request.run
      end

      def url
        @typhoeus_request.url
      end

      def options
        @typhoeus_request.options
      end

    end

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

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

    def self.head(url, options = {})
      request = Request.new(url, options.merge(method: :head))
      request.run
    end

    def self.put(url, options = {})
      request = Request.new(url, options.merge(method: :put))
      request.run
    end

{'fraction_non_alphanumeric': 0.10736514522821576, 'fraction_numerical': 0.0031120331950207467, 'mean_word_length': 2.2529510961214165, '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': '6391204', 'n_tokens_mistral': 621, 'n_tokens_neox': 610, 'n_words': 158}