aliyun-cloud_sms 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d801f060e22842e6726d6f755f13f289b0114bff
4
- data.tar.gz: b9f615593957ea58f0201cdc7692c5101f3ffa69
3
+ metadata.gz: 494af3b131564a2b2aa19d9c228c14f8b203fe3a
4
+ data.tar.gz: 73a51a73c50986078eb7cd8daa98e1ab22adc396
5
5
  SHA512:
6
- metadata.gz: 702d40bfee904899db53dab5fa07407e0edfb62476789beedf1d42919df8e28f9539e0ca4e5f9eccc389fad14af4cf3bb304eae25c5dd901167e34d5bcc45d7c
7
- data.tar.gz: 1b30f86058602e632c30dc88684a06f078e5c830aaf0074d9fdb0d10b87f5f4f94d837b3149399d10af08cdb913d9524968c5ac1c9854ae9c3e8776e920f531d
6
+ metadata.gz: 2d6cbc11c25e6b0e2cb05edbdee343e1df517915cbcc689d594ed6f48ea682522f6c661bf15952f0d1dfe6a6e23d66a74648d556be15043ea8bab942b13045fe
7
+ data.tar.gz: adcd7c88fb36062adfdaa5430a13ae594c1fd93eb7dbd0ae430ff002fde048802200ef99ba029755cfbb6b398a8ea325adb9aca403fd7b68ed4b7e86abd0f3c5
data/README-CN.md CHANGED
@@ -39,6 +39,11 @@ client = Aliyun::CloudSms.new('your_access_key_id', 'your_access_key_secret', 'y
39
39
  client.send_msg('13800000000', 'SMS_80190090', {"customer": "jere"} )
40
40
  ```
41
41
 
42
+ #### 可选参数支持
43
+ ```ruby
44
+ Aliyun::CloudSms.send_msg('13800000000', 'SMS_80190090', {"customer": "jere"}, {:OutId => '您的业务id', :smsUpExtendCode => '上行短信用的code'} )
45
+ ```
46
+
42
47
  ## 接口
43
48
 
44
49
  ### 短信发送
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Aliyun::CloudSms
2
2
 
3
3
  This gem is used for sending sms via aliyun sms service, and querying the message status as well.
4
+
4
5
  [中文文档 Chinese document](https://github.com/jerecui/aliyun-cloud_sms/blob/master/README-CN.md)
5
6
 
6
7
  ## Installation
@@ -50,6 +51,12 @@ Aliyun::CloudSms.send_msg('13800000000', 'SMS_80190090', {"customer": "jere"} )
50
51
  client.send_msg('13800000000', 'SMS_80190090', "{\"customer\":\"jeremy\"}" )
51
52
  ```
52
53
 
54
+ #### extended params support
55
+ ```ruby
56
+ Aliyun::CloudSms.send_msg('13800000000', 'SMS_80190090', {"customer": "jere"}, {:OutId => 'your system id', :smsUpExtendCode => 'sms up extended code'} )
57
+ ```
58
+
59
+
53
60
  ### Status query
54
61
 
55
62
  ```ruby
@@ -12,8 +12,8 @@ module Aliyun::CloudSms
12
12
  end
13
13
 
14
14
 
15
- def send_msg(mobile, template_code, template_param)
16
- request = Request::MessageSend.new mobile, template_code, template_param
15
+ def send_msg(mobile, template_code, template_param, optional_params = {})
16
+ request = Request::MessageSend.new mobile, template_code, template_param, optional_params
17
17
  request.client = self
18
18
 
19
19
  request.send_request
@@ -1,6 +1,6 @@
1
+ require 'erb'
1
2
  require 'uuid'
2
3
  require 'json'
3
- require 'cgi'
4
4
  require 'openssl'
5
5
  require 'base64'
6
6
  require 'rest-client'
@@ -68,7 +68,7 @@ module Aliyun
68
68
  end
69
69
 
70
70
  def encode(str)
71
- CGI.escape(str)
71
+ ERB::Util.url_encode str
72
72
  end
73
73
 
74
74
  def sign(str)
@@ -13,7 +13,7 @@ module Aliyun
13
13
  end
14
14
 
15
15
  def action
16
- "QuerySendDetails"
16
+ "QuerySendDetails".freeze
17
17
  end
18
18
 
19
19
  def custom_params
@@ -5,16 +5,17 @@ module Aliyun
5
5
  module Request
6
6
  class MessageSend < Base
7
7
 
8
- attr_accessor :mobile, :template_code, :template_param
8
+ attr_accessor :mobile, :template_code, :template_param, :optional_params
9
9
 
10
- def initialize(mobile, template_code, template_param)
10
+ def initialize(mobile, template_code, template_param, optional_params = nil)
11
11
  self.mobile = mobile
12
12
  self.template_code = template_code
13
13
  self.template_param = template_param
14
+ self.optional_params = optional_params || {}
14
15
  end
15
16
 
16
17
  def action
17
- "SendSms"
18
+ "SendSms".freeze
18
19
  end
19
20
 
20
21
  def custom_params
@@ -24,7 +25,7 @@ module Aliyun
24
25
  :PhoneNumbers => self.mobile,
25
26
  :TemplateCode => self.template_code,
26
27
  :TemplateParam => self.template_param.to_s,
27
- }
28
+ }.merge!(self.optional_params)
28
29
  end
29
30
  end
30
31
  end
@@ -1,5 +1,5 @@
1
1
  module Aliyun
2
2
  module CloudSms
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun-cloud_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Cui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-06 00:00:00.000000000 Z
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uuid