Class: AlidayuSms::Alidayu
- Inherits:
-
Object
- Object
- AlidayuSms::Alidayu
- Defined in:
- lib/alidayu_sms/alidayu.rb
Instance Attribute Summary collapse
-
#app_key ⇒ Object
Returns the value of attribute app_key.
-
#app_secret ⇒ Object
Returns the value of attribute app_secret.
-
#post_url ⇒ Object
Returns the value of attribute post_url.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Alidayu
constructor
A new instance of Alidayu.
- #standard_send_msg(arg = []) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Alidayu
Returns a new instance of Alidayu.
7 8 9 10 11 |
# File 'lib/alidayu_sms/alidayu.rb', line 7 def initialize( = {}) self.app_key = ['app_key'] self.app_secret = ['app_secret'] self.post_url = ['post_url'] end |
Instance Attribute Details
#app_key ⇒ Object
Returns the value of attribute app_key.
5 6 7 |
# File 'lib/alidayu_sms/alidayu.rb', line 5 def app_key @app_key end |
#app_secret ⇒ Object
Returns the value of attribute app_secret.
5 6 7 |
# File 'lib/alidayu_sms/alidayu.rb', line 5 def app_secret @app_secret end |
#post_url ⇒ Object
Returns the value of attribute post_url.
5 6 7 |
# File 'lib/alidayu_sms/alidayu.rb', line 5 def post_url @post_url end |
Instance Method Details
#standard_send_msg(arg = []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/alidayu_sms/alidayu.rb', line 13 def standard_send_msg(arg = []) code, product, _phones, _extend, _sms_free_sign_name, _sms_template_code = arg _sms_param = "{'code':'#{code}','product':'#{product}'}" = Time.now.strftime("%F %T") = { app_key: self.app_key, format: 'json', method: 'alibaba.aliqin.fc.sms.num.send', partner_id: 'apidoc', sign_method: 'md5', timestamp: , v: '2.0', extend: _extend, rec_num: _phones, sms_free_sign_name: _sms_free_sign_name, sms_param: _sms_param, sms_template_code: _sms_template_code, sms_type: 'normal' } = () puts "options: #{options}" md5_str = |