entinfo 0.1.5 → 0.1.6

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: 92e0a09830c2dfe16243ae68ba457930b03aa204
4
- data.tar.gz: ba92057d5d7b3daf856af6692c3e7ad63ec1385b
3
+ metadata.gz: 50cc61516027c08b4c657721880049a1f715c84d
4
+ data.tar.gz: fda83b1478a269d89b8d548eb62a263dd1a3a4af
5
5
  SHA512:
6
- metadata.gz: 227f0e2e3fba1d9fd54ce372ce9cac57b6bc848c3d107c6a96c746cbb6720e3fa4cc08a3dcb946f5a1222cc9321002b16bb4fc0678b612d57352881c35a2a692
7
- data.tar.gz: e440f7de27a449adbff2d9cd27c7f7ba76af491e7384604981ddd0317ba8e99404027666c46382a00a3f67e517bd6f03586545b4f4f123c11ce0f9973b803669
6
+ metadata.gz: b2062cd9325b4392dd1f4bdf0e53aa4e8b7cb256008c42db28896ccca6f262e493c03f006c87ac9237b3388f85f435f9f278792262f16a5330c809f7913d22ef
7
+ data.tar.gz: 78c5a715deb91cf1653346ec22a69439d75cf3163d97d88eaeb289c831ba306fadad06c7774563c39e6c8d9b25e51f0dfa4388f766c31c974859e1532a4aa9bc
data/README.md CHANGED
@@ -18,9 +18,8 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install entinfo
20
20
 
21
- ## Usage
22
21
 
23
- ### Initial config
22
+ ##Configuration
24
23
  `config/initializers/entinfo.rb`
25
24
 
26
25
  ```ruby
@@ -31,13 +30,21 @@ Entinfo.configure do |config|
31
30
  config.pwd = '0-0_0-0'
32
31
  end
33
32
  ```
34
-
33
+ ## Usage
35
34
  ### Send message
36
35
 
37
36
  ```ruby
38
37
  Entinfo.send_sms('15200000000','hello【短信签名】')
38
+ # {:success=>"221340284130873849"}
39
+ # or
40
+ # {:error=>"error_code"}
39
41
  ```
42
+ ### Receive message
40
43
 
44
+ ```ruby
45
+ Entinfo.receive_sms(messages)
46
+ #=>[{:from=>"15200000000", :content=>"test", :time=>2016-01-18 10:41:47 +0800}]
47
+ ```
41
48
  ## Contributing
42
49
 
43
50
  1. Fork it ( https://github.com/[my-github-username]/entinfo/fork )
@@ -1,3 +1,3 @@
1
1
  module Entinfo
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/entinfo.rb CHANGED
@@ -33,5 +33,19 @@ module Entinfo
33
33
  {error: result.body}
34
34
  end
35
35
  end
36
-
36
+
37
+ #recieve sms
38
+ def receive_sms messages
39
+ messages = Iconv.conv('utf-8', 'gb2312', messages)
40
+ arr = messages.split(';').collect {|x| x.split(',')}
41
+ results = []
42
+ arr.each do |m|
43
+ message = Hash.new
44
+ message[:from] = m[2]
45
+ message[:content] = m[3]
46
+ message[:time] = Time.parse m[4]
47
+ results << message
48
+ end
49
+ results
50
+ end
37
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer