<commit_before>module Spacer
  class Client
    
    SERVER = 'api.msappspace.com'
    VERSION = 'v1'
    FORMAT = :json
    
    def initialize(api_key, secret_key)
      @auth = Authentication.new(api_key, secret_key)
      @log = Logger.new(STDOUT)
      @log.level = Logger::INFO
    end
    
    def user(user_id)
      response = do_request "users/#{user_id}"
      @user = User.from_hash(response)
    end
    
    def current_user
      response = do_request "currentuser"
      # puts response.inspect
    end
    
    def profile(user_id)<commit_msg>ability to instantiate with a logger<commit_after>module Spacer
  class Client
    
    SERVER    = 'api.msappspace.com'
    VERSION   = 'v1'
    FORMAT    = :json
    LOG_LEVEL = Logger::INFO
    
    def initialize(api_key, secret_key, logger=nil)
      @auth = Authentication.new(api_key, secret_key)
      
      if logger
        @log = logger
      else
        @log = Logger.new(STDOUT)
        @log.level = LOG_LEVEL
      end
    end
    
    def user(user_id)
      response = do_request "users/#{user_id}"
      @user = User.from_hash(response)
    end
    
    def current_user
      response = do_request "currentuser"
      # puts response.inspect
    end
    
    def profile(user_id)
{'fraction_non_alphanumeric': 0.08816521048451152, 'fraction_numerical': 0.0015885623510722795, 'mean_word_length': 2.1818181818181817, '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': '7279394', 'n_tokens_mistral': 420, 'n_tokens_neox': 409, 'n_words': 91}