cloopen 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eefc6dd296eab556c0cd7b65552696288b6aa667
4
- data.tar.gz: 02a7761330ff33d1e71df477820573b1ba1cab9b
3
+ metadata.gz: 47ca4b10b13c904f8b63450ded421b2473be1880
4
+ data.tar.gz: c7c00248518bfee98a46006a1484db7adeae337d
5
5
  SHA512:
6
- metadata.gz: 69eaf21ed64992431ae0f4cf3a1f53bd5ca450a2798d3889f33ee2abdb13d52371e8402baa5f14c4d48667fb8b423d7ab799318f46fe362aaa4acea6a1805667
7
- data.tar.gz: f434b42ab33ba9d299df931845edb1868554ea5b114d0f231856f6496a69d01cf640549f2ca5d5a0a6e1c16a688e12540a87410b95d41b1caaf9075596cf2f53
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
- class SMS
7
- def initialize(cellphone, tmpl_id, contents)
8
- @cellphone = cellphone
9
- @template_id = tmpl_id
10
- @contents = contents
11
- @sig_parameter, @authorization = Sign.generate_sig_and_auth
12
- end
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=#{@sig_parameter}"
21
+ sms_url = "#{base_uri}#{Cloopen.account_sid}/SMS/TemplateSMS?sig=#{sig_parameter}"
22
22
 
23
23
  payload = {
24
- to: @cellphone,
24
+ to: cellphone,
25
25
  appId: Cloopen.app_id,
26
- templateId: @template_id,
27
- datas: @contents
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" => @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
@@ -1,3 +1,3 @@
1
1
  module Cloopen
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-21 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler