docraptor 1.1.0 → 2.0.0
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 +5 -13
- data/.gitignore +42 -2
- data/.rspec +2 -0
- data/.swagger-codegen-ignore +32 -0
- data/.swagger-codegen/VERSION +1 -0
- data/.swagger-revision +1 -1
- data/.travis.yml +9 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +5 -1
- data/LICENSE +4 -10
- data/README.md +11 -17
- data/Rakefile +9 -0
- data/docraptor.gemspec +36 -17
- data/docraptor.yaml +129 -20
- data/examples/hosted_async.rb +75 -0
- data/examples/hosted_sync.rb +62 -0
- data/lib/docraptor.rb +13 -1
- data/lib/docraptor/api/doc_api.rb +202 -81
- data/lib/docraptor/api_client.rb +112 -43
- data/lib/docraptor/api_error.rb +19 -5
- data/lib/docraptor/configuration.rb +43 -4
- data/lib/docraptor/models/async_doc.rb +60 -25
- data/lib/docraptor/models/doc.rb +164 -69
- data/lib/docraptor/models/{async_doc_status.rb → doc_status.rb} +66 -36
- data/lib/docraptor/models/prince_options.rb +132 -90
- data/lib/docraptor/version.rb +13 -1
- data/script/fix_gemspec.rb +40 -0
- data/script/post_generate_language +3 -0
- data/script/setup +25 -0
- data/script/swagger +6 -1
- data/script/test +38 -7
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/spec_helper.rb +111 -0
- data/swagger-config.json +11 -3
- data/test/async.rb +11 -2
- data/test/expire_hosted.rb +45 -0
- data/test/hosted_async.rb +29 -0
- data/test/hosted_sync.rb +28 -0
- data/test/sync.rb +10 -2
- data/test/xlsx.rb +10 -2
- metadata +149 -107
@@ -0,0 +1,75 @@
|
|
1
|
+
# As a paid add-on, DocRaptor can provide long-term, publicly-accessible hosting for your documents.
|
2
|
+
# This allows you to provide a URL to your end users, third party tools like Zapier and Salesforce,
|
3
|
+
# or anyone else. We'll host the document on your behalf at a completely unbranded URL for as long
|
4
|
+
# as you want, or within the limits you specify.
|
5
|
+
#
|
6
|
+
# This example demonstrates creating a PDF using common options that DocRaptor will host for you.
|
7
|
+
# By default, hosted documents do not have limits on downloads or hosting time, though you may
|
8
|
+
# pass additional parameters to the document generation call to set your own limits. Learn more
|
9
|
+
# about the specific options in the hosted API documentation.
|
10
|
+
# https://docraptor.com/documentation/api#api_hosted
|
11
|
+
#
|
12
|
+
# The document is created asynchronously, which means DocRaptor will allow it to generate for up to
|
13
|
+
# 10 minutes. This is useful when creating many documents in parallel, or very large documents with
|
14
|
+
# lots of assets.
|
15
|
+
#
|
16
|
+
# DocRaptor supports many options for output customization, the full list is
|
17
|
+
# https://docraptor.com/documentation/api#api_general
|
18
|
+
#
|
19
|
+
# You can run this example with: ruby hosted_async.rb
|
20
|
+
|
21
|
+
require "bundler/setup"
|
22
|
+
Bundler.require
|
23
|
+
require "open-uri"
|
24
|
+
|
25
|
+
DocRaptor.configure do |dr|
|
26
|
+
dr.username = "YOUR_API_KEY_HERE"
|
27
|
+
# dr.debugging = true
|
28
|
+
end
|
29
|
+
|
30
|
+
$docraptor = DocRaptor::DocApi.new
|
31
|
+
|
32
|
+
begin
|
33
|
+
|
34
|
+
# https://docraptor.com/documentation/api#api_general
|
35
|
+
create_response = $docraptor.create_hosted_async_doc(
|
36
|
+
test: true, # test documents are free but watermarked
|
37
|
+
document_content: "<html><body>Hello World</body></html>", # supply content directly
|
38
|
+
# document_url: "http://docraptor.com/examples/invoice.html", # or use a url
|
39
|
+
name: "hosted-ruby-async.pdf", # helps you find a document later
|
40
|
+
document_type: "pdf", # pdf or xls or xlsx
|
41
|
+
# javascript: true, # enable JavaScript processing
|
42
|
+
# prince_options: {
|
43
|
+
# media: "screen", # use screen styles instead of print styles
|
44
|
+
# baseurl: "http://hello.com", # pretend URL when using document_content
|
45
|
+
# },
|
46
|
+
)
|
47
|
+
|
48
|
+
loop do
|
49
|
+
status_response = $docraptor.get_async_doc_status(create_response.status_id)
|
50
|
+
puts "doc status: #{status_response.status}"
|
51
|
+
case status_response.status
|
52
|
+
when "completed"
|
53
|
+
puts "The hosted PDF is now available for public download at #{status_response.download_url}"
|
54
|
+
File.open("/tmp/docraptor-ruby.pdf", "wb") do |file|
|
55
|
+
open(status_response.download_url) do |uri|
|
56
|
+
file.write(uri.read)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
puts "Wrote PDF to /tmp/docraptor-ruby.pdf"
|
60
|
+
break
|
61
|
+
when "failed"
|
62
|
+
puts "FAILED"
|
63
|
+
puts status_response
|
64
|
+
break
|
65
|
+
else
|
66
|
+
sleep 1
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
rescue DocRaptor::ApiError => error
|
71
|
+
puts "#{error.class}: #{error.message}"
|
72
|
+
puts error.code # HTTP response code
|
73
|
+
puts error.response_body # HTTP response body
|
74
|
+
puts error.backtrace[0..3].join("\n")
|
75
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# As a paid add-on, DocRaptor can provide long-term, publicly-accessible hosting for your documents.
|
2
|
+
# This allows you to provide a URL to your end users, third party tools like Zapier and Salesforce,
|
3
|
+
# or anyone else. We'll host the document on your behalf at a completely unbranded URL for as long
|
4
|
+
# as you want, or within the limits you specify.
|
5
|
+
#
|
6
|
+
# This example demonstrates creating a PDF that DocRaptor will host for you using common options.
|
7
|
+
# By default, hosted documents do not have limits on downloads or hosting time, though you may
|
8
|
+
# pass additional parameters to the document generation call to set your own limits. Learn more
|
9
|
+
# about the specific options in the hosted API documentation.
|
10
|
+
# https://docraptor.com/documentation/api#api_hosted
|
11
|
+
#
|
12
|
+
# It is created synchronously, which means DocRaptor will allow it to generate for up to 60 seconds.
|
13
|
+
# Since this document will be hosted by DocRaptor the response from this request will return a JSON
|
14
|
+
# formatted object containing public URL where the document can be downloaded from.
|
15
|
+
#
|
16
|
+
# DocRaptor supports many options for output customization, the full list is
|
17
|
+
# https://docraptor.com/documentation/api#api_general
|
18
|
+
#
|
19
|
+
# You can run this example with: ruby hosted_sync.rb
|
20
|
+
|
21
|
+
require "bundler/setup"
|
22
|
+
Bundler.require
|
23
|
+
require "open-uri"
|
24
|
+
|
25
|
+
DocRaptor.configure do |dr|
|
26
|
+
dr.username = "YOUR_API_KEY_HERE"
|
27
|
+
# dr.debugging = true
|
28
|
+
end
|
29
|
+
|
30
|
+
$docraptor = DocRaptor::DocApi.new
|
31
|
+
|
32
|
+
begin
|
33
|
+
|
34
|
+
# https://docraptor.com/documentation/api#api_general
|
35
|
+
create_response = $docraptor.create_hosted_doc(
|
36
|
+
test: true, # test documents are free but watermarked
|
37
|
+
document_content: "<html><body>Hello World</body></html>", # supply content directly
|
38
|
+
# document_url: "http://docraptor.com/examples/invoice.html", # or use a url
|
39
|
+
name: "docraptor-ruby.pdf", # help you find a document later
|
40
|
+
document_type: "pdf", # pdf or xls or xlsx
|
41
|
+
# javascript: true, # enable JavaScript processing
|
42
|
+
# prince_options: {
|
43
|
+
# media: "screen", # use screen styles instead of print styles
|
44
|
+
# baseurl: "http://hello.com", # pretend URL when using document_content
|
45
|
+
# },
|
46
|
+
)
|
47
|
+
puts "The hosted PDF is now available for public download at #{create_response.download_url}"
|
48
|
+
|
49
|
+
File.open("/tmp/docraptor-ruby.pdf", "wb") do |file|
|
50
|
+
open(create_response.download_url) do |uri|
|
51
|
+
file.write(uri.read)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
puts "Wrote PDF to /tmp/docraptor-ruby.pdf"
|
56
|
+
|
57
|
+
rescue DocRaptor::ApiError => error
|
58
|
+
puts "#{error.class}: #{error.message}"
|
59
|
+
puts error.code # HTTP response code
|
60
|
+
puts error.response_body # HTTP response body
|
61
|
+
puts error.backtrace[0..3].join("\n")
|
62
|
+
end
|
data/lib/docraptor.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.4.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.19
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
1
13
|
# Common files
|
2
14
|
require 'docraptor/api_client'
|
3
15
|
require 'docraptor/api_error'
|
@@ -6,8 +18,8 @@ require 'docraptor/configuration'
|
|
6
18
|
|
7
19
|
# Models
|
8
20
|
require 'docraptor/models/async_doc'
|
9
|
-
require 'docraptor/models/async_doc_status'
|
10
21
|
require 'docraptor/models/doc'
|
22
|
+
require 'docraptor/models/doc_status'
|
11
23
|
require 'docraptor/models/prince_options'
|
12
24
|
|
13
25
|
# APIs
|
@@ -1,4 +1,16 @@
|
|
1
|
-
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.4.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.19
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
2
14
|
|
3
15
|
module DocRaptor
|
4
16
|
class DocApi
|
@@ -7,53 +19,43 @@ module DocRaptor
|
|
7
19
|
def initialize(api_client = ApiClient.default)
|
8
20
|
@api_client = api_client
|
9
21
|
end
|
10
|
-
|
11
|
-
#
|
12
|
-
# Creates a document asynchronously. You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
|
22
|
+
# Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document.
|
13
23
|
# @param doc The document to be created.
|
14
24
|
# @param [Hash] opts the optional parameters
|
15
25
|
# @return [AsyncDoc]
|
16
26
|
def create_async_doc(doc, opts = {})
|
17
|
-
data,
|
18
|
-
|
27
|
+
data, _status_code, _headers = create_async_doc_with_http_info(doc, opts)
|
28
|
+
data
|
19
29
|
end
|
20
30
|
|
21
|
-
#
|
22
|
-
# Creates a document asynchronously. You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
|
31
|
+
# Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document.
|
23
32
|
# @param doc The document to be created.
|
24
33
|
# @param [Hash] opts the optional parameters
|
25
34
|
# @return [Array<(AsyncDoc, Fixnum, Hash)>] AsyncDoc data, response status code and response headers
|
26
35
|
def create_async_doc_with_http_info(doc, opts = {})
|
27
36
|
if @api_client.config.debugging
|
28
|
-
@api_client.config.logger.debug
|
37
|
+
@api_client.config.logger.debug 'Calling API: DocApi.create_async_doc ...'
|
29
38
|
end
|
30
|
-
|
31
39
|
# verify the required parameter 'doc' is set
|
32
|
-
|
33
|
-
|
40
|
+
if @api_client.config.client_side_validation && doc.nil?
|
41
|
+
fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_async_doc"
|
42
|
+
end
|
34
43
|
# resource path
|
35
|
-
local_var_path =
|
44
|
+
local_var_path = '/async_docs'
|
36
45
|
|
37
46
|
# query parameters
|
38
47
|
query_params = {}
|
39
48
|
|
40
49
|
# header parameters
|
41
50
|
header_params = {}
|
42
|
-
|
43
51
|
# HTTP header 'Accept' (if needed)
|
44
|
-
|
45
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
46
|
-
|
47
|
-
# HTTP header 'Content-Type'
|
48
|
-
_header_content_type = []
|
49
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
52
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
50
53
|
|
51
54
|
# form parameters
|
52
55
|
form_params = {}
|
53
56
|
|
54
57
|
# http body (model)
|
55
58
|
post_body = @api_client.object_to_http_body(doc)
|
56
|
-
|
57
59
|
auth_names = ['basicAuth']
|
58
60
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
59
61
|
:header_params => header_params,
|
@@ -67,53 +69,43 @@ module DocRaptor
|
|
67
69
|
end
|
68
70
|
return data, status_code, headers
|
69
71
|
end
|
70
|
-
|
71
|
-
#
|
72
72
|
# Creates a document synchronously.
|
73
73
|
# @param doc The document to be created.
|
74
74
|
# @param [Hash] opts the optional parameters
|
75
75
|
# @return [String]
|
76
76
|
def create_doc(doc, opts = {})
|
77
|
-
data,
|
78
|
-
|
77
|
+
data, _status_code, _headers = create_doc_with_http_info(doc, opts)
|
78
|
+
data
|
79
79
|
end
|
80
80
|
|
81
|
-
#
|
82
81
|
# Creates a document synchronously.
|
83
82
|
# @param doc The document to be created.
|
84
83
|
# @param [Hash] opts the optional parameters
|
85
84
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
86
85
|
def create_doc_with_http_info(doc, opts = {})
|
87
86
|
if @api_client.config.debugging
|
88
|
-
@api_client.config.logger.debug
|
87
|
+
@api_client.config.logger.debug 'Calling API: DocApi.create_doc ...'
|
89
88
|
end
|
90
|
-
|
91
89
|
# verify the required parameter 'doc' is set
|
92
|
-
|
93
|
-
|
90
|
+
if @api_client.config.client_side_validation && doc.nil?
|
91
|
+
fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_doc"
|
92
|
+
end
|
94
93
|
# resource path
|
95
|
-
local_var_path =
|
94
|
+
local_var_path = '/docs'
|
96
95
|
|
97
96
|
# query parameters
|
98
97
|
query_params = {}
|
99
98
|
|
100
99
|
# header parameters
|
101
100
|
header_params = {}
|
102
|
-
|
103
101
|
# HTTP header 'Accept' (if needed)
|
104
|
-
|
105
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
106
|
-
|
107
|
-
# HTTP header 'Content-Type'
|
108
|
-
_header_content_type = []
|
109
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
102
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
110
103
|
|
111
104
|
# form parameters
|
112
105
|
form_params = {}
|
113
106
|
|
114
107
|
# http body (model)
|
115
108
|
post_body = @api_client.object_to_http_body(doc)
|
116
|
-
|
117
109
|
auth_names = ['basicAuth']
|
118
110
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
119
111
|
:header_params => header_params,
|
@@ -127,53 +119,192 @@ module DocRaptor
|
|
127
119
|
end
|
128
120
|
return data, status_code, headers
|
129
121
|
end
|
122
|
+
# Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document.
|
123
|
+
# @param doc The document to be created.
|
124
|
+
# @param [Hash] opts the optional parameters
|
125
|
+
# @return [AsyncDoc]
|
126
|
+
def create_hosted_async_doc(doc, opts = {})
|
127
|
+
data, _status_code, _headers = create_hosted_async_doc_with_http_info(doc, opts)
|
128
|
+
data
|
129
|
+
end
|
130
|
+
|
131
|
+
# Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document.
|
132
|
+
# @param doc The document to be created.
|
133
|
+
# @param [Hash] opts the optional parameters
|
134
|
+
# @return [Array<(AsyncDoc, Fixnum, Hash)>] AsyncDoc data, response status code and response headers
|
135
|
+
def create_hosted_async_doc_with_http_info(doc, opts = {})
|
136
|
+
if @api_client.config.debugging
|
137
|
+
@api_client.config.logger.debug 'Calling API: DocApi.create_hosted_async_doc ...'
|
138
|
+
end
|
139
|
+
# verify the required parameter 'doc' is set
|
140
|
+
if @api_client.config.client_side_validation && doc.nil?
|
141
|
+
fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_hosted_async_doc"
|
142
|
+
end
|
143
|
+
# resource path
|
144
|
+
local_var_path = '/hosted_async_docs'
|
145
|
+
|
146
|
+
# query parameters
|
147
|
+
query_params = {}
|
148
|
+
|
149
|
+
# header parameters
|
150
|
+
header_params = {}
|
151
|
+
# HTTP header 'Accept' (if needed)
|
152
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
153
|
+
|
154
|
+
# form parameters
|
155
|
+
form_params = {}
|
156
|
+
|
157
|
+
# http body (model)
|
158
|
+
post_body = @api_client.object_to_http_body(doc)
|
159
|
+
auth_names = ['basicAuth']
|
160
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
161
|
+
:header_params => header_params,
|
162
|
+
:query_params => query_params,
|
163
|
+
:form_params => form_params,
|
164
|
+
:body => post_body,
|
165
|
+
:auth_names => auth_names,
|
166
|
+
:return_type => 'AsyncDoc')
|
167
|
+
if @api_client.config.debugging
|
168
|
+
@api_client.config.logger.debug "API called: DocApi#create_hosted_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
169
|
+
end
|
170
|
+
return data, status_code, headers
|
171
|
+
end
|
172
|
+
# Creates a hosted document synchronously.
|
173
|
+
# @param doc The document to be created.
|
174
|
+
# @param [Hash] opts the optional parameters
|
175
|
+
# @return [DocStatus]
|
176
|
+
def create_hosted_doc(doc, opts = {})
|
177
|
+
data, _status_code, _headers = create_hosted_doc_with_http_info(doc, opts)
|
178
|
+
data
|
179
|
+
end
|
130
180
|
|
131
|
-
#
|
132
|
-
#
|
133
|
-
# @param
|
181
|
+
# Creates a hosted document synchronously.
|
182
|
+
# @param doc The document to be created.
|
183
|
+
# @param [Hash] opts the optional parameters
|
184
|
+
# @return [Array<(DocStatus, Fixnum, Hash)>] DocStatus data, response status code and response headers
|
185
|
+
def create_hosted_doc_with_http_info(doc, opts = {})
|
186
|
+
if @api_client.config.debugging
|
187
|
+
@api_client.config.logger.debug 'Calling API: DocApi.create_hosted_doc ...'
|
188
|
+
end
|
189
|
+
# verify the required parameter 'doc' is set
|
190
|
+
if @api_client.config.client_side_validation && doc.nil?
|
191
|
+
fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_hosted_doc"
|
192
|
+
end
|
193
|
+
# resource path
|
194
|
+
local_var_path = '/hosted_docs'
|
195
|
+
|
196
|
+
# query parameters
|
197
|
+
query_params = {}
|
198
|
+
|
199
|
+
# header parameters
|
200
|
+
header_params = {}
|
201
|
+
# HTTP header 'Accept' (if needed)
|
202
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
203
|
+
|
204
|
+
# form parameters
|
205
|
+
form_params = {}
|
206
|
+
|
207
|
+
# http body (model)
|
208
|
+
post_body = @api_client.object_to_http_body(doc)
|
209
|
+
auth_names = ['basicAuth']
|
210
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
211
|
+
:header_params => header_params,
|
212
|
+
:query_params => query_params,
|
213
|
+
:form_params => form_params,
|
214
|
+
:body => post_body,
|
215
|
+
:auth_names => auth_names,
|
216
|
+
:return_type => 'DocStatus')
|
217
|
+
if @api_client.config.debugging
|
218
|
+
@api_client.config.logger.debug "API called: DocApi#create_hosted_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
219
|
+
end
|
220
|
+
return data, status_code, headers
|
221
|
+
end
|
222
|
+
# Expires a previously created hosted doc.
|
223
|
+
# @param id The download_id returned from status request or hosted document response.
|
224
|
+
# @param [Hash] opts the optional parameters
|
225
|
+
# @return [nil]
|
226
|
+
def expire(id, opts = {})
|
227
|
+
expire_with_http_info(id, opts)
|
228
|
+
nil
|
229
|
+
end
|
230
|
+
|
231
|
+
# Expires a previously created hosted doc.
|
232
|
+
# @param id The download_id returned from status request or hosted document response.
|
233
|
+
# @param [Hash] opts the optional parameters
|
234
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
235
|
+
def expire_with_http_info(id, opts = {})
|
236
|
+
if @api_client.config.debugging
|
237
|
+
@api_client.config.logger.debug 'Calling API: DocApi.expire ...'
|
238
|
+
end
|
239
|
+
# verify the required parameter 'id' is set
|
240
|
+
if @api_client.config.client_side_validation && id.nil?
|
241
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling DocApi.expire"
|
242
|
+
end
|
243
|
+
# resource path
|
244
|
+
local_var_path = '/expire/{id}'.sub('{' + 'id' + '}', id.to_s)
|
245
|
+
|
246
|
+
# query parameters
|
247
|
+
query_params = {}
|
248
|
+
|
249
|
+
# header parameters
|
250
|
+
header_params = {}
|
251
|
+
# HTTP header 'Accept' (if needed)
|
252
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
253
|
+
|
254
|
+
# form parameters
|
255
|
+
form_params = {}
|
256
|
+
|
257
|
+
# http body (model)
|
258
|
+
post_body = nil
|
259
|
+
auth_names = ['basicAuth']
|
260
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
|
261
|
+
:header_params => header_params,
|
262
|
+
:query_params => query_params,
|
263
|
+
:form_params => form_params,
|
264
|
+
:body => post_body,
|
265
|
+
:auth_names => auth_names)
|
266
|
+
if @api_client.config.debugging
|
267
|
+
@api_client.config.logger.debug "API called: DocApi#expire\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
268
|
+
end
|
269
|
+
return data, status_code, headers
|
270
|
+
end
|
271
|
+
# Downloads a finished document.
|
272
|
+
# @param id The download_id returned from an async status request or callback.
|
134
273
|
# @param [Hash] opts the optional parameters
|
135
274
|
# @return [String]
|
136
275
|
def get_async_doc(id, opts = {})
|
137
|
-
data,
|
138
|
-
|
276
|
+
data, _status_code, _headers = get_async_doc_with_http_info(id, opts)
|
277
|
+
data
|
139
278
|
end
|
140
279
|
|
141
|
-
#
|
142
|
-
#
|
143
|
-
# @param id The download_id returned from status request or a callback.
|
280
|
+
# Downloads a finished document.
|
281
|
+
# @param id The download_id returned from an async status request or callback.
|
144
282
|
# @param [Hash] opts the optional parameters
|
145
283
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
146
284
|
def get_async_doc_with_http_info(id, opts = {})
|
147
285
|
if @api_client.config.debugging
|
148
|
-
@api_client.config.logger.debug
|
286
|
+
@api_client.config.logger.debug 'Calling API: DocApi.get_async_doc ...'
|
149
287
|
end
|
150
|
-
|
151
288
|
# verify the required parameter 'id' is set
|
152
|
-
|
153
|
-
|
289
|
+
if @api_client.config.client_side_validation && id.nil?
|
290
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling DocApi.get_async_doc"
|
291
|
+
end
|
154
292
|
# resource path
|
155
|
-
local_var_path =
|
293
|
+
local_var_path = '/download/{id}'.sub('{' + 'id' + '}', id.to_s)
|
156
294
|
|
157
295
|
# query parameters
|
158
296
|
query_params = {}
|
159
297
|
|
160
298
|
# header parameters
|
161
299
|
header_params = {}
|
162
|
-
|
163
300
|
# HTTP header 'Accept' (if needed)
|
164
|
-
|
165
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
166
|
-
|
167
|
-
# HTTP header 'Content-Type'
|
168
|
-
_header_content_type = []
|
169
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
301
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
170
302
|
|
171
303
|
# form parameters
|
172
304
|
form_params = {}
|
173
305
|
|
174
306
|
# http body (model)
|
175
307
|
post_body = nil
|
176
|
-
|
177
308
|
auth_names = ['basicAuth']
|
178
309
|
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
179
310
|
:header_params => header_params,
|
@@ -187,53 +318,43 @@ module DocRaptor
|
|
187
318
|
end
|
188
319
|
return data, status_code, headers
|
189
320
|
end
|
190
|
-
|
191
|
-
#
|
192
321
|
# Check on the status of an asynchronously created document.
|
193
322
|
# @param id The status_id returned when creating an asynchronous document.
|
194
323
|
# @param [Hash] opts the optional parameters
|
195
|
-
# @return [
|
324
|
+
# @return [DocStatus]
|
196
325
|
def get_async_doc_status(id, opts = {})
|
197
|
-
data,
|
198
|
-
|
326
|
+
data, _status_code, _headers = get_async_doc_status_with_http_info(id, opts)
|
327
|
+
data
|
199
328
|
end
|
200
329
|
|
201
|
-
#
|
202
330
|
# Check on the status of an asynchronously created document.
|
203
331
|
# @param id The status_id returned when creating an asynchronous document.
|
204
332
|
# @param [Hash] opts the optional parameters
|
205
|
-
# @return [Array<(
|
333
|
+
# @return [Array<(DocStatus, Fixnum, Hash)>] DocStatus data, response status code and response headers
|
206
334
|
def get_async_doc_status_with_http_info(id, opts = {})
|
207
335
|
if @api_client.config.debugging
|
208
|
-
@api_client.config.logger.debug
|
336
|
+
@api_client.config.logger.debug 'Calling API: DocApi.get_async_doc_status ...'
|
209
337
|
end
|
210
|
-
|
211
338
|
# verify the required parameter 'id' is set
|
212
|
-
|
213
|
-
|
339
|
+
if @api_client.config.client_side_validation && id.nil?
|
340
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling DocApi.get_async_doc_status"
|
341
|
+
end
|
214
342
|
# resource path
|
215
|
-
local_var_path =
|
343
|
+
local_var_path = '/status/{id}'.sub('{' + 'id' + '}', id.to_s)
|
216
344
|
|
217
345
|
# query parameters
|
218
346
|
query_params = {}
|
219
347
|
|
220
348
|
# header parameters
|
221
349
|
header_params = {}
|
222
|
-
|
223
350
|
# HTTP header 'Accept' (if needed)
|
224
|
-
|
225
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
226
|
-
|
227
|
-
# HTTP header 'Content-Type'
|
228
|
-
_header_content_type = []
|
229
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
351
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])
|
230
352
|
|
231
353
|
# form parameters
|
232
354
|
form_params = {}
|
233
355
|
|
234
356
|
# http body (model)
|
235
357
|
post_body = nil
|
236
|
-
|
237
358
|
auth_names = ['basicAuth']
|
238
359
|
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
239
360
|
:header_params => header_params,
|
@@ -241,7 +362,7 @@ module DocRaptor
|
|
241
362
|
:form_params => form_params,
|
242
363
|
:body => post_body,
|
243
364
|
:auth_names => auth_names,
|
244
|
-
:return_type => '
|
365
|
+
:return_type => 'DocStatus')
|
245
366
|
if @api_client.config.debugging
|
246
367
|
@api_client.config.logger.debug "API called: DocApi#get_async_doc_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
247
368
|
end
|