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 +4 -4
- data/README.md +10 -3
- data/lib/entinfo/version.rb +1 -1
- data/lib/entinfo.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50cc61516027c08b4c657721880049a1f715c84d
|
4
|
+
data.tar.gz: fda83b1478a269d89b8d548eb62a263dd1a3a4af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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 )
|
data/lib/entinfo/version.rb
CHANGED
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
|