cloopen 0.1.1 → 0.1.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 +4 -4
- data/README.md +5 -0
- data/lib/cloopen/sms.rb +13 -23
- data/lib/cloopen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47ca4b10b13c904f8b63450ded421b2473be1880
|
4
|
+
data.tar.gz: c7c00248518bfee98a46006a1484db7adeae337d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b15f0f5adad291e1c0ed144d2f3ef7004ded438a8b897518b9e2be7fea87becfd6775ee8a2abf7e51c54670455be07a7a469a3000ab10e2c13195cce8e4457f4
|
7
|
+
data.tar.gz: e55b814a0572bc574795b871f9fe1122e59045ae45b76b61e9531ccecd680dbd0b7a6a69297b024e02efc5591b67cd7d72ec2d7db7ff860dea039d14784a18f3
|
data/README.md
CHANGED
@@ -61,6 +61,11 @@ Cloopen.env = "production" # 如果是测试环境,填写 "development"
|
|
61
61
|
|
62
62
|
* 第三个是模板中的变量的值。用于替换 `【薄荷网】您的的验证码是{1}` 中的变量。
|
63
63
|
|
64
|
+
## 荣耀归给仨小伙
|
65
|
+
|
66
|
+
* [tteng](http://github.com/tteng)
|
67
|
+
* [xiaoronglv](https://github.com/xiaoronglv)
|
68
|
+
* [Teddy](https://github.com/teddy1004)
|
64
69
|
|
65
70
|
## Contributing
|
66
71
|
|
data/lib/cloopen/sms.rb
CHANGED
@@ -3,48 +3,38 @@ require 'uri'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module Cloopen
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
module SMS
|
7
|
+
# 发送短信
|
8
|
+
# Cloopen::SMS.deliver(18668189882, 3127, ["w1n2ty"])
|
9
|
+
# 手机号: 18668189882
|
10
|
+
# 模板 id: 3127
|
11
|
+
# 模板变量替换值: ["937218"]
|
12
|
+
def self.deliver(cellphone, template_id, contents)
|
13
|
+
sig_parameter, authorization = Sign.generate_sig_and_auth
|
13
14
|
|
14
|
-
def deliver
|
15
15
|
if Cloopen.env == "production"
|
16
16
|
base_uri = "https://app.cloopen.com:8883/2013-12-26/Accounts/"
|
17
17
|
else
|
18
18
|
base_uri = "https://sandboxapp.cloopen.com:8883/2013-12-26/Accounts/"
|
19
19
|
end
|
20
20
|
|
21
|
-
sms_url = "#{base_uri}#{Cloopen.account_sid}/SMS/TemplateSMS?sig=#{
|
21
|
+
sms_url = "#{base_uri}#{Cloopen.account_sid}/SMS/TemplateSMS?sig=#{sig_parameter}"
|
22
22
|
|
23
23
|
payload = {
|
24
|
-
to:
|
24
|
+
to: cellphone,
|
25
25
|
appId: Cloopen.app_id,
|
26
|
-
templateId:
|
27
|
-
datas:
|
26
|
+
templateId: template_id,
|
27
|
+
datas: contents
|
28
28
|
}.to_json
|
29
29
|
|
30
30
|
header = {
|
31
31
|
"Content-type" => "application/json;charset=utf-8",
|
32
32
|
"Accept" => "application/json",
|
33
|
-
"Authorization" =>
|
33
|
+
"Authorization" => authorization
|
34
34
|
}
|
35
35
|
|
36
36
|
res = JSON.parse(RestClient.post sms_url, payload, header)
|
37
37
|
[res["statusCode"], res["statusMsg"]]
|
38
38
|
end
|
39
|
-
|
40
|
-
# 发送短信
|
41
|
-
# Cloopen::SMS.deliver(18668189882, 3127, ["w1n2ty"])
|
42
|
-
# 手机号: 18668189882
|
43
|
-
# 模板 id: 3127
|
44
|
-
# 模板变量替换值: ["w1n2ty"]
|
45
|
-
def self.deliver(cellphone, tmpl_id, contents)
|
46
|
-
sms = new(cellphone, tmpl_id, contents)
|
47
|
-
sms.deliver
|
48
|
-
end
|
49
39
|
end
|
50
40
|
end
|
data/lib/cloopen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloopen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xiaoronglv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|