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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50cc61516027c08b4c657721880049a1f715c84d
4
- data.tar.gz: fda83b1478a269d89b8d548eb62a263dd1a3a4af
3
+ metadata.gz: 9216da1dc5ae1b57158ad464423538401388a634
4
+ data.tar.gz: b30f56de66abb3877dd6bd99388949689328f4d2
5
5
  SHA512:
6
- metadata.gz: b2062cd9325b4392dd1f4bdf0e53aa4e8b7cb256008c42db28896ccca6f262e493c03f006c87ac9237b3388f85f435f9f278792262f16a5330c809f7913d22ef
7
- data.tar.gz: 78c5a715deb91cf1653346ec22a69439d75cf3163d97d88eaeb289c831ba306fadad06c7774563c39e6c8d9b25e51f0dfa4388f766c31c974859e1532a4aa9bc
6
+ metadata.gz: 7301f18575edd3749a47f1912f473a9a3e5a1dda6ed001f6b47aa4483749c59b5b91b6ec6707f48c5a040384ff56f807e1efb7402edf7cd5db0441b0dd2e4087
7
+ data.tar.gz: a5dfc6e9f48ea821e72b159d06cd43016d3fb5a3acf79cb3e649eca9b7f7f756236936f3816908f1946cb8739d2bbbb3392a51eb4b636a752873864804fb6c77
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /.idea/
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
- 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
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
@@ -1,3 +1,3 @@
1
1
  module Entinfo
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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.6
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-01-18 00:00:00.000000000 Z
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.6
84
+ rubygems_version: 2.4.3
85
85
  signing_key:
86
86
  specification_version: 4
87
- summary: 漫道短信接口.
87
+ summary: "漫道短信接口."
88
88
  test_files: []