<commit_before>require_relative 'json_utils'

class GdsApi::Base
  include GdsApi::JsonUtils

  def initialize(environment)
    adapter_name = self.class.to_s.split("::").last.downcase
    self.endpoint = "http://#{adapter_name}.#{environment}.alphagov.co.uk"
  end
  
  def url_for_slug(slug,options={})
    base = "#{base_url}/#{slug}.json"
    params = options.map { |k,v| "#{k}=#{v}" }
    base = base + "?#{params.join("&")}" unless options.empty? 
    base
  end
  
  private
    attr_accessor :endpoint
end<commit_msg>Allow a specific endpoint URL to be passed in<commit_after>require_relative 'json_utils'

class GdsApi::Base
  include GdsApi::JsonUtils

  def initialize(environment, endpoint_url = nil)
    adapter_name = self.class.to_s.split("::").last.downcase

    if endpoint_url
      self.endpoint = endpoint_url
    elsif environment == 'development'
      self.endpoint = "http://#{adapter_name}.dev.gov.uk"
    else
      self.endpoint = "http://#{adapter_name}.#{environment}.alphagov.co.uk"
    end
  end
  
  def url_for_slug(slug,options={})
    base = "#{base_url}/#{slug}.json"
    params = options.map { |k,v| "#{k}=#{v}" }
    base = base + "?#{params.join("&")}" unless options.empty? 
    base
  end
  
  private
    attr_accessor :endpoint
end
{'fraction_non_alphanumeric': 0.1577708006279435, 'fraction_numerical': 0.0, 'mean_word_length': 3.653284671532847, 'pattern_counts': {'":': 2, '<': 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': '5068373', 'n_tokens_mistral': 439, 'n_tokens_neox': 451, 'n_words': 84}