ihuyi 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/ihuyi.gemspec +25 -0
- data/lib/generators/ihuyi/ihuyi_generator.rb +10 -0
- data/lib/generators/ihuyi/templates/ihuyi.rb +3 -0
- data/lib/ihuyi.rb +8 -0
- data/lib/ihuyi/sms.rb +18 -0
- data/lib/ihuyi/version.rb +3 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e97b84c4d7fd4e6ccbdcba19986fb1215dd8944
|
4
|
+
data.tar.gz: f3c53bbbbe5c471de7c8037f0da2ae2bc424266f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c69f6ba2d38cbd27e77d2f86d4af1a1e9d0059ed4bf4dd5738f742a01ee0ba7064678fa1562439b812dd98ba7b2a65cd48f3c05528ee4c24c9f3924ed222d7a
|
7
|
+
data.tar.gz: 8eb736fd191d13bd6696a3ff985e5fd09d63d7c15d5d157ee6d1064614d1dc77e6f963ae3b369ed4c4e118173cdca033dd9e16d995f3a5e0b8811e7ebc406ca4
|
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
36
|
+
|
37
|
+
.idea/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 debbbbie
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# ihuyi
|
2
|
+
|
3
|
+
互亿无线发送短信的 Gem。
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'ihuyi'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ihuyi
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### 生成配置文件
|
22
|
+
|
23
|
+
1. 执行 `rails g ihuyi` 生成配置文件 `config/initialiers/ihuyi.rb`
|
24
|
+
|
25
|
+
2. 替换 account、password
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# config/initialiers/ihuyi.rb
|
29
|
+
Ihuyi.account = "Your Ihuyi Account"
|
30
|
+
Ihuyi.password = "Your Ihuyi Password(可以明文密码或使用32位MD5加密)"
|
31
|
+
```
|
32
|
+
|
33
|
+
### 发送短信
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Ihuyi::SMS.deliver(15210972202, '您的验证码是:【变量】。请不要把验证码泄露给其他人。')
|
37
|
+
```
|
38
|
+
* 第一个参数是手机号码
|
39
|
+
|
40
|
+
* 第二个是短信内容。
|
41
|
+
|
data/Rakefile
ADDED
data/ihuyi.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ihuyi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ihuyi"
|
8
|
+
spec.version = Ihuyi::VERSION
|
9
|
+
spec.authors = ["debbbbie"]
|
10
|
+
spec.email = ["debbbbie@163.com"]
|
11
|
+
spec.summary = %q{ call ihuyi Api to send short message. }
|
12
|
+
spec.description = %q{ call ihuyi Api to send short message. }
|
13
|
+
spec.homepage = "https://github.com/debbbbie/ihuyi"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_dependency "rest-client"
|
24
|
+
spec.add_dependency "nori"
|
25
|
+
end
|
data/lib/ihuyi.rb
ADDED
data/lib/ihuyi/sms.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
require 'nori'
|
3
|
+
|
4
|
+
module Ihuyi
|
5
|
+
module SMS
|
6
|
+
def self.deliver(cellphone, content)
|
7
|
+
|
8
|
+
base_uri = "http://106.ihuyi.cn/webservice/sms.php"
|
9
|
+
|
10
|
+
sms_url = "#{base_uri}?method=Submit&account=#{Ihuyi.account}&password=#{Ihuyi.password}&mobile=#{cellphone}&content=#{content}"
|
11
|
+
|
12
|
+
|
13
|
+
parser = Nori.new(:parser => :rexml)
|
14
|
+
res = parser.parse(RestClient.get(sms_url))
|
15
|
+
return res['SubmitResult']['code'], res['SubmitResult']['msg']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ihuyi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- debbbbie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rest-client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nori
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: ' call ihuyi Api to send short message. '
|
70
|
+
email:
|
71
|
+
- debbbbie@163.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- ihuyi.gemspec
|
82
|
+
- lib/generators/ihuyi/ihuyi_generator.rb
|
83
|
+
- lib/generators/ihuyi/templates/ihuyi.rb
|
84
|
+
- lib/ihuyi.rb
|
85
|
+
- lib/ihuyi/sms.rb
|
86
|
+
- lib/ihuyi/version.rb
|
87
|
+
homepage: https://github.com/debbbbie/ihuyi
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.5
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: call ihuyi Api to send short message.
|
111
|
+
test_files: []
|