entinfo 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/entinfo.rb +18 -13
- data/lib/entinfo/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9216da1dc5ae1b57158ad464423538401388a634
|
4
|
+
data.tar.gz: b30f56de66abb3877dd6bd99388949689328f4d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7301f18575edd3749a47f1912f473a9a3e5a1dda6ed001f6b47aa4483749c59b5b91b6ec6707f48c5a040384ff56f807e1efb7402edf7cd5db0441b0dd2e4087
|
7
|
+
data.tar.gz: a5dfc6e9f48ea821e72b159d06cd43016d3fb5a3acf79cb3e649eca9b7f7f756236936f3816908f1946cb8739d2bbbb3392a51eb4b636a752873864804fb6c77
|
data/.gitignore
CHANGED
data/lib/entinfo.rb
CHANGED
@@ -26,6 +26,11 @@ module Entinfo
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def send_sms(phone, content)
|
29
|
+
unless /^1\d{10}$/ =~ phone.to_s
|
30
|
+
puts "invalid phone:#{phone}"
|
31
|
+
return {error: 'phone valid'}
|
32
|
+
end
|
33
|
+
|
29
34
|
result = Net::HTTP.post_form(URI.parse("#{URL}"), sn: @config.sn, pwd: self.pwd, mobile: phone, content: content)
|
30
35
|
if result.body.match '^\d{18}$'
|
31
36
|
{success: result.body}
|
@@ -35,17 +40,17 @@ module Entinfo
|
|
35
40
|
end
|
36
41
|
|
37
42
|
#recieve sms
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
def receive_sms messages
|
44
|
+
messages = Iconv.conv('utf-8', 'gb2312', messages)
|
45
|
+
arr = messages.split(';').collect { |x| x.split(',') }
|
46
|
+
results = []
|
47
|
+
arr.each do |m|
|
48
|
+
message = Hash.new
|
49
|
+
message[:from] = m[2]
|
50
|
+
message[:content] = m[3]
|
51
|
+
message[:time] = Time.parse m[4]
|
52
|
+
results << message
|
53
|
+
end
|
54
|
+
results
|
55
|
+
end
|
51
56
|
end
|
data/lib/entinfo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: entinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,8 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.4.
|
84
|
+
rubygems_version: 2.4.3
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
|
-
summary: 漫道短信接口.
|
87
|
+
summary: "漫道短信接口."
|
88
88
|
test_files: []
|