cloudmersive-convert-api-client 1.4.8 → 1.4.9
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/README.md +17 -4
- data/docs/EditDocumentApi.md +1 -1
- data/docs/EditPdfApi.md +220 -0
- data/docs/PdfDocument.md +10 -0
- data/docs/PdfFormField.md +11 -0
- data/docs/PdfFormFields.md +9 -0
- data/docs/PdfMetadata.md +15 -0
- data/docs/SetFormFieldValue.md +11 -0
- data/docs/SetPdfFormFieldsRequest.md +9 -0
- data/docs/SetPdfMetadataRequest.md +9 -0
- data/docs/SplitDocumentApi.md +60 -1
- data/docs/SplitPdfResult.md +9 -0
- data/lib/cloudmersive-convert-api-client.rb +8 -0
- data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +1 -1
- data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +222 -0
- data/lib/cloudmersive-convert-api-client/api/split_document_api.rb +60 -1
- data/lib/cloudmersive-convert-api-client/models/pdf_document.rb +225 -0
- data/lib/cloudmersive-convert-api-client/models/pdf_form_field.rb +219 -0
- data/lib/cloudmersive-convert-api-client/models/pdf_form_fields.rb +201 -0
- data/lib/cloudmersive-convert-api-client/models/pdf_metadata.rb +259 -0
- data/lib/cloudmersive-convert-api-client/models/set_form_field_value.rb +219 -0
- data/lib/cloudmersive-convert-api-client/models/set_pdf_form_fields_request.rb +217 -0
- data/lib/cloudmersive-convert-api-client/models/set_pdf_metadata_request.rb +213 -0
- data/lib/cloudmersive-convert-api-client/models/split_pdf_result.rb +201 -0
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/spec/api/edit_pdf_api_spec.rb +48 -0
- data/spec/api/split_document_api_spec.rb +13 -0
- data/spec/models/pdf_document_spec.rb +54 -0
- data/spec/models/pdf_form_field_spec.rb +60 -0
- data/spec/models/pdf_form_fields_spec.rb +48 -0
- data/spec/models/pdf_metadata_spec.rb +84 -0
- data/spec/models/set_form_field_value_spec.rb +60 -0
- data/spec/models/set_pdf_form_fields_request_spec.rb +48 -0
- data/spec/models/set_pdf_metadata_request_spec.rb +48 -0
- data/spec/models/split_pdf_result_spec.rb +48 -0
- metadata +26 -2
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveConvertApiClient::SplitPdfResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**documents** | [**Array<PdfDocument>**](PdfDocument.md) | PDF documents as output | [optional]
|
8
|
+
|
9
|
+
|
@@ -87,11 +87,19 @@ require 'cloudmersive-convert-api-client/models/insert_xlsx_worksheet_request'
|
|
87
87
|
require 'cloudmersive-convert-api-client/models/insert_xlsx_worksheet_response'
|
88
88
|
require 'cloudmersive-convert-api-client/models/multipage_image_format_conversion_result'
|
89
89
|
require 'cloudmersive-convert-api-client/models/page_conversion_result'
|
90
|
+
require 'cloudmersive-convert-api-client/models/pdf_document'
|
91
|
+
require 'cloudmersive-convert-api-client/models/pdf_form_field'
|
92
|
+
require 'cloudmersive-convert-api-client/models/pdf_form_fields'
|
93
|
+
require 'cloudmersive-convert-api-client/models/pdf_metadata'
|
90
94
|
require 'cloudmersive-convert-api-client/models/pdf_to_png_result'
|
91
95
|
require 'cloudmersive-convert-api-client/models/remove_docx_headers_and_footers_request'
|
92
96
|
require 'cloudmersive-convert-api-client/models/remove_docx_headers_and_footers_response'
|
93
97
|
require 'cloudmersive-convert-api-client/models/replace_string_request'
|
94
98
|
require 'cloudmersive-convert-api-client/models/screenshot_request'
|
99
|
+
require 'cloudmersive-convert-api-client/models/set_form_field_value'
|
100
|
+
require 'cloudmersive-convert-api-client/models/set_pdf_form_fields_request'
|
101
|
+
require 'cloudmersive-convert-api-client/models/set_pdf_metadata_request'
|
102
|
+
require 'cloudmersive-convert-api-client/models/split_pdf_result'
|
95
103
|
require 'cloudmersive-convert-api-client/models/split_xlsx_worksheet_result'
|
96
104
|
require 'cloudmersive-convert-api-client/models/text_conversion_result'
|
97
105
|
require 'cloudmersive-convert-api-client/models/viewer_response'
|
@@ -383,7 +383,7 @@ module CloudmersiveConvertApiClient
|
|
383
383
|
# header parameters
|
384
384
|
header_params = {}
|
385
385
|
# HTTP header 'Accept' (if needed)
|
386
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/
|
386
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
387
387
|
# HTTP header 'Content-Type'
|
388
388
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
389
389
|
|
@@ -82,6 +82,118 @@ module CloudmersiveConvertApiClient
|
|
82
82
|
return data, status_code, headers
|
83
83
|
end
|
84
84
|
|
85
|
+
# Gets PDF Form fields and values
|
86
|
+
# Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password.
|
87
|
+
# @param input_file Input file to perform the operation on.
|
88
|
+
# @param [Hash] opts the optional parameters
|
89
|
+
# @return [PdfFormFields]
|
90
|
+
def edit_pdf_get_form_fields(input_file, opts = {})
|
91
|
+
data, _status_code, _headers = edit_pdf_get_form_fields_with_http_info(input_file, opts)
|
92
|
+
return data
|
93
|
+
end
|
94
|
+
|
95
|
+
# Gets PDF Form fields and values
|
96
|
+
# Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password.
|
97
|
+
# @param input_file Input file to perform the operation on.
|
98
|
+
# @param [Hash] opts the optional parameters
|
99
|
+
# @return [Array<(PdfFormFields, Fixnum, Hash)>] PdfFormFields data, response status code and response headers
|
100
|
+
def edit_pdf_get_form_fields_with_http_info(input_file, opts = {})
|
101
|
+
if @api_client.config.debugging
|
102
|
+
@api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_get_form_fields ..."
|
103
|
+
end
|
104
|
+
# verify the required parameter 'input_file' is set
|
105
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
106
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_get_form_fields"
|
107
|
+
end
|
108
|
+
# resource path
|
109
|
+
local_var_path = "/convert/edit/pdf/form/get-fields"
|
110
|
+
|
111
|
+
# query parameters
|
112
|
+
query_params = {}
|
113
|
+
|
114
|
+
# header parameters
|
115
|
+
header_params = {}
|
116
|
+
# HTTP header 'Accept' (if needed)
|
117
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
118
|
+
# HTTP header 'Content-Type'
|
119
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
120
|
+
|
121
|
+
# form parameters
|
122
|
+
form_params = {}
|
123
|
+
form_params["inputFile"] = input_file
|
124
|
+
|
125
|
+
# http body (model)
|
126
|
+
post_body = nil
|
127
|
+
auth_names = ['Apikey']
|
128
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
129
|
+
:header_params => header_params,
|
130
|
+
:query_params => query_params,
|
131
|
+
:form_params => form_params,
|
132
|
+
:body => post_body,
|
133
|
+
:auth_names => auth_names,
|
134
|
+
:return_type => 'PdfFormFields')
|
135
|
+
if @api_client.config.debugging
|
136
|
+
@api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_form_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
137
|
+
end
|
138
|
+
return data, status_code, headers
|
139
|
+
end
|
140
|
+
|
141
|
+
# Get PDF document metadata
|
142
|
+
# Returns the metadata from the PDF document, including Title, Author, etc.
|
143
|
+
# @param input_file Input file to perform the operation on.
|
144
|
+
# @param [Hash] opts the optional parameters
|
145
|
+
# @return [PdfMetadata]
|
146
|
+
def edit_pdf_get_metadata(input_file, opts = {})
|
147
|
+
data, _status_code, _headers = edit_pdf_get_metadata_with_http_info(input_file, opts)
|
148
|
+
return data
|
149
|
+
end
|
150
|
+
|
151
|
+
# Get PDF document metadata
|
152
|
+
# Returns the metadata from the PDF document, including Title, Author, etc.
|
153
|
+
# @param input_file Input file to perform the operation on.
|
154
|
+
# @param [Hash] opts the optional parameters
|
155
|
+
# @return [Array<(PdfMetadata, Fixnum, Hash)>] PdfMetadata data, response status code and response headers
|
156
|
+
def edit_pdf_get_metadata_with_http_info(input_file, opts = {})
|
157
|
+
if @api_client.config.debugging
|
158
|
+
@api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_get_metadata ..."
|
159
|
+
end
|
160
|
+
# verify the required parameter 'input_file' is set
|
161
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
162
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_get_metadata"
|
163
|
+
end
|
164
|
+
# resource path
|
165
|
+
local_var_path = "/convert/edit/pdf/get-metadata"
|
166
|
+
|
167
|
+
# query parameters
|
168
|
+
query_params = {}
|
169
|
+
|
170
|
+
# header parameters
|
171
|
+
header_params = {}
|
172
|
+
# HTTP header 'Accept' (if needed)
|
173
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
174
|
+
# HTTP header 'Content-Type'
|
175
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
176
|
+
|
177
|
+
# form parameters
|
178
|
+
form_params = {}
|
179
|
+
form_params["inputFile"] = input_file
|
180
|
+
|
181
|
+
# http body (model)
|
182
|
+
post_body = nil
|
183
|
+
auth_names = ['Apikey']
|
184
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
185
|
+
:header_params => header_params,
|
186
|
+
:query_params => query_params,
|
187
|
+
:form_params => form_params,
|
188
|
+
:body => post_body,
|
189
|
+
:auth_names => auth_names,
|
190
|
+
:return_type => 'PdfMetadata')
|
191
|
+
if @api_client.config.debugging
|
192
|
+
@api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
193
|
+
end
|
194
|
+
return data, status_code, headers
|
195
|
+
end
|
196
|
+
|
85
197
|
# Rasterize a PDF to an image-based PDF
|
86
198
|
# Rasterize a PDF into an image-based PDF. The output is a PDF where each page is comprised of a high-resolution image, with all text, figures and other components removed.
|
87
199
|
# @param input_file Input file to perform the operation on.
|
@@ -138,6 +250,116 @@ module CloudmersiveConvertApiClient
|
|
138
250
|
return data, status_code, headers
|
139
251
|
end
|
140
252
|
|
253
|
+
# Sets ands fills PDF Form field values
|
254
|
+
# Fill in the form fields in a PDF form with specific values. Use form/get-fields to enumerate the available fields and their data types in an input form.
|
255
|
+
# @param field_values
|
256
|
+
# @param [Hash] opts the optional parameters
|
257
|
+
# @return [String]
|
258
|
+
def edit_pdf_set_form_fields(field_values, opts = {})
|
259
|
+
data, _status_code, _headers = edit_pdf_set_form_fields_with_http_info(field_values, opts)
|
260
|
+
return data
|
261
|
+
end
|
262
|
+
|
263
|
+
# Sets ands fills PDF Form field values
|
264
|
+
# Fill in the form fields in a PDF form with specific values. Use form/get-fields to enumerate the available fields and their data types in an input form.
|
265
|
+
# @param field_values
|
266
|
+
# @param [Hash] opts the optional parameters
|
267
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
268
|
+
def edit_pdf_set_form_fields_with_http_info(field_values, opts = {})
|
269
|
+
if @api_client.config.debugging
|
270
|
+
@api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_set_form_fields ..."
|
271
|
+
end
|
272
|
+
# verify the required parameter 'field_values' is set
|
273
|
+
if @api_client.config.client_side_validation && field_values.nil?
|
274
|
+
fail ArgumentError, "Missing the required parameter 'field_values' when calling EditPdfApi.edit_pdf_set_form_fields"
|
275
|
+
end
|
276
|
+
# resource path
|
277
|
+
local_var_path = "/convert/edit/pdf/form/set-fields"
|
278
|
+
|
279
|
+
# query parameters
|
280
|
+
query_params = {}
|
281
|
+
|
282
|
+
# header parameters
|
283
|
+
header_params = {}
|
284
|
+
# HTTP header 'Accept' (if needed)
|
285
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
286
|
+
# HTTP header 'Content-Type'
|
287
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
288
|
+
|
289
|
+
# form parameters
|
290
|
+
form_params = {}
|
291
|
+
|
292
|
+
# http body (model)
|
293
|
+
post_body = @api_client.object_to_http_body(field_values)
|
294
|
+
auth_names = ['Apikey']
|
295
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
296
|
+
:header_params => header_params,
|
297
|
+
:query_params => query_params,
|
298
|
+
:form_params => form_params,
|
299
|
+
:body => post_body,
|
300
|
+
:auth_names => auth_names,
|
301
|
+
:return_type => 'String')
|
302
|
+
if @api_client.config.debugging
|
303
|
+
@api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_set_form_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
304
|
+
end
|
305
|
+
return data, status_code, headers
|
306
|
+
end
|
307
|
+
|
308
|
+
# Sets PDF document metadata
|
309
|
+
# Sets (writes) metadata into the input PDF document, including Title, Author, etc.
|
310
|
+
# @param request
|
311
|
+
# @param [Hash] opts the optional parameters
|
312
|
+
# @return [Object]
|
313
|
+
def edit_pdf_set_metadata(request, opts = {})
|
314
|
+
data, _status_code, _headers = edit_pdf_set_metadata_with_http_info(request, opts)
|
315
|
+
return data
|
316
|
+
end
|
317
|
+
|
318
|
+
# Sets PDF document metadata
|
319
|
+
# Sets (writes) metadata into the input PDF document, including Title, Author, etc.
|
320
|
+
# @param request
|
321
|
+
# @param [Hash] opts the optional parameters
|
322
|
+
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
323
|
+
def edit_pdf_set_metadata_with_http_info(request, opts = {})
|
324
|
+
if @api_client.config.debugging
|
325
|
+
@api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_set_metadata ..."
|
326
|
+
end
|
327
|
+
# verify the required parameter 'request' is set
|
328
|
+
if @api_client.config.client_side_validation && request.nil?
|
329
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling EditPdfApi.edit_pdf_set_metadata"
|
330
|
+
end
|
331
|
+
# resource path
|
332
|
+
local_var_path = "/convert/edit/pdf/set-metadata"
|
333
|
+
|
334
|
+
# query parameters
|
335
|
+
query_params = {}
|
336
|
+
|
337
|
+
# header parameters
|
338
|
+
header_params = {}
|
339
|
+
# HTTP header 'Accept' (if needed)
|
340
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
341
|
+
# HTTP header 'Content-Type'
|
342
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
343
|
+
|
344
|
+
# form parameters
|
345
|
+
form_params = {}
|
346
|
+
|
347
|
+
# http body (model)
|
348
|
+
post_body = @api_client.object_to_http_body(request)
|
349
|
+
auth_names = ['Apikey']
|
350
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
351
|
+
:header_params => header_params,
|
352
|
+
:query_params => query_params,
|
353
|
+
:form_params => form_params,
|
354
|
+
:body => post_body,
|
355
|
+
:auth_names => auth_names,
|
356
|
+
:return_type => 'Object')
|
357
|
+
if @api_client.config.debugging
|
358
|
+
@api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_set_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
359
|
+
end
|
360
|
+
return data, status_code, headers
|
361
|
+
end
|
362
|
+
|
141
363
|
# Encrypt, password-protect and set restricted permissions on a PDF
|
142
364
|
# Encrypt a PDF document with a password, and set permissions on the PDF. Set an owner password to control owner (editor/creator) permissions [required], and set a user (reader) password to control the viewer of the PDF [optional]. Set the reader password to null to omit the password. Restrict or allow printing, copying content, document assembly, editing (read-only), form filling, modification of annotations, and degraded printing through document Digital Rights Management (DRM).
|
143
365
|
# @param owner_password Password of a owner (creator/editor) of the PDF file (required)
|
@@ -20,6 +20,65 @@ module CloudmersiveConvertApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
+
# Split a PDF file into separate PDF files, one per page
|
24
|
+
# Split an input PDF file into separate pages, comprised of one PDF file per page.
|
25
|
+
# @param input_file Input file to perform the operation on.
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [BOOLEAN] :return_document_contents Set to true to directly return all of the document contents in the DocumentContents field; set to false to return contents as temporary URLs (more efficient for large operations). Default is false.
|
28
|
+
# @return [SplitPdfResult]
|
29
|
+
def split_document_pdf_by_page(input_file, opts = {})
|
30
|
+
data, _status_code, _headers = split_document_pdf_by_page_with_http_info(input_file, opts)
|
31
|
+
return data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Split a PDF file into separate PDF files, one per page
|
35
|
+
# Split an input PDF file into separate pages, comprised of one PDF file per page.
|
36
|
+
# @param input_file Input file to perform the operation on.
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [BOOLEAN] :return_document_contents Set to true to directly return all of the document contents in the DocumentContents field; set to false to return contents as temporary URLs (more efficient for large operations). Default is false.
|
39
|
+
# @return [Array<(SplitPdfResult, Fixnum, Hash)>] SplitPdfResult data, response status code and response headers
|
40
|
+
def split_document_pdf_by_page_with_http_info(input_file, opts = {})
|
41
|
+
if @api_client.config.debugging
|
42
|
+
@api_client.config.logger.debug "Calling API: SplitDocumentApi.split_document_pdf_by_page ..."
|
43
|
+
end
|
44
|
+
# verify the required parameter 'input_file' is set
|
45
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
46
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling SplitDocumentApi.split_document_pdf_by_page"
|
47
|
+
end
|
48
|
+
# resource path
|
49
|
+
local_var_path = "/convert/split/pdf"
|
50
|
+
|
51
|
+
# query parameters
|
52
|
+
query_params = {}
|
53
|
+
|
54
|
+
# header parameters
|
55
|
+
header_params = {}
|
56
|
+
# HTTP header 'Accept' (if needed)
|
57
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
58
|
+
# HTTP header 'Content-Type'
|
59
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
60
|
+
header_params[:'returnDocumentContents'] = opts[:'return_document_contents'] if !opts[:'return_document_contents'].nil?
|
61
|
+
|
62
|
+
# form parameters
|
63
|
+
form_params = {}
|
64
|
+
form_params["inputFile"] = input_file
|
65
|
+
|
66
|
+
# http body (model)
|
67
|
+
post_body = nil
|
68
|
+
auth_names = ['Apikey']
|
69
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => 'SplitPdfResult')
|
76
|
+
if @api_client.config.debugging
|
77
|
+
@api_client.config.logger.debug "API called: SplitDocumentApi#split_document_pdf_by_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
+
end
|
79
|
+
return data, status_code, headers
|
80
|
+
end
|
81
|
+
|
23
82
|
# Split a single Excel XLSX into Separate Worksheets
|
24
83
|
# Split an Excel XLSX Spreadsheet, comprised of multiple Worksheets (or Tabs) into separate Excel XLSX spreadsheet files, with each containing exactly one Worksheet.
|
25
84
|
# @param input_file Input file to perform the operation on.
|
@@ -52,7 +111,7 @@ module CloudmersiveConvertApiClient
|
|
52
111
|
# header parameters
|
53
112
|
header_params = {}
|
54
113
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/
|
114
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
56
115
|
# HTTP header 'Content-Type'
|
57
116
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
58
117
|
|
@@ -0,0 +1,225 @@
|
|
1
|
+
=begin
|
2
|
+
#convertapi
|
3
|
+
|
4
|
+
#Convert API lets you effortlessly convert file formats and types.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveConvertApiClient
|
16
|
+
# A single PDF file corresponding to one page in the original document
|
17
|
+
class PdfDocument
|
18
|
+
# Page number of the converted page, starting with 1 for the first page
|
19
|
+
attr_accessor :page_number
|
20
|
+
|
21
|
+
# URL to the PDF file of this worksheet; file is stored in an in-memory cache and will be deleted
|
22
|
+
attr_accessor :url
|
23
|
+
|
24
|
+
# If returnDocumentContents is set to true, will contain the contents of the document; otherwise will be set to null and the document contents will be available via the URL parameter
|
25
|
+
attr_accessor :document_contents
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'page_number' => :'PageNumber',
|
32
|
+
:'url' => :'URL',
|
33
|
+
:'document_contents' => :'DocumentContents'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'page_number' => :'Integer',
|
41
|
+
:'url' => :'String',
|
42
|
+
:'document_contents' => :'String'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
+
|
54
|
+
if attributes.has_key?(:'PageNumber')
|
55
|
+
self.page_number = attributes[:'PageNumber']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:'URL')
|
59
|
+
self.url = attributes[:'URL']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'DocumentContents')
|
63
|
+
self.document_contents = attributes[:'DocumentContents']
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
if !@document_contents.nil? && @document_contents !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
73
|
+
invalid_properties.push("invalid value for 'document_contents', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
|
74
|
+
end
|
75
|
+
|
76
|
+
return invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
return false if !@document_contents.nil? && @document_contents !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
83
|
+
return true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Custom attribute writer method with validation
|
87
|
+
# @param [Object] document_contents Value to be assigned
|
88
|
+
def document_contents=(document_contents)
|
89
|
+
|
90
|
+
if !document_contents.nil? && document_contents !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
91
|
+
fail ArgumentError, "invalid value for 'document_contents', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
|
92
|
+
end
|
93
|
+
|
94
|
+
@document_contents = document_contents
|
95
|
+
end
|
96
|
+
|
97
|
+
# Checks equality by comparing each attribute.
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def ==(o)
|
100
|
+
return true if self.equal?(o)
|
101
|
+
self.class == o.class &&
|
102
|
+
page_number == o.page_number &&
|
103
|
+
url == o.url &&
|
104
|
+
document_contents == o.document_contents
|
105
|
+
end
|
106
|
+
|
107
|
+
# @see the `==` method
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def eql?(o)
|
110
|
+
self == o
|
111
|
+
end
|
112
|
+
|
113
|
+
# Calculates hash code according to all attributes.
|
114
|
+
# @return [Fixnum] Hash code
|
115
|
+
def hash
|
116
|
+
[page_number, url, document_contents].hash
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.swagger_types.each_pair do |key, type|
|
125
|
+
if type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :DateTime
|
146
|
+
DateTime.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :BOOLEAN
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
177
|
+
temp_model.build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
next if value.nil?
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map{ |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|