<commit_before>require "faraday"
require "faraday_middleware"

require "justcoin/version"

class Justcoin

  DEFAULT_URI = "https://justcoin.com/api/v1"

  attr_reader :key, :options, :client

  def initialize(key, options={})
    @key = key
    @options = options
    @client = build_client
  end

  private

  def build_client
    Faraday.new options[:uri] || DEFAULT_URI do |f|
      f.request :json
      f.response :json, content_type: /\bjson$/
      f.response :logger, options[:logger] if options[:logger] || options[:log]
      f.response :raise_error
    end
  end

end<commit_msg>Allow passing options to Faraday, set adapter<commit_after>require "faraday"
require "faraday_middleware"

require "justcoin/version"

class Justcoin

  DEFAULT_URL = "https://justcoin.com/api/v1".freeze

  attr_reader :key, :options, :client

  def initialize(key, options={})
    @key = key

    options[:url] ||= DEFAULT_URL
    @options = options

    @client = build_client
  end

  private

  def client_options
    options.select { |k,v| Faraday::ConnectionOptions.members.include?(k) }
  end

  def build_client
    Faraday.new(client_options) do |f|
      f.request :json

      f.response :json, content_type: /\bjson$/
      f.response :logger, options[:logger] if options[:logger] || options[:log]
      f.response :raise_error

      f.adapter Faraday.default_adapter
    end
  end

end
{'fraction_non_alphanumeric': 0.11510791366906475, 'fraction_numerical': 0.0014388489208633094, 'mean_word_length': 3.429936305732484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6489553', 'n_tokens_mistral': 473, 'n_tokens_neox': 445, 'n_words': 111}