<commit_before>require 'helper'
require 'hello_sign'
require 'webmock/rspec'
require 'json'

if ENV['CI']
  require 'coveralls'
  Coveralls.wear!
end

HelloSign.configure do |hs|
  hs.email_address = '<EMAIL>'
  hs.password      = '<PASSWORD>'
end

def stub_get(path)
  stub_request(:get, "https://api.hellosign.com/v3#{path}")
end

def stub_post(path)
  stub_request(:post, "https://api.hellosign.com/v3#{path}")
end

def stub_get_with_auth(path)
  stub_request(:get, "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}")
end

def stub_post_with_auth(path)
  stub_request(:post, "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}")
end

def stub_request_with_error(error)
  stub_request(:any, /api\.hellosign\.com/)
    .to_return(
      headers: {'Content-Type' => 'application/json'},
      body:    {error: {error_name: error}}.to_json
    )
end

def a_get(path)
  a_request(:get, "https://api.hellosign.com/v3#{path}")
end

def a_post(path)
  a_request(:post, "https://api.hellosign.com/v3#{path}")
end

def a_get_with_auth(path)
  a_request(:get, "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}")
end

def a_post_with_auth(path)
  a_request(:post, "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}")
end<commit_msg>Refactor integration helpers slightly<commit_after>require 'helper'
require 'hello_sign'
require 'webmock/rspec'
require 'json'

if ENV['CI']
  require 'coveralls'
  Coveralls.wear!
end

HelloSign.configure do |hs|
  hs.email_address = '<EMAIL>'
  hs.password      = '<PASSWORD>'
end

def stub_get(path)
  stub_request(:get, "https://api.hellosign.com/v3#{path}")
end

def stub_post(path)
  stub_request(:post, "https://api.hellosign.com/v3#{path}")
end

def stub_get_with_auth(path)
  stub_request(
    :get,
    "https://<EMAIL>:foobar@api.hellosign.com/v3#{path}"
  )
end

def stub_post_with_auth(path)
  stub_request(
    :post,
    "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}"
  )
end

def stub_request_with_error(error)
  stub_request(:any, /api\.hellosign\.com/)
    .to_return(
      headers: {'Content-Type' => 'application/json'},
      body:    {error: {error_name: error}}.to_json
    )
end

def a_get(path)
  a_request(:get, "https://api.hellosign.com/v3#{path}")
end

def a_post(path)
  a_request(:post, "https://api.hellosign.com/v3#{path}")
end

def a_get_with_auth(path)
  a_request(:get, "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}")
end

def a_post_with_auth(path)
  a_request(
    :post,
    "https://david@bowman.com:foobar@api.hellosign.com/v3#{path}"
  )
end
{'fraction_non_alphanumeric': 0.17215975184179916, 'fraction_numerical': 0.006203955021326095, 'mean_word_length': 4.823927765237021, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 15, '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': '893898', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1080, 'n_words': 155}