Class: Alibaba::Bigfish
- Inherits:
-
Object
- Object
- Alibaba::Bigfish
- Defined in:
- lib/alidayu.rb
Instance Method Summary collapse
-
#initialize(key, secret, https = true) ⇒ Bigfish
constructor
A new instance of Bigfish.
- #send_sms(params = {}) ⇒ Object
- #singlecall_tts(params = {}) ⇒ Object
Constructor Details
#initialize(key, secret, https = true) ⇒ Bigfish
Returns a new instance of Bigfish.
7 8 9 10 11 12 |
# File 'lib/alidayu.rb', line 7 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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/alidayu.rb', line 14 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
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/alidayu.rb', line 36 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 |