<commit_before>require 'faraday'
require 'json'
require 'uri'
require 'openssl'
   OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE # -- this is to

module XClarityClient
  class XClarityBase

    token_auth = '/<PASSWORD>'.freeze

    attr_reader :conn

    def initialize(conf, uri)
      connection_builder(conf, uri)
    end

    def connection_builder(conf, uri)

      #Building configuration
      @conn = Faraday.new(url: conf.host) do |faraday|
        faraday.request  :url_encoded             # form-encode POST params
        # faraday.response :logger                  # log requests to STDOUT -- Uncomment this line when you want inspect request logs.
        faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
      end

      response = authentication(conf) unless conf.auth_type != 'token'
      #TODO: What's to do with the response of authentication request?
      @conn.basic_auth(conf.username, conf.password) unless conf.auth_type != 'basic_auth'

      @conn
    end

    def connection(uri = "", options = {})
      @conn.get(uri)
    end

    def authentication(conf)
      response = @conn.post do |request|
        request.url '/session'
        request.headers['Content-Type'] = 'application/json'
        request.body = {:UserId => conf.username,<commit_msg>Fixing URI Attribute on connecion_builder method.<commit_after>require 'faraday'
require 'json'
require 'uri'
require 'openssl'
   OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE # -- this is to

module XClarityClient
  class XClarityBase

    token_auth = '/<PASSWORD>'.freeze

    attr_reader :conn

    def initialize(conf, uri)
      connection_builder(conf, uri)
    end

    def connection_builder(conf, uri)

      #Building configuration
      @conn = Faraday.new(url: conf.host + uri) do |faraday|
        faraday.request  :url_encoded             # form-encode POST params
        # faraday.response :logger                  # log requests to STDOUT -- Uncomment this line when you want inspect request logs.
        faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
      end

      response = authentication(conf) unless conf.auth_type != 'token'
      #TODO: What's to do with the response of authentication request?
      @conn.basic_auth(conf.username, conf.password) unless conf.auth_type != 'basic_auth'

      @conn
    end

    def connection(uri = "", options = {})
      @conn.get(uri)
    end

    def authentication(conf)
      response = @conn.post do |request|
        request.url '/session'
        request.headers['Content-Type'] = 'application/json'
        request.body = {:UserId => conf.username,
{'fraction_non_alphanumeric': 0.10037453183520599, 'fraction_numerical': 0.0, 'mean_word_length': 2.8431654676258993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2539348', 'n_tokens_mistral': 797, 'n_tokens_neox': 755, 'n_words': 213}