Class: Junziqian::Interface::FileLinkRequest
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from BaseRequest
#content_type, #ignores_params
Constructor Details
Returns a new instance of FileLinkRequest.
8
9
10
11
12
13
|
# File 'lib/junziqian/interface/file_link_request.rb', line 8
def initialize options={}
self.applyNo = options[:apply_no]
self.storage_path = options[:storage_path] || '/tmp'
self.file_name = options[:file_name] || "applyNo#{self.applyNo}.pdf"
raise 'storage path not exist' unless File.exist?(storage_path)
end
|
Instance Attribute Details
#applyNo ⇒ Object
Returns the value of attribute applyNo.
4
5
6
|
# File 'lib/junziqian/interface/file_link_request.rb', line 4
def applyNo
@applyNo
end
|
#file_name ⇒ Object
Returns the value of attribute file_name.
6
7
8
|
# File 'lib/junziqian/interface/file_link_request.rb', line 6
def file_name
@file_name
end
|
#storage_path ⇒ Object
Returns the value of attribute storage_path.
5
6
7
|
# File 'lib/junziqian/interface/file_link_request.rb', line 5
def storage_path
@storage_path
end
|
Instance Method Details
#file_path ⇒ Object
30
31
32
|
# File 'lib/junziqian/interface/file_link_request.rb', line 30
def file_path
storage_path
end
|
#ingore_signs ⇒ Object
22
23
24
|
# File 'lib/junziqian/interface/file_link_request.rb', line 22
def ingore_signs
[]
end
|
#method ⇒ Object
18
19
20
|
# File 'lib/junziqian/interface/file_link_request.rb', line 18
def method
'sign.link.file'
end
|
#query_params ⇒ Object
26
27
28
|
# File 'lib/junziqian/interface/file_link_request.rb', line 26
def query_params
{applyNo: applyNo}
end
|
#request ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'lib/junziqian/interface/file_link_request.rb', line 36
def request
result = Tool::RequestTool.do_post_by_requestObj(self)
if result['success'] == true
link = result['link']
system(`curl '#{link}' -o #{file_path}/#{file_name}`)
else
'error'
end
end
|
#version ⇒ Object
14
15
16
|
# File 'lib/junziqian/interface/file_link_request.rb', line 14
def version
'1.0'
end
|