entinfo 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -7
- data/lib/entinfo/configuration.rb +6 -0
- data/lib/entinfo/version.rb +1 -1
- data/lib/entinfo.rb +33 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92e0a09830c2dfe16243ae68ba457930b03aa204
|
4
|
+
data.tar.gz: ba92057d5d7b3daf856af6692c3e7ad63ec1385b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227f0e2e3fba1d9fd54ce372ce9cac57b6bc848c3d107c6a96c746cbb6720e3fa4cc08a3dcb946f5a1222cc9321002b16bb4fc0678b612d57352881c35a2a692
|
7
|
+
data.tar.gz: e440f7de27a449adbff2d9cd27c7f7ba76af491e7384604981ddd0317ba8e99404027666c46382a00a3f67e517bd6f03586545b4f4f123c11ce0f9973b803669
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Entinfo
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Rails gem for 创世漫道短信api
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,13 +20,23 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
### Initial config
|
24
|
+
`config/initializers/entinfo.rb`
|
26
25
|
|
27
|
-
|
26
|
+
```ruby
|
27
|
+
Entinfo.configure do |config|
|
28
|
+
# 运营商分配给您的SN号(帐号)
|
29
|
+
config.sn = 'SDK-XXX-000-00000'
|
30
|
+
# 运营商分配给您的密码
|
31
|
+
config.pwd = '0-0_0-0'
|
32
|
+
end
|
33
|
+
```
|
28
34
|
|
29
|
-
|
35
|
+
### Send message
|
30
36
|
|
31
|
-
|
37
|
+
```ruby
|
38
|
+
Entinfo.send_sms('15200000000','hello【短信签名】')
|
39
|
+
```
|
32
40
|
|
33
41
|
## Contributing
|
34
42
|
|
data/lib/entinfo/version.rb
CHANGED
data/lib/entinfo.rb
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
require "entinfo/version"
|
2
|
+
require 'entinfo/configuration'
|
3
|
+
require 'net/http'
|
4
|
+
require 'digest'
|
5
|
+
require 'iconv'
|
6
|
+
require 'time'
|
2
7
|
|
3
8
|
module Entinfo
|
4
|
-
|
9
|
+
extend self
|
10
|
+
#config
|
11
|
+
attr_writer :config
|
12
|
+
|
13
|
+
def config
|
14
|
+
@config ||= Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def configure
|
18
|
+
yield(config)
|
19
|
+
end
|
20
|
+
|
21
|
+
#send sms
|
22
|
+
URL = "http://sdk2.entinfo.cn:8061/mdsmssend.ashx"
|
23
|
+
|
24
|
+
def pwd
|
25
|
+
Digest::MD5.hexdigest(@config.sn + @config.pwd).upcase
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_sms(phone, content)
|
29
|
+
result = Net::HTTP.post_form(URI.parse("#{URL}"), sn: @config.sn, pwd: self.pwd, mobile: phone, content: content)
|
30
|
+
if result.body.match '^\d{18}$'
|
31
|
+
{success: result.body}
|
32
|
+
else
|
33
|
+
{error: result.body}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
5
37
|
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.
|
4
|
+
version: 0.1.5
|
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-
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- bin/setup
|
59
59
|
- entinfo.gemspec
|
60
60
|
- lib/entinfo.rb
|
61
|
+
- lib/entinfo/configuration.rb
|
61
62
|
- lib/entinfo/version.rb
|
62
63
|
homepage: https://github.com/mumaoxi/entinfo
|
63
64
|
licenses:
|