Module: Dianji::Sms

Extended by:
Sms
Included in:
Sms
Defined in:
lib/dianji/sms.rb

Instance Method Summary collapse

Instance Method Details

#send_to(phone, content, timestamps, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/dianji/sms.rb', line 5

def send_to(phone, content, timestamps, options = {})
  options = options.merge({
    account: Dianji.,
    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