Module: Ihuyi::SMS

Defined in:
lib/ihuyi/sms.rb

Class Method Summary collapse

Class Method Details

.deliver(cellphone, content) ⇒ Object

return send_status(true/false), send_msg (xxxxxx)



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ihuyi/sms.rb', line 7

def self.deliver(cellphone, content)
  base_uri = "http://106.ihuyi.cn/webservice/sms.php"
  parser = Nori.new(:parser => :rexml)
  res = parser.parse(RestClient.get(base_uri, { :params   => {
                                                :method   => 'Submit',
                                                :account  => Ihuyi.,
                                                :password => Ihuyi.password,
                                                :mobile   => cellphone,
                                                :content  => content
                                            } }))
  return res['SubmitResult']['code'] == '2', "#{res['SubmitResult']['msg']}[#{res['SubmitResult']['code']}]"
end