bluestorm_sms 0.0.3 → 0.0.4
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 +36 -3
- data/lib/bluestorm_sms/version.rb +1 -1
- data/lib/bluestorm_sms.rb +2 -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: ae33a8a4d9623911310e66773adaab2ae565c284
|
|
4
|
+
data.tar.gz: 54c0c03ff2e4c24ed10a6dae317937b4cf627e6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5e077fa02305121fd179fa9aa231fa2602d0d2d71793b0dde66e291ca5d7c47bfa8740d289b9cdc77b1efd868ce43473786f37eb85dd4d1abcf3d476b6c27e6
|
|
7
|
+
data.tar.gz: b5483761dd6563528dc69d6a54df7d064c4fcbbebaaecad90c0af649939bca89c6d7eebea39c8d78101793e36a23be094927d1d47fbef88b855d1e1aceb7f32d
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BluestormSms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
短信网关接口
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -15,14 +15,47 @@ And then execute:
|
|
|
15
15
|
Or install it yourself as:
|
|
16
16
|
|
|
17
17
|
$ gem install bluestorm_sms
|
|
18
|
+
|
|
19
|
+
##Configuration
|
|
20
|
+
|
|
21
|
+
####Rails:
|
|
22
|
+
创建文件 `config/initializes/bluestorm_sms.rb` 填入下面的代码,并修改对应的配置:
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
BluestormSMS.configure do |config|
|
|
26
|
+
# 运营商分配给您的SN号(帐号)
|
|
27
|
+
config.sn = 'Your SN'
|
|
28
|
+
# 运营商分配给您的密码
|
|
29
|
+
config.pwd = 'Your Password Here'
|
|
30
|
+
end
|
|
31
|
+
```
|
|
18
32
|
|
|
19
33
|
## Usage
|
|
34
|
+
###发送短信
|
|
35
|
+
```ruby
|
|
36
|
+
BluestormSMS.send(phone, content)
|
|
37
|
+
#BluestormSMS.send(137xxxxxxxx, '您的物品加运费共xxx元,您已经支付成功xxx元。正在为您安排发货,保密包装。【签名】'))
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
返回状态
|
|
41
|
+
```ruby
|
|
42
|
+
{:success=>"221340284130873849"}
|
|
43
|
+
or
|
|
44
|
+
{:error=>"error_code"}
|
|
45
|
+
```
|
|
46
|
+
###接收短信
|
|
47
|
+
```ruby
|
|
48
|
+
BluestormSMS.get messages
|
|
49
|
+
#messages为推送参数,如http://www.url.com/mo.aspx?args=XXX
|
|
50
|
+
messages = BluestormSMS.get params[:args]
|
|
51
|
+
#=>[{:from=>"137xxxxxxxx", :content=>"测试消息", :time=>2014-07-22 13:26:54 +0800}]
|
|
52
|
+
```
|
|
53
|
+
|
|
20
54
|
|
|
21
|
-
TODO: Write usage instructions here
|
|
22
55
|
|
|
23
56
|
## Contributing
|
|
24
57
|
|
|
25
|
-
1. Fork it ( https://github.com/
|
|
58
|
+
1. Fork it ( https://github.com/flypiggy/bluestorm_sms/fork )
|
|
26
59
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
60
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
61
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/bluestorm_sms.rb
CHANGED
|
@@ -36,12 +36,13 @@ module BluestormSMS
|
|
|
36
36
|
|
|
37
37
|
#get sms
|
|
38
38
|
def get messages
|
|
39
|
+
messages = Iconv.conv('utf-8', 'gb2312', messages)
|
|
39
40
|
arr = messages.split(';').collect {|x| x.split(',')}
|
|
40
41
|
results = []
|
|
41
42
|
arr.each do |m|
|
|
42
43
|
message = Hash.new
|
|
43
44
|
message[:from] = m[2]
|
|
44
|
-
message[:content] =
|
|
45
|
+
message[:content] = m[3]
|
|
45
46
|
message[:time] = Time.parse m[4]
|
|
46
47
|
results << message
|
|
47
48
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bluestorm_sms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- gavin.li
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-07-
|
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|