cloudmersive-convert-api-client 1.4.9 → 1.5.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.
@@ -20,6 +20,76 @@ module CloudmersiveConvertApiClient
20
20
  @api_client = api_client
21
21
  end
22
22
 
23
+ # Remove / delete pages from a PDF document
24
+ # Remove one or more pages from a PDF document
25
+ # @param input_file Input file to perform the operation on.
26
+ # @param page_start Page number (1 based) to start deleting pages from (inclusive).
27
+ # @param page_end Page number (1 based) to stop deleting pages from (inclusive).
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [String]
30
+ def edit_pdf_delete_pages(input_file, page_start, page_end, opts = {})
31
+ data, _status_code, _headers = edit_pdf_delete_pages_with_http_info(input_file, page_start, page_end, opts)
32
+ return data
33
+ end
34
+
35
+ # Remove / delete pages from a PDF document
36
+ # Remove one or more pages from a PDF document
37
+ # @param input_file Input file to perform the operation on.
38
+ # @param page_start Page number (1 based) to start deleting pages from (inclusive).
39
+ # @param page_end Page number (1 based) to stop deleting pages from (inclusive).
40
+ # @param [Hash] opts the optional parameters
41
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
42
+ def edit_pdf_delete_pages_with_http_info(input_file, page_start, page_end, opts = {})
43
+ if @api_client.config.debugging
44
+ @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_delete_pages ..."
45
+ end
46
+ # verify the required parameter 'input_file' is set
47
+ if @api_client.config.client_side_validation && input_file.nil?
48
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_delete_pages"
49
+ end
50
+ # verify the required parameter 'page_start' is set
51
+ if @api_client.config.client_side_validation && page_start.nil?
52
+ fail ArgumentError, "Missing the required parameter 'page_start' when calling EditPdfApi.edit_pdf_delete_pages"
53
+ end
54
+ # verify the required parameter 'page_end' is set
55
+ if @api_client.config.client_side_validation && page_end.nil?
56
+ fail ArgumentError, "Missing the required parameter 'page_end' when calling EditPdfApi.edit_pdf_delete_pages"
57
+ end
58
+ # resource path
59
+ local_var_path = "/convert/edit/pdf/pages/delete"
60
+
61
+ # query parameters
62
+ query_params = {}
63
+
64
+ # header parameters
65
+ header_params = {}
66
+ # HTTP header 'Accept' (if needed)
67
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
68
+ # HTTP header 'Content-Type'
69
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
70
+ header_params[:'pageStart'] = page_start
71
+ header_params[:'pageEnd'] = page_end
72
+
73
+ # form parameters
74
+ form_params = {}
75
+ form_params["inputFile"] = input_file
76
+
77
+ # http body (model)
78
+ post_body = nil
79
+ auth_names = ['Apikey']
80
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => 'String')
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_delete_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
23
93
  # Encrypt and password-protect a PDF
24
94
  # 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.
25
95
  # @param input_file Input file to perform the operation on.
@@ -194,6 +264,90 @@ module CloudmersiveConvertApiClient
194
264
  return data, status_code, headers
195
265
  end
196
266
 
267
+ # Insert / copy pages from one PDF document into another
268
+ # Copy one or more pages from one PDF document (source document) and insert them into a second PDF document (destination document).
269
+ # @param source_file Source PDF file to copy pages from.
270
+ # @param destination_file Destination PDF file to copy pages into.
271
+ # @param page_start_source Page number (1 based) to start copying pages from (inclusive) in the Source file.
272
+ # @param page_end_source Page number (1 based) to stop copying pages pages from (inclusive) in the Source file.
273
+ # @param page_insert_before_desitnation Page number (1 based) to insert the pages before in the Destination file.
274
+ # @param [Hash] opts the optional parameters
275
+ # @return [String]
276
+ def edit_pdf_insert_pages(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {})
277
+ data, _status_code, _headers = edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts)
278
+ return data
279
+ end
280
+
281
+ # Insert / copy pages from one PDF document into another
282
+ # Copy one or more pages from one PDF document (source document) and insert them into a second PDF document (destination document).
283
+ # @param source_file Source PDF file to copy pages from.
284
+ # @param destination_file Destination PDF file to copy pages into.
285
+ # @param page_start_source Page number (1 based) to start copying pages from (inclusive) in the Source file.
286
+ # @param page_end_source Page number (1 based) to stop copying pages pages from (inclusive) in the Source file.
287
+ # @param page_insert_before_desitnation Page number (1 based) to insert the pages before in the Destination file.
288
+ # @param [Hash] opts the optional parameters
289
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
290
+ def edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {})
291
+ if @api_client.config.debugging
292
+ @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_insert_pages ..."
293
+ end
294
+ # verify the required parameter 'source_file' is set
295
+ if @api_client.config.client_side_validation && source_file.nil?
296
+ fail ArgumentError, "Missing the required parameter 'source_file' when calling EditPdfApi.edit_pdf_insert_pages"
297
+ end
298
+ # verify the required parameter 'destination_file' is set
299
+ if @api_client.config.client_side_validation && destination_file.nil?
300
+ fail ArgumentError, "Missing the required parameter 'destination_file' when calling EditPdfApi.edit_pdf_insert_pages"
301
+ end
302
+ # verify the required parameter 'page_start_source' is set
303
+ if @api_client.config.client_side_validation && page_start_source.nil?
304
+ fail ArgumentError, "Missing the required parameter 'page_start_source' when calling EditPdfApi.edit_pdf_insert_pages"
305
+ end
306
+ # verify the required parameter 'page_end_source' is set
307
+ if @api_client.config.client_side_validation && page_end_source.nil?
308
+ fail ArgumentError, "Missing the required parameter 'page_end_source' when calling EditPdfApi.edit_pdf_insert_pages"
309
+ end
310
+ # verify the required parameter 'page_insert_before_desitnation' is set
311
+ if @api_client.config.client_side_validation && page_insert_before_desitnation.nil?
312
+ fail ArgumentError, "Missing the required parameter 'page_insert_before_desitnation' when calling EditPdfApi.edit_pdf_insert_pages"
313
+ end
314
+ # resource path
315
+ local_var_path = "/convert/edit/pdf/pages/insert"
316
+
317
+ # query parameters
318
+ query_params = {}
319
+
320
+ # header parameters
321
+ header_params = {}
322
+ # HTTP header 'Accept' (if needed)
323
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
324
+ # HTTP header 'Content-Type'
325
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
326
+ header_params[:'pageStartSource'] = page_start_source
327
+ header_params[:'pageEndSource'] = page_end_source
328
+ header_params[:'pageInsertBeforeDesitnation'] = page_insert_before_desitnation
329
+
330
+ # form parameters
331
+ form_params = {}
332
+ form_params["sourceFile"] = source_file
333
+ form_params["destinationFile"] = destination_file
334
+
335
+ # http body (model)
336
+ post_body = nil
337
+ auth_names = ['Apikey']
338
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
339
+ :header_params => header_params,
340
+ :query_params => query_params,
341
+ :form_params => form_params,
342
+ :body => post_body,
343
+ :auth_names => auth_names,
344
+ :return_type => 'String')
345
+ if @api_client.config.debugging
346
+ @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_insert_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
347
+ end
348
+ return data, status_code, headers
349
+ end
350
+
197
351
  # Rasterize a PDF to an image-based PDF
198
352
  # 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.
199
353
  # @param input_file Input file to perform the operation on.
@@ -309,7 +463,7 @@ module CloudmersiveConvertApiClient
309
463
  # Sets (writes) metadata into the input PDF document, including Title, Author, etc.
310
464
  # @param request
311
465
  # @param [Hash] opts the optional parameters
312
- # @return [Object]
466
+ # @return [String]
313
467
  def edit_pdf_set_metadata(request, opts = {})
314
468
  data, _status_code, _headers = edit_pdf_set_metadata_with_http_info(request, opts)
315
469
  return data
@@ -319,7 +473,7 @@ module CloudmersiveConvertApiClient
319
473
  # Sets (writes) metadata into the input PDF document, including Title, Author, etc.
320
474
  # @param request
321
475
  # @param [Hash] opts the optional parameters
322
- # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
476
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
323
477
  def edit_pdf_set_metadata_with_http_info(request, opts = {})
324
478
  if @api_client.config.debugging
325
479
  @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_set_metadata ..."
@@ -353,7 +507,7 @@ module CloudmersiveConvertApiClient
353
507
  :form_params => form_params,
354
508
  :body => post_body,
355
509
  :auth_names => auth_names,
356
- :return_type => 'Object')
510
+ :return_type => 'String')
357
511
  if @api_client.config.debugging
358
512
  @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_set_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
359
513
  end
@@ -0,0 +1,219 @@
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
+ # Details of the HTML to PNG request
17
+ class HtmlToPngRequest
18
+ # HTML to render to PNG (screenshot)
19
+ attr_accessor :html
20
+
21
+ # Optional: Additional number of milliseconds to wait once the web page has finished loading before taking the screenshot. Can be helpful for highly asynchronous websites.
22
+ attr_accessor :extra_loading_wait
23
+
24
+ # Optional: Width of the screenshot in pixels; supply 0 to default to 1280 x 1024, supply -1 to measure the full screen height of the page and attempt to take a screen-height screenshot
25
+ attr_accessor :screenshot_width
26
+
27
+ # Optional: Height of the screenshot in pixels; supply 0 to default to 1280 x 1024, supply -1 to measure the full screen height of the page and attempt to take a screen-height screenshot
28
+ attr_accessor :screenshot_height
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'html' => :'Html',
35
+ :'extra_loading_wait' => :'ExtraLoadingWait',
36
+ :'screenshot_width' => :'ScreenshotWidth',
37
+ :'screenshot_height' => :'ScreenshotHeight'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'html' => :'String',
45
+ :'extra_loading_wait' => :'Integer',
46
+ :'screenshot_width' => :'Integer',
47
+ :'screenshot_height' => :'Integer'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'Html')
60
+ self.html = attributes[:'Html']
61
+ end
62
+
63
+ if attributes.has_key?(:'ExtraLoadingWait')
64
+ self.extra_loading_wait = attributes[:'ExtraLoadingWait']
65
+ end
66
+
67
+ if attributes.has_key?(:'ScreenshotWidth')
68
+ self.screenshot_width = attributes[:'ScreenshotWidth']
69
+ end
70
+
71
+ if attributes.has_key?(:'ScreenshotHeight')
72
+ self.screenshot_height = attributes[:'ScreenshotHeight']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ return invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ html == o.html &&
96
+ extra_loading_wait == o.extra_loading_wait &&
97
+ screenshot_width == o.screenshot_width &&
98
+ screenshot_height == o.screenshot_height
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [html, extra_loading_wait, screenshot_width, screenshot_height].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map{ |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.3.1
11
11
  =end
12
12
 
13
13
  module CloudmersiveConvertApiClient
14
- VERSION = "1.4.9"
14
+ VERSION = "1.5.0"
15
15
  end
@@ -33,7 +33,7 @@ describe 'ConvertDataApi' do
33
33
  end
34
34
 
35
35
  # unit tests for convert_data_csv_to_json
36
- # CSV to JSON conversion
36
+ # Convert CSV to JSON conversion
37
37
  # Convert a CSV file to a JSON object array
38
38
  # @param input_file Input file to perform the operation on.
39
39
  # @param [Hash] opts the optional parameters
@@ -45,7 +45,7 @@ describe 'ConvertDataApi' do
45
45
  end
46
46
 
47
47
  # unit tests for convert_data_xls_to_json
48
- # Excel (97-2003) XLS to JSON conversion
48
+ # Convert Excel (97-2003) XLS to JSON conversion
49
49
  # Convert an Excel (97-2003) XLS file to a JSON object array
50
50
  # @param input_file Input file to perform the operation on.
51
51
  # @param [Hash] opts the optional parameters
@@ -57,7 +57,7 @@ describe 'ConvertDataApi' do
57
57
  end
58
58
 
59
59
  # unit tests for convert_data_xlsx_to_json
60
- # Excel XLSX to JSON conversion
60
+ # Convert Excel XLSX to JSON conversion
61
61
  # Convert an Excel XLSX file to a JSON object array
62
62
  # @param input_file Input file to perform the operation on.
63
63
  # @param [Hash] opts the optional parameters
@@ -69,7 +69,7 @@ describe 'ConvertDataApi' do
69
69
  end
70
70
 
71
71
  # unit tests for convert_data_xml_to_json
72
- # XML to JSON conversion
72
+ # Convert XML to JSON conversion
73
73
  # Convert an XML string or file into JSON
74
74
  # @param input_file Input file to perform the operation on.
75
75
  # @param [Hash] opts the optional parameters