<commit_before>require 'montage/response'
require 'faraday'
require 'faraday_middleware'
require 'json'
require 'montage/client/files'
require 'montage/client/schemas'
require 'montage/client/documents'
require 'montage/errors'

module Montage
  class Client
    attr_accessor :token, :username, :password, :domain, :api_version

    def initialize
      @api_version = 1
      yield(self) if block_given?
      raise MissingAttributeError, "You must declare the domain attribute" unless @domain
    end

    def content_type
      "application/json"
    end

    def auth
      build_response("token") do
        connection.post do |req|
          req.url "auth"
          req.basic_auth username, password
        end
      end
    end

    def get(url, resource_name, options = {})
      build_response(resource_name) do
        connection.get do |req|<commit_msg>Fixed faraday adapter connection settings for auth route<commit_after>require 'montage/response'
require 'faraday'
require 'faraday_middleware'
require 'json'
require 'montage/client/files'
require 'montage/client/schemas'
require 'montage/client/documents'
require 'montage/errors'

module Montage
  class Client
    attr_accessor :token, :username, :password, :domain, :api_version

    def initialize
      @api_version = 1
      yield(self) if block_given?
      raise MissingAttributeError, "You must declare the domain attribute" unless @domain
    end

    def content_type
      "application/json"
    end

    def auth
      build_response("token") do
        connection.post do |req|
          req.url "auth"
          req.options.basic_auth username, password
        end
      end
    end

    def get(url, resource_name, options = {})
      build_response(resource_name) do
        connection.get do |req|
{'fraction_non_alphanumeric': 0.08123249299719888, 'fraction_numerical': 0.0011204481792717086, 'mean_word_length': 3.1247113163972284, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1318546', 'n_tokens_mistral': 528, 'n_tokens_neox': 505, 'n_words': 150}