cloopen 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -7
- data/lib/cloopen/sms.rb +9 -4
- 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: b020f3bca96b0c1d22a3eba48fc956b6880aa423
|
4
|
+
data.tar.gz: 31b36a36573fda0161ba06132d9023bc9b20e6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5049e432eb9a1530b93cccd3b41d4383e6a9995f64dfbe84a6d2d0139d5fa413817f85d590f2a3881c6fca53810ae8926aec9783bf673c654c53ac55d06e951
|
7
|
+
data.tar.gz: 38c36c3f42d811073803ef7c534574509c7e1b7aa3625eaa4a505f777d5716c4bd7559cbd3ec52046b3c6a70d12b89159b0f6b9d302d30b20b7c7d499ebb3791
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Cloopen
|
2
2
|
|
3
|
-
云通讯发送短信的 Gem
|
3
|
+
云通讯发送短信的 Gem。
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -44,12 +44,11 @@ Or install it yourself as:
|
|
44
44
|
```ruby
|
45
45
|
# config/initialiers/cloopen_setup.rb
|
46
46
|
Cloopen.account_sid = "Your Yuntongxun Account Sid"
|
47
|
-
Cloopen.auth_token
|
48
|
-
Cloopen.app_id
|
49
|
-
Cloopen.env
|
47
|
+
Cloopen.auth_token = "Your Yuntongxun Auth token"
|
48
|
+
Cloopen.app_id = "Your Yuntongxun App id"
|
49
|
+
Cloopen.env = "production" # 如果是测试环境,填写 "development"
|
50
50
|
```
|
51
51
|
|
52
|
-
|
53
52
|
### 发送短信
|
54
53
|
|
55
54
|
```ruby
|
@@ -57,9 +56,9 @@ Cloopen.env = "production" # 如果是测试环境,填写 "development"
|
|
57
56
|
```
|
58
57
|
* 第一个参数是手机号码
|
59
58
|
|
60
|
-
* 第二个是模板id
|
59
|
+
* 第二个是模板id。只能使用已审通过核的模板发短信。
|
61
60
|
|
62
|
-
*
|
61
|
+
* 第三个是模板中的变量的值。用于替换模板中的变量 1 `【薄荷网】您的的验证码是{1}` 。
|
63
62
|
|
64
63
|
## 荣耀归给仨小伙
|
65
64
|
|
data/lib/cloopen/sms.rb
CHANGED
@@ -20,11 +20,16 @@ module Cloopen
|
|
20
20
|
|
21
21
|
sms_url = "#{base_uri}#{Cloopen.account_sid}/SMS/TemplateSMS?sig=#{sig_parameter}"
|
22
22
|
|
23
|
+
|
24
|
+
# 不得不说一个很奇葩的问题,java 的强类型弱爆了!
|
25
|
+
# 所有的参数必须是 string, integer 会报错 500
|
26
|
+
# * 错误的datas: [311233, 112311]
|
27
|
+
# * 正确的datas: ["311233", "112311"]
|
23
28
|
payload = {
|
24
|
-
to: cellphone,
|
25
|
-
appId: Cloopen.app_id,
|
26
|
-
templateId: template_id,
|
27
|
-
datas: contents
|
29
|
+
to: cellphone.to_s,
|
30
|
+
appId: Cloopen.app_id.to_s,
|
31
|
+
templateId: template_id.to_s,
|
32
|
+
datas: contents.map(&:to_s)
|
28
33
|
}.to_json
|
29
34
|
|
30
35
|
header = {
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xiaoronglv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|