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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b228cf8dc07e489a1f468af4bfee6321f13fde21
4
- data.tar.gz: 813ed612fea29551326536f6d5b94e7a3e2ec9bd
3
+ metadata.gz: ae33a8a4d9623911310e66773adaab2ae565c284
4
+ data.tar.gz: 54c0c03ff2e4c24ed10a6dae317937b4cf627e6f
5
5
  SHA512:
6
- metadata.gz: d48af577c6f33c5f3f56584e181a2e3493e478fff66aa64b08e4d589a8a340e93cc3a4cc83b965afa614573549d7111b7beda7f87e7e045b0d1c696448605897
7
- data.tar.gz: 1a85a37abf2ee8d09c04243e9cf780ec1ac22950ee1a305cd68405c69b83f0e504af3092ce67aa28a25776021b4f599f5dfd8785fe37a1881cf2f9f8e883f55f
6
+ metadata.gz: e5e077fa02305121fd179fa9aa231fa2602d0d2d71793b0dde66e291ca5d7c47bfa8740d289b9cdc77b1efd868ce43473786f37eb85dd4d1abcf3d476b6c27e6
7
+ data.tar.gz: b5483761dd6563528dc69d6a54df7d064c4fcbbebaaecad90c0af649939bca89c6d7eebea39c8d78101793e36a23be094927d1d47fbef88b855d1e1aceb7f32d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BluestormSms
2
2
 
3
- TODO: Write a gem description
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/[my-github-username]/bluestorm_sms/fork )
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`)
@@ -1,3 +1,3 @@
1
1
  module BluestormSms
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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] = Iconv.conv('utf-8', 'gb2312', (URI.unescape m[3]) )
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.3
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-22 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler