<commit_before>module Authy
  #
  #  Authy.api_key = 'foo'
  #  Authy.api_uri = 'http://test-authy-api.heroku.com/'
  #
  class API
    USER_AGENT = "AuthyRuby/#{Authy::VERSION} (#{RUBY_PLATFORM}, Ruby #{RUBY_VERSION})"
    MIN_TOKEN_SIZE = 6
    MAX_TOKEN_SIZE = 12

    include Authy::URL

    extend HTTPClient::IncludeClient
    include_http_client(agent_name: USER_AGENT)

    def self.register_user(attributes)
      api_key = attributes.delete(:api_key)
      send_install_link_via_sms = attributes.delete(:send_install_link_via_sms) { false }
      params = {
        :user => attributes,
        :api_key => api_key || Authy.api_key,
        :send_install_link_via_sms => send_install_link_via_sms
      }

      url = "#{Authy.api_uri}/protected/json/users/new"
      response = http_client.post(url, :body => escape_query(params))

      Authy::User.new(response)
    end

    # options:
    # :id user id
    # :token authy token entered by the user
    # :force (true|false) force to check even if the cellphone is not confirmed
    #
    def self.verify(params)
      token = params.delete(:token) || params.delete('token')
      user_id = params.delete(:id) || params.delete('id')

      return invalid_response('Token format is invalid') unless token_is_safe?(token)
      return invalid_response('User id is invalid') unless is_digit?(user_id)

      params[:force] = true if params[:force].nil? && params['force'].nil?
<commit_msg>Default :send_install_link_via_sms parameter to true (as it is in the TOTP documentation)<commit_after>module Authy
  #
  #  Authy.api_key = 'foo'
  #  Authy.api_uri = 'http://test-authy-api.heroku.com/'
  #
  class API
    USER_AGENT = "AuthyRuby/#{Authy::VERSION} (#{RUBY_PLATFORM}, Ruby #{RUBY_VERSION})"
    MIN_TOKEN_SIZE = 6
    MAX_TOKEN_SIZE = 12

    include Authy::URL

    extend HTTPClient::IncludeClient
    include_http_client(agent_name: USER_AGENT)

    def self.register_user(attributes)
      api_key = attributes.delete(:api_key)
      send_install_link_via_sms = attributes.delete(:send_install_link_via_sms) { true }
      params = {
        :user => attributes,
        :api_key => api_key || Authy.api_key,
        :send_install_link_via_sms => send_install_link_via_sms
      }

      url = "#{Authy.api_uri}/protected/json/users/new"
      response = http_client.post(url, :body => escape_query(params))

      Authy::User.new(response)
    end

    # options:
    # :id user id
    # :token authy token entered by the user
    # :force (true|false) force to check even if the cellphone is not confirmed
    #
    def self.verify(params)
      token = params.delete(:token) || params.delete('token')
      user_id = params.delete(:id) || params.delete('id')

      return invalid_response('Token format is invalid') unless token_is_safe?(token)
      return invalid_response('User id is invalid') unless is_digit?(user_id)

      params[:force] = true if params[:force].nil? && params['force'].nil?

{'fraction_non_alphanumeric': 0.12075344769593004, 'fraction_numerical': 0.0020181634712411706, 'mean_word_length': 3.425595238095238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2307746', 'n_tokens_mistral': 1008, 'n_tokens_neox': 980, 'n_words': 203}