<commit_before>require "rajasms/version"
require 'httparty'

module Rajasms
  class Client
  	include HTTParty

    RAJASMS_URI = 'http://192.168.127.12'
    SMSREGULER_PATH = '/sms/smsreguler.php'
    SMSSALDO_PATH = '/sms/smssaldo.php'
    SMSREGULER_CHECK_PATH = '/sms/smsregulerreport.php'
    SMSMASKING_CHECK_PATH = '/sms/smsmaskingreport.php'

  	base_uri RAJASMS_URI

  	def initialize username, password, api_key
  		@username = username
      @password = password
      @api_key  = api_key
  	end

    def reguler to, message
      if message.length <= 160
        response = self.class.post(SMSREGULER_PATH, build_query(number:to, message: message))
        code, data = response.body.split('|')
        {code: code, data: data}
      else
        nil
      end
    end

    def saldo
      response = self.class.get(SMSSALDO_PATH, build_query)
      code, data = response.body.split('|')
      {code: code, data: data}
    end

    def status(sms_id, reguler=false)
      response = self.class.get(reguler ? SMSREGULER_CHECK_PATH : SMSMASKING_CHECK_PATH, build_query(id: sms_id))
      code, data = response.body.split('|')
      {code: code, data: data}
    end

    private
    def build_query query={}
      query ||= {}
      query.merge!(key: @api_key, username: @username, password: @password)
      {query: query}
    end

  end
end<commit_msg>masking sms<commit_after>require "rajasms/version"
require 'httparty'

module Rajasms
  class Client
  	include HTTParty

    RAJASMS_URI = 'http://192.168.127.12'
    SMSREGULER_PATH = '/sms/smsreguler.php'
    SMSMASKING_PATH = '/sms/smsmasking.php'
    SMSSALDO_PATH = '/sms/smssaldo.php'
    SMSREGULER_CHECK_PATH = '/sms/smsregulerreport.php'
    SMSMASKING_CHECK_PATH = '/sms/smsmaskingreport.php'

  	base_uri RAJASMS_URI

  	def initialize username, password, api_key
  		@username = username
      @password = password
      @api_key  = api_key
  	end

    def reguler to, message
      send(to, message, SMSREGULER_PATH)
    end

    def masking to, message
      send(to, message, SMSMASKING_PATH)
    end

    def saldo
      response = self.class.get(SMSSALDO_PATH, build_query)
      code, data = response.body.split('|')
      {code: code, data: data}
    end

    def status(sms_id, reguler=false)
      response = self.class.get(reguler ? SMSREGULER_CHECK_PATH : SMSMASKING_CHECK_PATH, build_query(id: sms_id))
      code, data = response.body.split('|')
      {code: code, data: data}
    end

    private
    def build_query query={}
      query ||= {}
      query.merge!(key: @api_key, username: @username, password: <PASSWORD>)
      {query: query}
    end

    def send to, message, path
      if message.length <= 160
        response = self.class.post(path, build_query(number:to, message: message))
        code, data = response.body.split('|')
        {code: code, data: data}
      else
        nil
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.10901611244429209, 'fraction_numerical': 0.009598902982516283, 'mean_word_length': 2.7945383615084527, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5472761', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1023, 'n_words': 225}