<commit_before>require "globalsms/version"
require 'httpclient'
require 'json/ext'

module GlobalSMS
  class SMS
    def initialize(api_key, api_secret)
      @api_base_url = "http://api.globalhaberlesme.com"
      @api_key = api_key
      @api_secret = api_secret
    end
    
    def single_send(argv)
      argv = {
        time: "now",
        turkish_character: "1"
      }.merge(argv)

      [:originator, :numbers, :text].each { |arg| puts "ERROR: #{arg} expecting" and return unless argv[arg] }

      body = "data=#{argv.to_json.to_s}"
      uri = "#{api_base_url}/sms/send/single?key=#{api_key}&secret=#{api_secret}"

      c = HTTPClient.new
      c.post(uri, body)
    end

    def bulk_send(argv)
      argv = {
        time: "now",
        turkish_character: "1"
      }.merge(argv)

      [:originator, :numbers, :text].each { |arg| puts "ERROR: #{arg} expecting" and return unless argv[arg] }

      body = "data=#{argv.to_json.to_s}"
      uri = "#{api_base_url}/sms/send/single?key=#{api_key}&secret=#{api_secret}"

      c = HTTPClient.new
      c.post(uri, body)
    end

    def multi_send(argv)

      argv_def = {
        time: "now",
        turkish_character: "1"
      }

      argv_array = argv.map { |arg| argv_def.merge(arg) }

      body = "data=#{argv.to_json.to_s}"
      uri = "#{api_base_url}/sms/send/single?key=#{api_key}&secret=#{api_secret}"

      c = HTTPClient.new
      c.post(uri, body)
    end
  end
end<commit_msg>single_send çalışır kıl<commit_after>require "globalsms/version"
require 'httpclient'
require 'json/ext'

module GlobalSMS
  class SMS
    def initialize(api_key, api_secret)
      @api_base_url = "http://api.globalhaberlesme.com"
      @api_key = api_key
      @api_secret = api_secret
    end
    
    def single_send(argv)
      argv = {
        time: "now",
        turkish_character: "1"
      }.merge(argv)

      [:originator, :numbers, :text].each { |arg| puts "ERROR: #{arg} expecting" and return unless argv[arg] }

      body = "data=#{argv.to_json.to_s}"
      uri = "#{@api_base_url}/sms/send/single?key=#{@api_key}&secret=#{@api_secret}"

      c = HTTPClient.new
      res = c.post(uri, body)

    end

    def bulk_send(argv)
      argv = {
        time: "now",
        turkish_character: "1"
      }.merge(argv)

      [:originator, :numbers, :text].each { |arg| puts "ERROR: #{arg} expecting" and return unless argv[arg] }

      body = "data=#{argv.to_json.to_s}"
      uri = "#{api_base_url}/sms/send/single?key=#{api_key}&secret=#{api_secret}"

      c = HTTPClient.new
      c.post(uri, body)
    end

    def multi_send(argv)

      argv_def = {
        time: "now",
        turkish_character: "1"
      }

      argv_array = argv.map { |arg| argv_def.merge(arg) }

      body = "data=#{argv_array.to_json.to_s}"
      uri = "#{api_base_url}/sms/send/single?key=#{api_key}&secret=#{api_secret}"

      c = HTTPClient.new
      c.post(uri, body)
    end
  end
end
{'fraction_non_alphanumeric': 0.15081521739130435, 'fraction_numerical': 0.0020380434782608695, 'mean_word_length': 2.617936117936118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1264127', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1066, 'n_words': 202}