<commit_before>require 'net/http'
require 'net/https' if RUBY_VERSION == '1.8.7'
require 'json'
require 'uri'

module SoftersSms

  class Client
    def initialize(username, password)
      @username, @password = username, password

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

      @http = Net::HTTP.new('www.softers.net', Net::HTTP.https_default_port)
      @http.use_ssl = true
    end

    attr_accessor :username, :password, :http, :headers

    def send_message(data)
      response = @http.post('/messaging/smsclient.php?type=send', encode(data), headers)
      if response.body.strip == "200 OK"
        Success.new(true)
      else
        Failure.new(Error.new("#{response.body}"))
      end

    end

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

  end

  class Success < Struct.new(:success)
    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>encode message to IS0-8859-1<commit_after>require 'net/http'
require 'net/https' if RUBY_VERSION == '1.8.7'
require 'json'
require 'uri'

module SoftersSms

  class Client
    def initialize(username, password)
      @username, @password = username, password

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

      @http = Net::HTTP.new('www.softers.net', Net::HTTP.https_default_port)
      @http.use_ssl = true
    end

    attr_accessor :username, :password, :http, :headers

    def send_message(data)
      data[:message] = data[:message].encode('ISO-8859-1')
      response = @http.post('/messaging/smsclient.php?type=send', encode(data), headers)
      if response.body.strip == "200 OK"
        Success.new(true)
      else
        Failure.new(Error.new("#{response.body}"))
      end

    end

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

  end

  class Success < Struct.new(:success)
    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.12127570289550986, 'fraction_numerical': 0.009651699538396978, 'mean_word_length': 2.6904024767801857, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '7013824', 'n_tokens_mistral': 799, 'n_tokens_neox': 754, 'n_words': 183}