cloudmersive-convert-api-client 2.2.6 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -8
  3. data/docs/CompareDocumentApi.md +6 -2
  4. data/docs/ConvertDataApi.md +60 -5
  5. data/docs/ConvertDocumentApi.md +358 -10
  6. data/docs/ConvertDocumentBatchJobCreateResult.md +9 -0
  7. data/docs/ConvertDocumentJobStatusResult.md +12 -0
  8. data/docs/ConvertImageApi.md +6 -2
  9. data/docs/ConvertWebApi.md +8 -8
  10. data/docs/ConvertedPngDirectPage.md +9 -0
  11. data/docs/DocumentArrayInput.md +8 -0
  12. data/docs/DocumentItem.md +9 -0
  13. data/docs/EditDocumentApi.md +124 -2
  14. data/docs/EditPdfApi.md +244 -2
  15. data/docs/EditPdfBatchJobCreateResult.md +9 -0
  16. data/docs/EditPdfJobStatusResult.md +12 -0
  17. data/docs/JobStatusResult.md +12 -0
  18. data/docs/MergeBatchJobCreateResult.md +9 -0
  19. data/docs/MergeDocumentApi.md +440 -0
  20. data/docs/MergeJobStatusResult.md +12 -0
  21. data/docs/PdfMetadata.md +2 -0
  22. data/docs/PdfToPngDirectResult.md +9 -0
  23. data/docs/PptxPageLayoutInformation.md +11 -0
  24. data/docs/PptxSplitAdvancedRequest.md +9 -0
  25. data/docs/PptxSplitAdvancedResponse.md +9 -0
  26. data/docs/PresentationAdvancedResult.md +9 -0
  27. data/docs/SplitBatchJobCreateResult.md +9 -0
  28. data/docs/SplitDocumentApi.md +169 -0
  29. data/docs/ValidateDocumentApi.md +175 -6
  30. data/lib/cloudmersive-convert-api-client/api/compare_document_api.rb +3 -0
  31. data/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +57 -4
  32. data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +354 -11
  33. data/lib/cloudmersive-convert-api-client/api/convert_image_api.rb +3 -0
  34. data/lib/cloudmersive-convert-api-client/api/convert_web_api.rb +8 -8
  35. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +122 -0
  36. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +263 -0
  37. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +431 -0
  38. data/lib/cloudmersive-convert-api-client/api/split_document_api.rb +165 -0
  39. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +172 -4
  40. data/lib/cloudmersive-convert-api-client/models/convert_document_batch_job_create_result.rb +196 -0
  41. data/lib/cloudmersive-convert-api-client/models/convert_document_job_status_result.rb +241 -0
  42. data/lib/cloudmersive-convert-api-client/models/converted_png_direct_page.rb +211 -0
  43. data/lib/cloudmersive-convert-api-client/models/document_array_input.rb +188 -0
  44. data/lib/cloudmersive-convert-api-client/models/document_item.rb +211 -0
  45. data/lib/cloudmersive-convert-api-client/models/edit_pdf_batch_job_create_result.rb +196 -0
  46. data/lib/cloudmersive-convert-api-client/models/edit_pdf_job_status_result.rb +241 -0
  47. data/lib/cloudmersive-convert-api-client/models/job_status_result.rb +226 -0
  48. data/lib/cloudmersive-convert-api-client/models/merge_batch_job_create_result.rb +196 -0
  49. data/lib/cloudmersive-convert-api-client/models/merge_job_status_result.rb +241 -0
  50. data/lib/cloudmersive-convert-api-client/models/pdf_metadata.rb +24 -4
  51. data/lib/cloudmersive-convert-api-client/models/pdf_to_png_direct_result.rb +198 -0
  52. data/lib/cloudmersive-convert-api-client/models/pptx_page_layout_information.rb +216 -0
  53. data/lib/cloudmersive-convert-api-client/models/pptx_split_advanced_request.rb +211 -0
  54. data/lib/cloudmersive-convert-api-client/models/pptx_split_advanced_response.rb +197 -0
  55. data/lib/cloudmersive-convert-api-client/models/presentation_advanced_result.rb +211 -0
  56. data/lib/cloudmersive-convert-api-client/models/presentation_result.rb +1 -1
  57. data/lib/cloudmersive-convert-api-client/models/split_batch_job_create_result.rb +196 -0
  58. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  59. data/lib/cloudmersive-convert-api-client.rb +16 -0
  60. data/spec/api/compare_document_api_spec.rb +1 -0
  61. data/spec/api/convert_data_api_spec.rb +14 -2
  62. data/spec/api/convert_document_api_spec.rb +80 -3
  63. data/spec/api/convert_image_api_spec.rb +1 -0
  64. data/spec/api/edit_document_api_spec.rb +28 -0
  65. data/spec/api/edit_pdf_api_spec.rb +55 -0
  66. data/spec/api/merge_document_api_spec.rb +96 -0
  67. data/spec/api/split_document_api_spec.rb +37 -0
  68. data/spec/api/validate_document_api_spec.rb +39 -2
  69. data/spec/models/convert_document_batch_job_create_result_spec.rb +47 -0
  70. data/spec/models/convert_document_job_status_result_spec.rb +65 -0
  71. data/spec/models/converted_png_direct_page_spec.rb +47 -0
  72. data/spec/models/document_array_input_spec.rb +41 -0
  73. data/spec/models/document_item_spec.rb +47 -0
  74. data/spec/models/edit_pdf_batch_job_create_result_spec.rb +47 -0
  75. data/spec/models/edit_pdf_job_status_result_spec.rb +65 -0
  76. data/spec/models/job_status_result_spec.rb +65 -0
  77. data/spec/models/merge_batch_job_create_result_spec.rb +47 -0
  78. data/spec/models/merge_job_status_result_spec.rb +65 -0
  79. data/spec/models/pdf_metadata_spec.rb +12 -0
  80. data/spec/models/pdf_to_png_direct_result_spec.rb +47 -0
  81. data/spec/models/pptx_page_layout_information_spec.rb +59 -0
  82. data/spec/models/pptx_split_advanced_request_spec.rb +47 -0
  83. data/spec/models/pptx_split_advanced_response_spec.rb +47 -0
  84. data/spec/models/presentation_advanced_result_spec.rb +47 -0
  85. data/spec/models/split_batch_job_create_result_spec.rb +47 -0
  86. metadata +50 -2
@@ -184,6 +184,64 @@ module CloudmersiveConvertApiClient
184
184
  end
185
185
  return data, status_code, headers
186
186
  end
187
+ # Repair a Word document (DOCX) that contains errors
188
+ # Repair a Word document (DOCX) that contains errors or corruption, if possible.
189
+ # @param input_file Input file to perform the operation on.
190
+ # @param [Hash] opts the optional parameters
191
+ # @option opts [String] :repair_mode Optional; Set to advanced to apply the most advanced repair mode, basic for basic repair mode. Default is advanced.
192
+ # @return [String]
193
+ def validate_document_docx_repair(input_file, opts = {})
194
+ data, _status_code, _headers = validate_document_docx_repair_with_http_info(input_file, opts)
195
+ data
196
+ end
197
+
198
+ # Repair a Word document (DOCX) that contains errors
199
+ # Repair a Word document (DOCX) that contains errors or corruption, if possible.
200
+ # @param input_file Input file to perform the operation on.
201
+ # @param [Hash] opts the optional parameters
202
+ # @option opts [String] :repair_mode Optional; Set to advanced to apply the most advanced repair mode, basic for basic repair mode. Default is advanced.
203
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
204
+ def validate_document_docx_repair_with_http_info(input_file, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_docx_repair ...'
207
+ end
208
+ # verify the required parameter 'input_file' is set
209
+ if @api_client.config.client_side_validation && input_file.nil?
210
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_docx_repair"
211
+ end
212
+ # resource path
213
+ local_var_path = '/convert/validate/docx/repair'
214
+
215
+ # query parameters
216
+ query_params = {}
217
+
218
+ # header parameters
219
+ header_params = {}
220
+ # HTTP header 'Accept' (if needed)
221
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
222
+ # HTTP header 'Content-Type'
223
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
224
+ header_params[:'repairMode'] = opts[:'repair_mode'] if !opts[:'repair_mode'].nil?
225
+
226
+ # form parameters
227
+ form_params = {}
228
+ form_params['inputFile'] = input_file
229
+
230
+ # http body (model)
231
+ post_body = nil
232
+ auth_names = ['Apikey']
233
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
234
+ :header_params => header_params,
235
+ :query_params => query_params,
236
+ :form_params => form_params,
237
+ :body => post_body,
238
+ :auth_names => auth_names,
239
+ :return_type => 'String')
240
+ if @api_client.config.debugging
241
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_docx_repair\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
242
+ end
243
+ return data, status_code, headers
244
+ end
187
245
  # Validate a Word document (DOCX)
188
246
  # Validate a Word document (DOCX); if the document is not valid, identifies the errors in the document
189
247
  # @param input_file Input file to perform the operation on.
@@ -239,7 +297,7 @@ module CloudmersiveConvertApiClient
239
297
  end
240
298
  return data, status_code, headers
241
299
  end
242
- # Validate if an EML file is executable
300
+ # Validate if input file is a valid EML file
243
301
  # Validate if an input file is an EML email file; if the document is not valid
244
302
  # @param input_file Input file to perform the operation on.
245
303
  # @param [Hash] opts the optional parameters
@@ -249,7 +307,7 @@ module CloudmersiveConvertApiClient
249
307
  data
250
308
  end
251
309
 
252
- # Validate if an EML file is executable
310
+ # Validate if input file is a valid EML file
253
311
  # Validate if an input file is an EML email file; if the document is not valid
254
312
  # @param input_file Input file to perform the operation on.
255
313
  # @param [Hash] opts the optional parameters
@@ -679,7 +737,7 @@ module CloudmersiveConvertApiClient
679
737
  end
680
738
  return data, status_code, headers
681
739
  end
682
- # Validate if an MSG file is executable
740
+ # Validate if input file is a valid MSG file
683
741
  # Validate if an input file is an MSG email file; if the document is not valid
684
742
  # @param input_file Input file to perform the operation on.
685
743
  # @param [Hash] opts the optional parameters
@@ -689,7 +747,7 @@ module CloudmersiveConvertApiClient
689
747
  data
690
748
  end
691
749
 
692
- # Validate if an MSG file is executable
750
+ # Validate if input file is a valid MSG file
693
751
  # Validate if an input file is an MSG email file; if the document is not valid
694
752
  # @param input_file Input file to perform the operation on.
695
753
  # @param [Hash] opts the optional parameters
@@ -899,6 +957,61 @@ module CloudmersiveConvertApiClient
899
957
  end
900
958
  return data, status_code, headers
901
959
  end
960
+ # Repair a PowerPoint presentation (PPTX) that contains errors
961
+ # Repair a PowerPoint presentation document (PPTX) that contains errors or corruption, if possible.
962
+ # @param input_file Input file to perform the operation on.
963
+ # @param [Hash] opts the optional parameters
964
+ # @return [String]
965
+ def validate_document_pptx_repair(input_file, opts = {})
966
+ data, _status_code, _headers = validate_document_pptx_repair_with_http_info(input_file, opts)
967
+ data
968
+ end
969
+
970
+ # Repair a PowerPoint presentation (PPTX) that contains errors
971
+ # Repair a PowerPoint presentation document (PPTX) that contains errors or corruption, if possible.
972
+ # @param input_file Input file to perform the operation on.
973
+ # @param [Hash] opts the optional parameters
974
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
975
+ def validate_document_pptx_repair_with_http_info(input_file, opts = {})
976
+ if @api_client.config.debugging
977
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_pptx_repair ...'
978
+ end
979
+ # verify the required parameter 'input_file' is set
980
+ if @api_client.config.client_side_validation && input_file.nil?
981
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_pptx_repair"
982
+ end
983
+ # resource path
984
+ local_var_path = '/convert/validate/pptx/repair'
985
+
986
+ # query parameters
987
+ query_params = {}
988
+
989
+ # header parameters
990
+ header_params = {}
991
+ # HTTP header 'Accept' (if needed)
992
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
993
+ # HTTP header 'Content-Type'
994
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
995
+
996
+ # form parameters
997
+ form_params = {}
998
+ form_params['inputFile'] = input_file
999
+
1000
+ # http body (model)
1001
+ post_body = nil
1002
+ auth_names = ['Apikey']
1003
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1004
+ :header_params => header_params,
1005
+ :query_params => query_params,
1006
+ :form_params => form_params,
1007
+ :body => post_body,
1008
+ :auth_names => auth_names,
1009
+ :return_type => 'String')
1010
+ if @api_client.config.debugging
1011
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_pptx_repair\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1012
+ end
1013
+ return data, status_code, headers
1014
+ end
902
1015
  # Validate a PowerPoint presentation (PPTX)
903
1016
  # Validate a PowerPoint presentation (PPTX); if the document is not valid, identifies the errors in the document
904
1017
  # @param input_file Input file to perform the operation on.
@@ -1229,6 +1342,61 @@ module CloudmersiveConvertApiClient
1229
1342
  end
1230
1343
  return data, status_code, headers
1231
1344
  end
1345
+ # Repair an Excel spreadsheet (XLSX) that contains errors
1346
+ # Repair an Excel spreadsheet document (XLSX) that contains errors or corruption, if possible.
1347
+ # @param input_file Input file to perform the operation on.
1348
+ # @param [Hash] opts the optional parameters
1349
+ # @return [String]
1350
+ def validate_document_xlsx_repair(input_file, opts = {})
1351
+ data, _status_code, _headers = validate_document_xlsx_repair_with_http_info(input_file, opts)
1352
+ data
1353
+ end
1354
+
1355
+ # Repair an Excel spreadsheet (XLSX) that contains errors
1356
+ # Repair an Excel spreadsheet document (XLSX) that contains errors or corruption, if possible.
1357
+ # @param input_file Input file to perform the operation on.
1358
+ # @param [Hash] opts the optional parameters
1359
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
1360
+ def validate_document_xlsx_repair_with_http_info(input_file, opts = {})
1361
+ if @api_client.config.debugging
1362
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_xlsx_repair ...'
1363
+ end
1364
+ # verify the required parameter 'input_file' is set
1365
+ if @api_client.config.client_side_validation && input_file.nil?
1366
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_xlsx_repair"
1367
+ end
1368
+ # resource path
1369
+ local_var_path = '/convert/validate/xlsx/repair'
1370
+
1371
+ # query parameters
1372
+ query_params = {}
1373
+
1374
+ # header parameters
1375
+ header_params = {}
1376
+ # HTTP header 'Accept' (if needed)
1377
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
1378
+ # HTTP header 'Content-Type'
1379
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
1380
+
1381
+ # form parameters
1382
+ form_params = {}
1383
+ form_params['inputFile'] = input_file
1384
+
1385
+ # http body (model)
1386
+ post_body = nil
1387
+ auth_names = ['Apikey']
1388
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1389
+ :header_params => header_params,
1390
+ :query_params => query_params,
1391
+ :form_params => form_params,
1392
+ :body => post_body,
1393
+ :auth_names => auth_names,
1394
+ :return_type => 'String')
1395
+ if @api_client.config.debugging
1396
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_xlsx_repair\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1397
+ end
1398
+ return data, status_code, headers
1399
+ end
1232
1400
  # Validate a Excel document (XLSX)
1233
1401
  # Validate a Excel document (XLSX); if the document is not valid, identifies the errors in the document
1234
1402
  # @param input_file Input file to perform the operation on.
@@ -0,0 +1,196 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Result of performing a convert documentbatch job operation
17
+ class ConvertDocumentBatchJobCreateResult
18
+ # True if successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # When creating a job, an Async Job ID is returned. Use the GetAsyncJobStatus API to check on the status of this job using the AsyncJobID and get the result when it finishes
22
+ attr_accessor :async_job_id
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'async_job_id' => :'AsyncJobID'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'async_job_id' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'Successful')
49
+ self.successful = attributes[:'Successful']
50
+ end
51
+
52
+ if attributes.has_key?(:'AsyncJobID')
53
+ self.async_job_id = attributes[:'AsyncJobID']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ successful == o.successful &&
76
+ async_job_id == o.async_job_id
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [successful, async_job_id].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end
@@ -0,0 +1,241 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Result of performing a batch job operation
17
+ class ConvertDocumentJobStatusResult
18
+ # Tru eif the operation to check the status of the job was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Returns the job status of the Async Job, if applicable. Possible states are STARTED and COMPLETED
22
+ attr_accessor :async_job_status
23
+
24
+ # When the job exceeds 25 pages, an Async Job ID is returned. Use the CheckPdfOcrJobStatus API to check on the status of this job using the AsyncJobID and get the result when it finishes
25
+ attr_accessor :async_job_id
26
+
27
+ # Output file result (if applicable)
28
+ attr_accessor :output_file_result
29
+
30
+ # Error message (if any)
31
+ attr_accessor :error_message
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'successful' => :'Successful',
37
+ :'async_job_status' => :'AsyncJobStatus',
38
+ :'async_job_id' => :'AsyncJobID',
39
+ :'output_file_result' => :'OutputFileResult',
40
+ :'error_message' => :'ErrorMessage'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'successful' => :'BOOLEAN',
48
+ :'async_job_status' => :'String',
49
+ :'async_job_id' => :'String',
50
+ :'output_file_result' => :'String',
51
+ :'error_message' => :'String'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+
63
+ if attributes.has_key?(:'Successful')
64
+ self.successful = attributes[:'Successful']
65
+ end
66
+
67
+ if attributes.has_key?(:'AsyncJobStatus')
68
+ self.async_job_status = attributes[:'AsyncJobStatus']
69
+ end
70
+
71
+ if attributes.has_key?(:'AsyncJobID')
72
+ self.async_job_id = attributes[:'AsyncJobID']
73
+ end
74
+
75
+ if attributes.has_key?(:'OutputFileResult')
76
+ self.output_file_result = attributes[:'OutputFileResult']
77
+ end
78
+
79
+ if attributes.has_key?(:'ErrorMessage')
80
+ self.error_message = attributes[:'ErrorMessage']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if !@output_file_result.nil? && @output_file_result !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
89
+ invalid_properties.push('invalid value for "output_file_result", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if !@output_file_result.nil? && @output_file_result !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] output_file_result Value to be assigned
104
+ def output_file_result=(output_file_result)
105
+ if !output_file_result.nil? && output_file_result !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
106
+ fail ArgumentError, 'invalid value for "output_file_result", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
107
+ end
108
+
109
+ @output_file_result = output_file_result
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ successful == o.successful &&
118
+ async_job_status == o.async_job_status &&
119
+ async_job_id == o.async_job_id &&
120
+ output_file_result == o.output_file_result &&
121
+ error_message == o.error_message
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Fixnum] Hash code
132
+ def hash
133
+ [successful, async_job_status, async_job_id, output_file_result, error_message].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.swagger_types.each_pair do |key, type|
142
+ if type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
146
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
147
+ end
148
+ elsif !attributes[self.class.attribute_map[key]].nil?
149
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
150
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
151
+ end
152
+
153
+ self
154
+ end
155
+
156
+ # Deserializes the data based on type
157
+ # @param string type Data type
158
+ # @param string value Value to be deserialized
159
+ # @return [Object] Deserialized data
160
+ def _deserialize(type, value)
161
+ case type.to_sym
162
+ when :DateTime
163
+ DateTime.parse(value)
164
+ when :Date
165
+ Date.parse(value)
166
+ when :String
167
+ value.to_s
168
+ when :Integer
169
+ value.to_i
170
+ when :Float
171
+ value.to_f
172
+ when :BOOLEAN
173
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
174
+ true
175
+ else
176
+ false
177
+ end
178
+ when :Object
179
+ # generic object (usually a Hash), return directly
180
+ value
181
+ when /\AArray<(?<inner_type>.+)>\z/
182
+ inner_type = Regexp.last_match[:inner_type]
183
+ value.map { |v| _deserialize(inner_type, v) }
184
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
185
+ k_type = Regexp.last_match[:k_type]
186
+ v_type = Regexp.last_match[:v_type]
187
+ {}.tap do |hash|
188
+ value.each do |k, v|
189
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
190
+ end
191
+ end
192
+ else # model
193
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
194
+ temp_model.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ next if value.nil?
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+ end