juhe_ruby 0.1.1 → 0.1.2
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -2
- data/juhe_ruby.gemspec +2 -2
- data/lib/juhe_ruby/id_verify.rb +11 -0
- data/lib/juhe_ruby/version.rb +1 -1
- data/test/idcard/idcard_test.rb +8 -8
- 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: 7c97f0fcf86095385e26132463519ad29ddd8459
|
|
4
|
+
data.tar.gz: 399d60e95d2c6ad1c51b3c05f47ed530ec24fa5e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f243d254abe8e07d3c4937b13092dfcd91c9ca52992b7c730a6a6bd777a9eb5e3a783d18b237993dc5761c5a2ad0b45690deca5593ab9e40893a04787299d20
|
|
7
|
+
data.tar.gz: f5af66765730ded0c071a20eb8c6afd8880a790c10ae6294aa24fcbe2da33cc4cb0a5b9e0e655f505667bf2aecc6b181d9b848bc2ac3454d06ebad7e3593c2f3
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -26,8 +26,8 @@ $ gem install juhe_ruby
|
|
|
26
26
|
## 用法
|
|
27
27
|
先创建文件`config/initializers/juhe_ruby_config.rb`设置各接口的app_key
|
|
28
28
|
```ruby
|
|
29
|
-
Juhe::IdVerify.app_key = "
|
|
30
|
-
Juhe::IdCard.app_key = "
|
|
29
|
+
Juhe::IdVerify.app_key = "d85fa433fb8f30419dc1b3697b035b3d"
|
|
30
|
+
Juhe::IdCard.app_key = "d85fa433fb8f30419dc1b3697b035b3d"
|
|
31
31
|
Juhe::Express.app_key = "d85fa433fb8f30419dc1b3697b035b3d"
|
|
32
32
|
Juhe::Boxoffice.app_key = "d85fa433fd8430419dc1b3697b035b3d"
|
|
33
33
|
```
|
data/juhe_ruby.gemspec
CHANGED
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = JuheRuby::VERSION
|
|
9
9
|
spec.authors = ["linuxnerd"]
|
|
10
10
|
spec.email = ["lwc_evale@hotmail.com"]
|
|
11
|
-
spec.description = %q{"
|
|
12
|
-
spec.summary = %q{"
|
|
11
|
+
spec.description = %q{"聚合数据 api"}
|
|
12
|
+
spec.summary = %q{"聚合数据 api"}
|
|
13
13
|
spec.homepage = "https://github.com/linuxnerd/juhe_ruby"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
data/lib/juhe_ruby/id_verify.rb
CHANGED
|
@@ -13,6 +13,17 @@ module Juhe
|
|
|
13
13
|
"&realname=" + URI::encode(name)
|
|
14
14
|
|
|
15
15
|
result = JSON.parse(open(url).read)
|
|
16
|
+
|
|
17
|
+
# 210301 身份证不存在,210304 身份证不合法
|
|
18
|
+
if(result["error_code"] == 210301 or result["error_code"] == 210304)
|
|
19
|
+
result["error_code"] = 0
|
|
20
|
+
result["result"] = {
|
|
21
|
+
realname: name,
|
|
22
|
+
idcard: cardno,
|
|
23
|
+
res: 2
|
|
24
|
+
}.to_json
|
|
25
|
+
end
|
|
26
|
+
|
|
16
27
|
raise result["reason"] if result["error_code"] != 0
|
|
17
28
|
result["result"]
|
|
18
29
|
end
|
data/lib/juhe_ruby/version.rb
CHANGED
data/test/idcard/idcard_test.rb
CHANGED
|
@@ -14,12 +14,12 @@ class Juhe::IdCardTest < Minitest::Test
|
|
|
14
14
|
assert_equal(Juhe::IdCard.search("310108198701142032")["area"], "上海市闸北区")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
def test_search_with_app_key
|
|
18
|
+
Juhe::IdCard.app_key = ""
|
|
19
|
+
result = Juhe::IdCard.search(
|
|
20
|
+
"310108198701142032",
|
|
21
|
+
app_key: "54be350eb2fdefe5a9a087bf6669cc68"
|
|
22
|
+
)
|
|
23
|
+
assert_equal(result["area"], "上海市闸北区")
|
|
24
|
+
end
|
|
25
25
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: juhe_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- linuxnerd
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-12-
|
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -38,7 +38,7 @@ dependencies:
|
|
|
38
38
|
- - '>='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
-
description: '"
|
|
41
|
+
description: '"聚合数据 api"'
|
|
42
42
|
email:
|
|
43
43
|
- lwc_evale@hotmail.com
|
|
44
44
|
executables: []
|
|
@@ -85,7 +85,7 @@ rubyforge_project:
|
|
|
85
85
|
rubygems_version: 2.0.14.1
|
|
86
86
|
signing_key:
|
|
87
87
|
specification_version: 4
|
|
88
|
-
summary: '"
|
|
88
|
+
summary: '"聚合数据 api"'
|
|
89
89
|
test_files:
|
|
90
90
|
- test/boxoffice/boxoffice_test.rb
|
|
91
91
|
- test/express/express_test.rb
|