module Dianji::Sms

Public Instance Methods

send_to(phone, content, timestamps, options = {}) click to toggle source
# File lib/dianji/sms.rb, line 5
def send_to(phone, content, timestamps, options = {})
  options = options.merge({
    account: Dianji.account,
    password: ::Digest::MD5.hexdigest([Dianji.password, phone, timestamps].join),
    mobile: phone,
    content: "#{Dianji.signature}#{content}",
    timestamps: timestamps
    })
  JSON.parse RestClient.post("#{Dianji.gateway}/msgHttp/json/mt", options)
end