cloudmersive-convert-api-client 1.7.6 → 1.7.7

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -4
  3. data/docs/AutodetectToThumbnailsResult.md +9 -0
  4. data/docs/ConvertDocumentApi.md +742 -91
  5. data/docs/DocxToPngResult.md +9 -0
  6. data/docs/EmlAttachment.md +9 -0
  7. data/docs/EmlToHtmlResult.md +18 -0
  8. data/docs/GetFileTypeIconResult.md +10 -0
  9. data/docs/MsgAttachment.md +9 -0
  10. data/docs/MsgToHtmlResult.md +16 -0
  11. data/docs/PptxToPngResult.md +9 -0
  12. data/docs/Thumbnail.md +9 -0
  13. data/docs/ValidateDocumentApi.md +110 -0
  14. data/docs/XlsxToPngResult.md +9 -0
  15. data/lib/cloudmersive-convert-api-client.rb +10 -0
  16. data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +657 -0
  17. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +112 -0
  18. data/lib/cloudmersive-convert-api-client/models/autodetect_to_thumbnails_result.rb +201 -0
  19. data/lib/cloudmersive-convert-api-client/models/docx_to_png_result.rb +201 -0
  20. data/lib/cloudmersive-convert-api-client/models/eml_attachment.rb +215 -0
  21. data/lib/cloudmersive-convert-api-client/models/eml_to_html_result.rb +291 -0
  22. data/lib/cloudmersive-convert-api-client/models/get_file_type_icon_result.rb +225 -0
  23. data/lib/cloudmersive-convert-api-client/models/msg_attachment.rb +215 -0
  24. data/lib/cloudmersive-convert-api-client/models/msg_to_html_result.rb +271 -0
  25. data/lib/cloudmersive-convert-api-client/models/pptx_to_png_result.rb +201 -0
  26. data/lib/cloudmersive-convert-api-client/models/thumbnail.rb +215 -0
  27. data/lib/cloudmersive-convert-api-client/models/xlsx_to_png_result.rb +201 -0
  28. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  29. data/spec/api/convert_document_api_spec.rb +147 -0
  30. data/spec/api/validate_document_api_spec.rb +24 -0
  31. data/spec/models/autodetect_to_thumbnails_result_spec.rb +48 -0
  32. data/spec/models/docx_to_png_result_spec.rb +48 -0
  33. data/spec/models/eml_attachment_spec.rb +48 -0
  34. data/spec/models/eml_to_html_result_spec.rb +102 -0
  35. data/spec/models/get_file_type_icon_result_spec.rb +54 -0
  36. data/spec/models/msg_attachment_spec.rb +48 -0
  37. data/spec/models/msg_to_html_result_spec.rb +90 -0
  38. data/spec/models/pptx_to_png_result_spec.rb +48 -0
  39. data/spec/models/thumbnail_spec.rb +48 -0
  40. data/spec/models/xlsx_to_png_result_spec.rb +48 -0
  41. metadata +32 -2
@@ -188,6 +188,62 @@ module CloudmersiveConvertApiClient
188
188
  return data, status_code, headers
189
189
  end
190
190
 
191
+ # Validate if an EML file is executable
192
+ # Validate if an input file is an EML email file; if the document is not valid
193
+ # @param input_file Input file to perform the operation on.
194
+ # @param [Hash] opts the optional parameters
195
+ # @return [DocumentValidationResult]
196
+ def validate_document_eml_validation(input_file, opts = {})
197
+ data, _status_code, _headers = validate_document_eml_validation_with_http_info(input_file, opts)
198
+ return data
199
+ end
200
+
201
+ # Validate if an EML file is executable
202
+ # Validate if an input file is an EML email file; if the document is not valid
203
+ # @param input_file Input file to perform the operation on.
204
+ # @param [Hash] opts the optional parameters
205
+ # @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
206
+ def validate_document_eml_validation_with_http_info(input_file, opts = {})
207
+ if @api_client.config.debugging
208
+ @api_client.config.logger.debug "Calling API: ValidateDocumentApi.validate_document_eml_validation ..."
209
+ end
210
+ # verify the required parameter 'input_file' is set
211
+ if @api_client.config.client_side_validation && input_file.nil?
212
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_eml_validation"
213
+ end
214
+ # resource path
215
+ local_var_path = "/convert/validate/eml"
216
+
217
+ # query parameters
218
+ query_params = {}
219
+
220
+ # header parameters
221
+ header_params = {}
222
+ # HTTP header 'Accept' (if needed)
223
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
224
+ # HTTP header 'Content-Type'
225
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
226
+
227
+ # form parameters
228
+ form_params = {}
229
+ form_params["inputFile"] = input_file
230
+
231
+ # http body (model)
232
+ post_body = nil
233
+ auth_names = ['Apikey']
234
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
235
+ :header_params => header_params,
236
+ :query_params => query_params,
237
+ :form_params => form_params,
238
+ :body => post_body,
239
+ :auth_names => auth_names,
240
+ :return_type => 'DocumentValidationResult')
241
+ if @api_client.config.debugging
242
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_eml_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
243
+ end
244
+ return data, status_code, headers
245
+ end
246
+
191
247
  # Validate if a file is executable
192
248
  # Validate if an input file is a binary executable file; if the document is not valid
193
249
  # @param input_file Input file to perform the operation on.
@@ -356,6 +412,62 @@ module CloudmersiveConvertApiClient
356
412
  return data, status_code, headers
357
413
  end
358
414
 
415
+ # Validate if an MSG file is executable
416
+ # Validate if an input file is an MSG email file; if the document is not valid
417
+ # @param input_file Input file to perform the operation on.
418
+ # @param [Hash] opts the optional parameters
419
+ # @return [DocumentValidationResult]
420
+ def validate_document_msg_validation(input_file, opts = {})
421
+ data, _status_code, _headers = validate_document_msg_validation_with_http_info(input_file, opts)
422
+ return data
423
+ end
424
+
425
+ # Validate if an MSG file is executable
426
+ # Validate if an input file is an MSG email file; if the document is not valid
427
+ # @param input_file Input file to perform the operation on.
428
+ # @param [Hash] opts the optional parameters
429
+ # @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
430
+ def validate_document_msg_validation_with_http_info(input_file, opts = {})
431
+ if @api_client.config.debugging
432
+ @api_client.config.logger.debug "Calling API: ValidateDocumentApi.validate_document_msg_validation ..."
433
+ end
434
+ # verify the required parameter 'input_file' is set
435
+ if @api_client.config.client_side_validation && input_file.nil?
436
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_msg_validation"
437
+ end
438
+ # resource path
439
+ local_var_path = "/convert/validate/msg"
440
+
441
+ # query parameters
442
+ query_params = {}
443
+
444
+ # header parameters
445
+ header_params = {}
446
+ # HTTP header 'Accept' (if needed)
447
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
448
+ # HTTP header 'Content-Type'
449
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
450
+
451
+ # form parameters
452
+ form_params = {}
453
+ form_params["inputFile"] = input_file
454
+
455
+ # http body (model)
456
+ post_body = nil
457
+ auth_names = ['Apikey']
458
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
459
+ :header_params => header_params,
460
+ :query_params => query_params,
461
+ :form_params => form_params,
462
+ :body => post_body,
463
+ :auth_names => auth_names,
464
+ :return_type => 'DocumentValidationResult')
465
+ if @api_client.config.debugging
466
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_msg_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
467
+ end
468
+ return data, status_code, headers
469
+ end
470
+
359
471
  # Validate a PDF document file
360
472
  # Validate a PDF document; if the document is not valid, identifies the errors in the document. Also checks if the PDF is password protected.
361
473
  # @param input_file Input file to perform the operation on.
@@ -0,0 +1,201 @@
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
+ # Result of converting an entire document to an array of PNG thumbnails
17
+ class AutodetectToThumbnailsResult
18
+ # Index of this thumbnail
19
+ attr_accessor :successful
20
+
21
+ # A PNG thumbnail of the document page
22
+ attr_accessor :thumbnail_pages
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'successful' => :'Successful',
29
+ :'thumbnail_pages' => :'ThumbnailPages'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'successful' => :'BOOLEAN',
37
+ :'thumbnail_pages' => :'Array<Thumbnail>'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'Successful')
50
+ self.successful = attributes[:'Successful']
51
+ end
52
+
53
+ if attributes.has_key?(:'ThumbnailPages')
54
+ if (value = attributes[:'ThumbnailPages']).is_a?(Array)
55
+ self.thumbnail_pages = value
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ return invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return true
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ successful == o.successful &&
80
+ thumbnail_pages == o.thumbnail_pages
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Fixnum] Hash code
91
+ def hash
92
+ [successful, thumbnail_pages].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.swagger_types.each_pair do |key, type|
101
+ if type =~ /\AArray<(.*)>/i
102
+ # check to ensure the input is an array given that the the attribute
103
+ # is documented as an array but the input is not
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
110
+ end
111
+
112
+ self
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
153
+ temp_model.build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ # Returns the string representation of the object
158
+ # @return [String] String presentation of the object
159
+ def to_s
160
+ to_hash.to_s
161
+ end
162
+
163
+ # to_body is an alias to to_hash (backward compatibility)
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_body
166
+ to_hash
167
+ end
168
+
169
+ # Returns the object in the form of hash
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_hash
172
+ hash = {}
173
+ self.class.attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ next if value.nil?
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ # Outputs non-array value in the form of hash
182
+ # For object, use to_hash. Otherwise, just return the value
183
+ # @param [Object] value Any valid value
184
+ # @return [Hash] Returns the value in the form of hash
185
+ def _to_hash(value)
186
+ if value.is_a?(Array)
187
+ value.compact.map{ |v| _to_hash(v) }
188
+ elsif value.is_a?(Hash)
189
+ {}.tap do |hash|
190
+ value.each { |k, v| hash[k] = _to_hash(v) }
191
+ end
192
+ elsif value.respond_to? :to_hash
193
+ value.to_hash
194
+ else
195
+ value
196
+ end
197
+ end
198
+
199
+ end
200
+
201
+ end
@@ -0,0 +1,201 @@
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
+ # Result of converting a DOCX input to a PNG array
17
+ class DocxToPngResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Array of converted pages
22
+ attr_accessor :png_result_pages
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'successful' => :'Successful',
29
+ :'png_result_pages' => :'PngResultPages'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'successful' => :'BOOLEAN',
37
+ :'png_result_pages' => :'Array<ConvertedPngPage>'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'Successful')
50
+ self.successful = attributes[:'Successful']
51
+ end
52
+
53
+ if attributes.has_key?(:'PngResultPages')
54
+ if (value = attributes[:'PngResultPages']).is_a?(Array)
55
+ self.png_result_pages = value
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ return invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return true
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ successful == o.successful &&
80
+ png_result_pages == o.png_result_pages
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Fixnum] Hash code
91
+ def hash
92
+ [successful, png_result_pages].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.swagger_types.each_pair do |key, type|
101
+ if type =~ /\AArray<(.*)>/i
102
+ # check to ensure the input is an array given that the the attribute
103
+ # is documented as an array but the input is not
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
110
+ end
111
+
112
+ self
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
153
+ temp_model.build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ # Returns the string representation of the object
158
+ # @return [String] String presentation of the object
159
+ def to_s
160
+ to_hash.to_s
161
+ end
162
+
163
+ # to_body is an alias to to_hash (backward compatibility)
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_body
166
+ to_hash
167
+ end
168
+
169
+ # Returns the object in the form of hash
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_hash
172
+ hash = {}
173
+ self.class.attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ next if value.nil?
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ # Outputs non-array value in the form of hash
182
+ # For object, use to_hash. Otherwise, just return the value
183
+ # @param [Object] value Any valid value
184
+ # @return [Hash] Returns the value in the form of hash
185
+ def _to_hash(value)
186
+ if value.is_a?(Array)
187
+ value.compact.map{ |v| _to_hash(v) }
188
+ elsif value.is_a?(Hash)
189
+ {}.tap do |hash|
190
+ value.each { |k, v| hash[k] = _to_hash(v) }
191
+ end
192
+ elsif value.respond_to? :to_hash
193
+ value.to_hash
194
+ else
195
+ value
196
+ end
197
+ end
198
+
199
+ end
200
+
201
+ end