<commit_before>require 'httparty'

module MnoEnterprise
  class MnoHttparty
    include HTTParty
    base_uri "#{MnoEnterprise.mno_api_host}/api/mnoe/v1"
    attr_accessor :opts

    def initialize(u = MnoEnterprise.tenant_id, p = MnoEnterprise.tenant_key)
      @auth = {username: u, password: p}
    end

    def api_post(path, options = {})
      options.merge!({basic_auth: @auth})
      body_copy = options.delete(:body)
      options.merge!({body: {data: body_copy}})
      # binding.pry
      self.class.post(path, options)
    end

    def api_get(path, options = {})
      options.merge!({basic_auth: @auth})
      self.class.get(path, options)
    end
  end
end<commit_msg>feature(EventLogger): add event logger module and event logs<commit_after>require 'httparty'

module MnoEnterprise
  class MnoHttparty
    include HTTParty
    base_uri "#{MnoEnterprise.mno_api_host}/api/mnoe/v1"
    attr_accessor :opts

    def initialize(u = MnoEnterprise.tenant_id, p = MnoEnterprise.tenant_key)
      @auth = {username: u, password: p}
    end

    def api_post(path, options = {})
      options = format_params(options)
      self.class.post(path, options)
    end

    def api_get(path, options = {})
      options = format_params(options)
      self.class.get(path, options)
    end

    private

    def format_params(options)
      options.merge!({basic_auth: @auth})
      body_copy = options.delete(:body)
      options.merge!({body: {data: body_copy}})
      options
    end
  end
end
{'fraction_non_alphanumeric': 0.11296791443850267, 'fraction_numerical': 0.001336898395721925, 'mean_word_length': 3.19327731092437, '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': '4426396', 'n_tokens_mistral': 509, 'n_tokens_neox': 508, 'n_words': 106}