Module: YunPian
Constant Summary collapse
- SEND_URL =
'https://sms.yunpian.com/v2/sms/batch_send.json'
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#apikey ⇒ Object
Returns the value of attribute apikey.
Instance Method Summary collapse
-
#send(mobiles, message, options = {}) ⇒ Object
国内短信发送接口 1:准备参数 options(:apikey, :mobile, :message) 2:初始化 URI 对象 3:调用接口 4:解析返回的结果.
Instance Attribute Details
#apikey ⇒ Object
Returns the value of attribute apikey.
8 9 10 |
# File 'lib/yun-pian.rb', line 8 def apikey @apikey end |
Instance Method Details
#send(mobiles, message, options = {}) ⇒ Object
国内短信发送接口
1:准备参数 options(:apikey, :mobile, :message)
2:初始化 URI 对象
3:调用接口
4:解析返回的结果
17 18 19 20 21 22 23 24 25 |
# File 'lib/yun-pian.rb', line 17 def send(mobiles, , = {}) [:apikey] ||= YunPian.apikey .merge!({ mobile: mobiles, text: }) uri = URI SEND_URL res = Net::HTTP.post_form(uri, ) result res.body end |