<commit_before>require "tockspit/version"
require "tockspit/bad_credentials"

require "net/https"
require "json"

module Tockspit
  def self.roles(email, password)
    http = Net::HTTP.new('www.tickspot.com', 443)
    http.use_ssl = true

    request = Net::HTTP::Get.new('/api/v2/roles.json')
    request.basic_auth(email, password)

    response = http.request(request)

    if response.code == '401'
      raise BadCredentials
    end

    JSON.parse(response.body).map do |json|
      Role.new(json['subscription_id'], json['company'], json['api_token'])
    end
  end

  Role = Struct.new(:subscription_id, :company, :api_token)
end<commit_msg>Set user agent as required by Tick API<commit_after>require "tockspit/version"
require "tockspit/bad_credentials"

require "net/https"
require "json"

module Tockspit
  USER_AGENT = "Tockspit v#{VERSION} (<EMAIL>)"

  def self.roles(email, password)
    http = Net::HTTP.new('www.tickspot.com', 443)
    http.use_ssl = true

    request = Net::HTTP::Get.new('/api/v2/roles.json', { 'User-Agent' => USER_AGENT })
    request.basic_auth(email, password)

    response = http.request(request)

    if response.code == '401'
      raise BadCredentials
    end

    JSON.parse(response.body).map do |json|
      Role.new(json['subscription_id'], json['company'], json['api_token'])
    end
  end

  Role = Struct.new(:subscription_id, :company, :api_token)
end
{'fraction_non_alphanumeric': 0.14245014245014245, 'fraction_numerical': 0.009971509971509971, 'mean_word_length': 3.982269503546099, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2706017', 'n_tokens_mistral': 500, 'n_tokens_neox': 478, 'n_words': 98}