Class: Alibaba::Bigfish
- Inherits:
-
Object
- Object
- Alibaba::Bigfish
- Defined in:
- lib/alidayu.rb
Instance Method Summary collapse
-
#initialize(key, secret, https = true) ⇒ Bigfish
constructor
http: https:.
- #send_sms(params = {}) ⇒ Object
- #singlecall_tts(params = {}) ⇒ Object
Constructor Details
#initialize(key, secret, https = true) ⇒ Bigfish
http: https:
11 12 13 14 15 16 |
# File 'lib/alidayu.rb', line 11 def initialize(key, secret, https=true) @key = key @secret = secret @server = https ? "https://eco.taobao.com/router/rest" : "http://gw.api.taobao.com/router/rest" end |
Instance Method Details
#send_sms(params = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/alidayu.rb', line 18 def send_sms(params={}) required_params = {app_key: @key, format: 'json', method: 'alibaba.aliqin.fc.sms.num.send', sign_method: 'md5', timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S"), v: '2.0', rec_num: params[:rec_num], sms_free_sign_name: params[:sms_free_sign_name], # sms_param: "{'code':123456','product':'药药灵','item':'吃药'}", sms_param: params[:sms_param].to_json, sms_template_code: params[:sms_template_code], sms_type: 'normal'} sign = sign_parmas(required_params) signed_parmas = required_params.merge({sign: sign}) uri = URI(@server) res = Net::HTTP.post_form(uri,signed_parmas) return res.body end |
#singlecall_tts(params = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/alidayu.rb', line 41 def singlecall_tts(params={}) required_params = {app_key: @key, format: 'json', method: 'alibaba.aliqin.fc.tts.num.singlecall', sign_method: 'md5', timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S"), v: '2.0', called_num: params[:called_num], called_show_num: params[:called_show_num], # tts_param: "{'code':123456','product':'药药灵','item':'吃药'}", tts_param: params[:tts_param].to_json, tts_code: params[:tts_code] } sign = sign_parmas(required_params) signed_parmas = required_params.merge({sign: sign}) uri = URI(@server) res = Net::HTTP.post_form(uri,signed_parmas) return res.body end |