junziqian 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/junziqian.rb +2 -0
- data/lib/junziqian/interface/file_link_request.rb +10 -6
- data/lib/junziqian/interface/pres_file_link.rb +8 -14
- data/lib/junziqian/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df38b5d710097dcbe049810630041176a1c9e830
|
4
|
+
data.tar.gz: c9fa379e2acb0ef3e632aae825c6e64a282678e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb2f937c929bbc6446d0cb1c258d339187432845cd39460bc04df87c0a209e69b500fba985a4d460c8281a6b49f78c81d39aa2bb70a59fb06317f561ff07852
|
7
|
+
data.tar.gz: 9ac04c4d86e092a23b6e4651bd9240ee6848589814692a5ad0108929ab5e0e4165949360545d5542d476d278390a96a88af229122e135dd3c7a7c8db4bdbd5ff
|
data/lib/junziqian.rb
CHANGED
@@ -10,6 +10,8 @@ require 'junziqian/interface/ping'
|
|
10
10
|
require 'junziqian/interface/apply_sign_file_request'
|
11
11
|
require 'junziqian/interface/detail_anony_link_request'
|
12
12
|
require 'junziqian/interface/file_link_request'
|
13
|
+
require 'junziqian/interface/pres_file_link'
|
14
|
+
require 'junziqian/interface/sign_status_request'
|
13
15
|
|
14
16
|
module Junziqian
|
15
17
|
# Your code goes here...
|
@@ -2,9 +2,14 @@ module Junziqian
|
|
2
2
|
module Interface
|
3
3
|
class FileLinkRequest < BaseRequest
|
4
4
|
attr_accessor :applyNo
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
attr_accessor :storage_path
|
6
|
+
attr_accessor :file_name
|
7
|
+
|
8
|
+
def initialize options={}
|
9
|
+
self.applyNo = options[:apply_no]
|
10
|
+
self.storage_path = options[:storage_path] || '/tmp'
|
11
|
+
self.file_name = options[:file_name] || "applyNo#{self.applyNo}.pdf"
|
12
|
+
raise 'storage path not exist' unless File.exist?(storage_path)
|
8
13
|
end
|
9
14
|
def version
|
10
15
|
'1.0'
|
@@ -23,8 +28,7 @@ module Junziqian
|
|
23
28
|
end
|
24
29
|
|
25
30
|
def file_path
|
26
|
-
|
27
|
-
ENV['contract_path'] || '/tmp'
|
31
|
+
storage_path
|
28
32
|
end
|
29
33
|
|
30
34
|
|
@@ -33,7 +37,7 @@ module Junziqian
|
|
33
37
|
result = Tool::RequestTool.do_post_by_requestObj(self)
|
34
38
|
if result['success'] == true
|
35
39
|
link = result['link']
|
36
|
-
system(`curl '#{link}' -o #{file_path}
|
40
|
+
system(`curl '#{link}' -o #{file_path}/#{file_name}`)
|
37
41
|
else
|
38
42
|
'error'
|
39
43
|
end
|
@@ -4,7 +4,7 @@ module Junziqian
|
|
4
4
|
attr_accessor :applyNo
|
5
5
|
attr_accessor :signatory
|
6
6
|
|
7
|
-
def initialize options
|
7
|
+
def initialize options={}
|
8
8
|
self.applyNo = options[:apply_no]
|
9
9
|
self.signatory = Junziqian::Model::Signatory.new(options[:signatory]).hash_values
|
10
10
|
end
|
@@ -25,29 +25,23 @@ module Junziqian
|
|
25
25
|
{applyNo: applyNo, signatory: signatory}
|
26
26
|
end
|
27
27
|
|
28
|
-
def file_path
|
29
|
-
Dir.mkdir(ENV['contract_path']) if ENV['contract_path'] && Dir.exist?(ENV['contract_path'])
|
30
|
-
ENV['contract_path'] || '/tmp'
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
28
|
|
35
29
|
def request
|
36
30
|
result = Tool::RequestTool.do_post_by_requestObj(self)
|
37
31
|
if result['success'] == true
|
38
|
-
|
39
|
-
system(`curl '#{link}' -o #{file_path}/applyNo#{self.applyNo}.pdf`)
|
32
|
+
result['link']
|
40
33
|
else
|
41
|
-
|
34
|
+
'request error'
|
42
35
|
end
|
43
36
|
end
|
44
37
|
|
45
38
|
def demo
|
46
39
|
hash = {signatory: {userType: Junziqian::Cfg::Enum::IDCARD['type'],
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
identityType: Junziqian::Cfg::Enum::IDCARD['code'],
|
41
|
+
fullName: '张三',
|
42
|
+
identityCard: '360732198908110099'},
|
43
|
+
apply_no: 'APL882159678413475840'
|
44
|
+
}
|
51
45
|
req = Junziqian::Interface::PresFileLink.new(hash)
|
52
46
|
end
|
53
47
|
end
|
data/lib/junziqian/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: junziqian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 方峦
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|