<commit_before>require 'bluestorm_sms/version'
require 'bluestorm_sms/configuration'
require 'net/http'
require 'digest'
require 'iconv'
require 'time'

module BluestormSMS
  extend self
  #config
  attr_writer :config

  def config
    @config ||= Configuration.new
  end

  def configure
    yield(config)
  end

  #send sms
  URL = "http://sdk2.entinfo.cn:8061/mdsmssend.ashx"

  def pwd
    Digest::MD5.hexdigest(@config.sn + @config.pwd).upcase
  end

  def send(phone, content)
    result = Net::HTTP.post_form(URI.parse("#{URL}"), sn: @config.sn, pwd: <PASSWORD>, mobile: phone, content: content)
    if result.body.match '^\d{18}$'
      {success: result.body}
    else
      {error: result.body}
    end
  end

  #get sms
  def get messages
    messages = Iconv.conv('utf-8', 'gb2312', messages)
    arr = messages.split(';').collect {|x| x.split(',')}
    results = []
    arr.each do |m|
      message = Hash.new
      message[:from] = m[2]
      message[:content] = m[3]
      message[:time] = Time.parse m[4]
      results << message
    end
    results
  end

end<commit_msg>增加 ext 扩展通道支持<commit_after>require 'bluestorm_sms/version'
require 'bluestorm_sms/configuration'
require 'net/http'
require 'digest'
require 'iconv'
require 'time'

module BluestormSMS
  extend self
  #config
  attr_writer :config

  def config
    @config ||= Configuration.new
  end

  def configure
    yield(config)
  end

  #send sms
  URL = "http://sdk2.entinfo.cn:8061/mdsmssend.ashx"

  def pwd
    Digest::MD5.hexdigest(@config.sn + @config.pwd).upcase
  end

  def send(phone, content, ext = 0)
    result = Net::HTTP.post_form(URI.parse("#{URL}"), sn: @config.sn, pwd: <PASSWORD>, mobile: phone, content: content, ext: ext)
    if result.body.match '^\d{18}$'
      {success: result.body}
    else
      {error: result.body}
    end
  end

  #get sms
  def get messages
    messages = Iconv.conv('utf-8', 'gb2312', messages)
    arr = messages.split(';').collect {|x| x.split(',')}
    results = []
    arr.each do |m|
      message = Hash.new
      message[:from] = m[2]
      message[:content] = m[3]
      message[:time] = Time.parse m[4]
      results << message
    end
    results
  end

end
{'fraction_non_alphanumeric': 0.14292216659080564, 'fraction_numerical': 0.015020482476103778, 'mean_word_length': 3.0404411764705883, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '5680902', 'n_tokens_mistral': 823, 'n_tokens_neox': 798, 'n_words': 189}