<commit_before>require 'net/http'
require 'net/https'
require 'json'
require 'uri'

module Nexmo
  class Client
    def initialize(key, secret)
      @key, @secret = key, secret

      @headers = {'Content-Type' => 'application/x-www-form-urlencoded'}

      @http = Net::HTTP.new('rest.nexmo.com', 443)

      @http.use_ssl = true
    end

    attr_accessor :key, :secret, :http, :headers

    def send_message(data)
      response = post('/sms/json', data.merge(:username => @key, :password => @secret))

      object = JSON.parse(response.body)['messages'].first

      status = object['status'].to_i

      if status == 0
        Success.new(object['message-id'])
      else
        Failure.new(Error.new(object['error-text']))
      end
    end

    private

    def post(path, data)
      @http.post(path, URI.encode_www_form(data), headers)
    end
  end

  class Success < Struct.new(:message_id)
    def success?
      true
    end

    def failure?
      false
    end
  end

  class Failure < Struct.new(:error)
    def success?
      false
    end

    def failure?
      true
    end
  end

  class Error < StandardError
  end
end
<commit_msg>Remove private post method and add private encode method<commit_after>require 'net/http'
require 'net/https'
require 'json'
require 'uri'

module Nexmo
  class Client
    def initialize(key, secret)
      @key, @secret = key, secret

      @headers = {'Content-Type' => 'application/x-www-form-urlencoded'}

      @http = Net::HTTP.new('rest.nexmo.com', 443)

      @http.use_ssl = true
    end

    attr_accessor :key, :secret, :http, :headers

    def send_message(data)
      response = @http.post('/sms/json', encode(data), headers)

      object = JSON.parse(response.body)['messages'].first

      status = object['status'].to_i

      if status == 0
        Success.new(object['message-id'])
      else
        Failure.new(Error.new(object['error-text']))
      end
    end

    private

    def encode(data)
      URI.encode_www_form data.merge(:username => @key, :password => @secret)
    end
  end

  class Success < Struct.new(:message_id)
    def success?
      true
    end

    def failure?
      false
    end
  end

  class Failure < Struct.new(:error)
    def success?
      false
    end

    def failure?
      true
    end
  end

  class Error < StandardError
  end
end

{'fraction_non_alphanumeric': 0.12105711849957375, 'fraction_numerical': 0.0034100596760443308, 'mean_word_length': 2.4718934911242605, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '595765', 'n_tokens_mistral': 776, 'n_tokens_neox': 731, 'n_words': 189}