<commit_before>module Sendvia
  class Base < ActiveResource::Base
    self.include_format_in_path = false
    self.include_root_in_json = false
    self.primary_key = :Id

    BASE_API_ENDPOINT = 'https://www.sendvia.co.uk/'
    API_VERSION = 'alpha5'
    REST_API_ENDPOINT = "#{BASE_API_ENDPOINT}rest/#{API_VERSION}/"

    def self.activate_session session
      self.site = REST_API_ENDPOINT
      self.headers.merge! 'authorization' => "Bearer #{session.access_token}"
    end

    def self.clear_session!
      self.headers.delete('authorization')
    end

    def self.create_with_url_params(attributes = {}, params = {})
      self.new(attributes).tap do |resource|
        old_prefix_options = resource.prefix_options.dup
        resource.prefix_options = resource.prefix_options.merge(params)
        resource.save
        resource.prefix_options = old_prefix_options
      end
    end

    private

    def self.query_string(options)
      option_string = options.to_query.gsub(/\%5B/, "[").gsub(/\%5D/, "]")
      "?#{option_string}" unless options.nil? || options.empty?
    end
  end
end<commit_msg>Small change to prefer #present?<commit_after>module Sendvia
  class Base < ActiveResource::Base
    self.include_format_in_path = false
    self.include_root_in_json = false
    self.primary_key = :Id

    BASE_API_ENDPOINT = 'https://www.sendvia.co.uk/'
    API_VERSION = 'alpha5'
    REST_API_ENDPOINT = "#{BASE_API_ENDPOINT}rest/#{API_VERSION}/"

    def self.activate_session session
      self.site = REST_API_ENDPOINT
      self.headers.merge! 'authorization' => "Bearer #{session.access_token}"
    end

    def self.clear_session!
      self.headers.delete('authorization')
    end

    def self.create_with_url_params(attributes = {}, params = {})
      self.new(attributes).tap do |resource|
        old_prefix_options = resource.prefix_options.dup
        resource.prefix_options = resource.prefix_options.merge(params)
        resource.save
        resource.prefix_options = old_prefix_options
      end
    end

    private

    def self.query_string(options)
      option_string = options.to_query.gsub(/\%5B/, "[").gsub(/\%5D/, "]")
      "?#{option_string}" if options.present?
    end
  end
end
{'fraction_non_alphanumeric': 0.1142600089968511, 'fraction_numerical': 0.002699055330634278, 'mean_word_length': 3.2281368821292777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1757082', 'n_tokens_mistral': 718, 'n_tokens_neox': 695, 'n_words': 120}