<commit_before>module Finicity
  # Abstracting as a class makes it easier since we wont have to redefine the access_token over and over.
  class Partner

    def initialize
      Finicity::Configure::KEYS.each do |key|
        instance_variable_set(:"@#{key}", Finicity.instance_variable_get(:"@#{key}"))
      end
    end

    def authenticate
      xml = "<credentials> <partnerId>2445581240361</partnerId> <partnerSecret><KEY></partnerSecret> </credentials>"

      @response = post("partners/authentication", xml)

      puts @response
    end

    def post path, xml
      base_url = "https://api.finicity.com/aggregation/v2/"

      url = base_url + path
      RestClient.proxy = ENV["QUOTAGUARDSTATIC_URL"]

      RestClient.post(url, xml, {:content_type => :xml, "Finicity-App-Key" => "30d4600267701941ea2a38b1fa7d7110"}){ |response, request, result, &block|
          case response.code
          when 200
            response
          when 201
            response
          else
            response.return!(request, result, &block)
          end
      }

    end

  end
end<commit_msg>add debuging<commit_after>module Finicity
  # Abstracting as a class makes it easier since we wont have to redefine the access_token over and over.
  class Partner

    def initialize
      Finicity::Configure::KEYS.each do |key|
        instance_variable_set(:"@#{key}", Finicity.instance_variable_get(:"@#{key}"))
      end
    end

    def authenticate
      xml = "<credentials> <partnerId>2445581240361</partnerId> <partnerSecret><KEY></partnerSecret> </credentials>"

      @response = post("partners/authentication", xml)

      puts @response
    end

    def post path, xml
      base_url = "https://api.finicity.com/aggregation/v2/"

      url = base_url + path
      RestClient.proxy = ENV["QUOTAGUARDSTATIC_URL"]

      puts url

      RestClient.post(url, xml, {:content_type => :xml, "Finicity-App-Key" => "30d4600267701941ea2a38b1fa7d7110"}){ |response, request, result, &block|
          case response.code
          when 200
            response
          when 201
            response
          else
            response.return!(request, result, &block)
          end
      }

      puts response

    end

  end
end
{'fraction_non_alphanumeric': 0.10483870967741936, 'fraction_numerical': 0.03942652329749104, 'mean_word_length': 2.5670926517571884, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '7522041', 'n_tokens_mistral': 747, 'n_tokens_neox': 674, 'n_words': 166}