<commit_before>require "nice_reply_client/version"

class NiceReplyClient
  def initialize(credentials={})
    @api_key = credentials[:api_key]
  end

  def method_missing(method, *args)
    call(method,args)
  end

  private

  def call(method,args)
    http.request(compose_request(method,args[0]))
  end

  def compose_request(method,options)
    request = Net::HTTP::Post.new("#{core_url}#{method}")
    request.set_form_data(options_with_credentials(options))
    request
  end<commit_msg>adding credit to gibbon gem<commit_after>require "nice_reply_client/version"

class NiceReplyClient
  def initialize(credentials={})
    @api_key = credentials[:api_key]
  end

  # Thanks to the Gibbon gem https://github.com/amro/gibbon
  # for the idea to use method_missing and a call method
  def method_missing(method, *args)
    call(method,args)
  end

  private

  def call(method,args)
    http.request(compose_request(method,args[0]))
  end

  def compose_request(method,options)
    request = Net::HTTP::Post.new("#{core_url}#{method}")
    request.set_form_data(options_with_credentials(options))
    request
  end
{'fraction_non_alphanumeric': 0.11081322609472744, 'fraction_numerical': 0.0017873100983020554, 'mean_word_length': 4.957446808510638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '7427017', 'n_tokens_mistral': 373, 'n_tokens_neox': 365, 'n_words': 71}