module SmsVoiceFlash

Constants

FlashReportUrl
FlashSendUrl

闪信

IvrSendUrl

语音

SmsReportUrl
SmsSendUrl

短信

VERSION

Public Instance Methods

report(send_type) click to toggle source
# File lib/sms_voice_flash.rb, line 35
def report send_type
  url = URI.encode("#{Object.const_get(send_type + "ReportUrl")}?apikey=#{@key}")
  JSON.parse(RestClient.get(url).body,object_class: OpenStruct)
end
send(send_type,mobile,content) click to toggle source
# File lib/sms_voice_flash.rb, line 26
def send send_type,mobile,content
  #如果用户输入的为数组,则将数组内的元素用逗号分隔成字符串
  if mobile.kind_of?(Array)
    mobile = mobile.map{|number| number.strip}.join(",")
  end
  url = URI.encode("#{Object.const_get(send_type+"SendUrl")}?apikey=#{@key}&mobile=#{mobile}&content=#{content}&ts=#{Time.now.to_i}&sign=#{@sign}")
  JSON.parse(RestClient.get(url).body,object_class: OpenStruct)
end
set(key,sign="云喇叭") click to toggle source
# File lib/sms_voice_flash.rb, line 21
def set key,sign="云喇叭"
  @key = key
  @sign = sign
end