cloudmersive-convert-api-client 2.1.5 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -4
  3. data/docs/EditDocumentApi.md +165 -0
  4. data/docs/EditHtmlApi.md +418 -0
  5. data/docs/EditPdfApi.md +6 -2
  6. data/docs/GetMacrosResponse.md +9 -0
  7. data/docs/HtmlGetLanguageResult.md +9 -0
  8. data/docs/HtmlGetRelCanonicalUrlResult.md +9 -0
  9. data/docs/HtmlGetSitemapUrlResult.md +9 -0
  10. data/docs/MergeDocumentApi.md +2 -2
  11. data/docs/ValidateDocumentApi.md +55 -0
  12. data/docs/XxeThreatDetectionResult.md +9 -0
  13. data/docs/ZipArchiveApi.md +62 -0
  14. data/lib/cloudmersive-convert-api-client.rb +5 -0
  15. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +165 -0
  16. data/lib/cloudmersive-convert-api-client/api/edit_html_api.rb +392 -0
  17. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +3 -0
  18. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +3 -3
  19. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +55 -0
  20. data/lib/cloudmersive-convert-api-client/api/zip_archive_api.rb +63 -0
  21. data/lib/cloudmersive-convert-api-client/models/get_macros_response.rb +196 -0
  22. data/lib/cloudmersive-convert-api-client/models/html_get_language_result.rb +196 -0
  23. data/lib/cloudmersive-convert-api-client/models/html_get_rel_canonical_url_result.rb +196 -0
  24. data/lib/cloudmersive-convert-api-client/models/html_get_sitemap_url_result.rb +196 -0
  25. data/lib/cloudmersive-convert-api-client/models/xxe_threat_detection_result.rb +196 -0
  26. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  27. data/spec/api/edit_document_api_spec.rb +36 -0
  28. data/spec/api/edit_html_api_spec.rb +95 -0
  29. data/spec/api/edit_pdf_api_spec.rb +1 -0
  30. data/spec/api/merge_document_api_spec.rb +1 -1
  31. data/spec/api/validate_document_api_spec.rb +12 -0
  32. data/spec/api/zip_archive_api_spec.rb +14 -0
  33. data/spec/models/get_macros_response_spec.rb +47 -0
  34. data/spec/models/html_get_language_result_spec.rb +47 -0
  35. data/spec/models/html_get_rel_canonical_url_result_spec.rb +47 -0
  36. data/spec/models/html_get_sitemap_url_result_spec.rb +47 -0
  37. data/spec/models/xxe_threat_detection_result_spec.rb +47 -0
  38. metadata +17 -2
@@ -1119,6 +1119,61 @@ module CloudmersiveConvertApiClient
1119
1119
  end
1120
1120
  return data, status_code, headers
1121
1121
  end
1122
+ # Validate an XML file for XML External Entity (XXE) threats
1123
+ # Validate an XML document file for XML External Entity (XXE) threats; if the document is not valid, identifies the errors in the document. XXE threats are a type of threat that exploits vulnerabilities in the XML standard relating to external or local entity URIs in XML documents.
1124
+ # @param input_file Input file to perform the operation on.
1125
+ # @param [Hash] opts the optional parameters
1126
+ # @return [XxeThreatDetectionResult]
1127
+ def validate_document_xml_xxe_threat_validation(input_file, opts = {})
1128
+ data, _status_code, _headers = validate_document_xml_xxe_threat_validation_with_http_info(input_file, opts)
1129
+ data
1130
+ end
1131
+
1132
+ # Validate an XML file for XML External Entity (XXE) threats
1133
+ # Validate an XML document file for XML External Entity (XXE) threats; if the document is not valid, identifies the errors in the document. XXE threats are a type of threat that exploits vulnerabilities in the XML standard relating to external or local entity URIs in XML documents.
1134
+ # @param input_file Input file to perform the operation on.
1135
+ # @param [Hash] opts the optional parameters
1136
+ # @return [Array<(XxeThreatDetectionResult, Fixnum, Hash)>] XxeThreatDetectionResult data, response status code and response headers
1137
+ def validate_document_xml_xxe_threat_validation_with_http_info(input_file, opts = {})
1138
+ if @api_client.config.debugging
1139
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_xml_xxe_threat_validation ...'
1140
+ end
1141
+ # verify the required parameter 'input_file' is set
1142
+ if @api_client.config.client_side_validation && input_file.nil?
1143
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_xml_xxe_threat_validation"
1144
+ end
1145
+ # resource path
1146
+ local_var_path = '/convert/validate/xml/xxe-threats'
1147
+
1148
+ # query parameters
1149
+ query_params = {}
1150
+
1151
+ # header parameters
1152
+ header_params = {}
1153
+ # HTTP header 'Accept' (if needed)
1154
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
1155
+ # HTTP header 'Content-Type'
1156
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
1157
+
1158
+ # form parameters
1159
+ form_params = {}
1160
+ form_params['inputFile'] = input_file
1161
+
1162
+ # http body (model)
1163
+ post_body = nil
1164
+ auth_names = ['Apikey']
1165
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1166
+ :header_params => header_params,
1167
+ :query_params => query_params,
1168
+ :form_params => form_params,
1169
+ :body => post_body,
1170
+ :auth_names => auth_names,
1171
+ :return_type => 'XxeThreatDetectionResult')
1172
+ if @api_client.config.debugging
1173
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_xml_xxe_threat_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1174
+ end
1175
+ return data, status_code, headers
1176
+ end
1122
1177
  # Validate a Zip Archive file (zip)
1123
1178
  # Validate a Zip archive file (ZIP)
1124
1179
  # @param input_file Input file to perform the operation on.
@@ -247,6 +247,69 @@ module CloudmersiveConvertApiClient
247
247
  end
248
248
  return data, status_code, headers
249
249
  end
250
+ # Create an encrypted zip file to quarantine a dangerous file
251
+ # Create a new zip archive by compressing input files, and also applies encryption and password protection to the zip, for the purposes of quarantining the underlyikng file.
252
+ # @param password Password to place on the Zip file; the longer the password, the more secure
253
+ # @param input_file1 First input file to perform the operation on.
254
+ # @param [Hash] opts the optional parameters
255
+ # @option opts [String] :encryption_algorithm Encryption algorithm to use; possible values are AES-256 (recommended), AES-128, and PK-Zip (not recommended; legacy, weak encryption algorithm). Default is AES-256.
256
+ # @return [Object]
257
+ def zip_archive_zip_create_quarantine(password, input_file1, opts = {})
258
+ data, _status_code, _headers = zip_archive_zip_create_quarantine_with_http_info(password, input_file1, opts)
259
+ data
260
+ end
261
+
262
+ # Create an encrypted zip file to quarantine a dangerous file
263
+ # Create a new zip archive by compressing input files, and also applies encryption and password protection to the zip, for the purposes of quarantining the underlyikng file.
264
+ # @param password Password to place on the Zip file; the longer the password, the more secure
265
+ # @param input_file1 First input file to perform the operation on.
266
+ # @param [Hash] opts the optional parameters
267
+ # @option opts [String] :encryption_algorithm Encryption algorithm to use; possible values are AES-256 (recommended), AES-128, and PK-Zip (not recommended; legacy, weak encryption algorithm). Default is AES-256.
268
+ # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
269
+ def zip_archive_zip_create_quarantine_with_http_info(password, input_file1, opts = {})
270
+ if @api_client.config.debugging
271
+ @api_client.config.logger.debug 'Calling API: ZipArchiveApi.zip_archive_zip_create_quarantine ...'
272
+ end
273
+ # verify the required parameter 'password' is set
274
+ if @api_client.config.client_side_validation && password.nil?
275
+ fail ArgumentError, "Missing the required parameter 'password' when calling ZipArchiveApi.zip_archive_zip_create_quarantine"
276
+ end
277
+ # verify the required parameter 'input_file1' is set
278
+ if @api_client.config.client_side_validation && input_file1.nil?
279
+ fail ArgumentError, "Missing the required parameter 'input_file1' when calling ZipArchiveApi.zip_archive_zip_create_quarantine"
280
+ end
281
+ # resource path
282
+ local_var_path = '/convert/archive/zip/create/quarantine'
283
+
284
+ # query parameters
285
+ query_params = {}
286
+
287
+ # header parameters
288
+ header_params = {}
289
+ # HTTP header 'Accept' (if needed)
290
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
291
+ header_params[:'password'] = password
292
+ header_params[:'encryptionAlgorithm'] = opts[:'encryption_algorithm'] if !opts[:'encryption_algorithm'].nil?
293
+
294
+ # form parameters
295
+ form_params = {}
296
+ form_params['inputFile1'] = input_file1
297
+
298
+ # http body (model)
299
+ post_body = nil
300
+ auth_names = ['Apikey']
301
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
302
+ :header_params => header_params,
303
+ :query_params => query_params,
304
+ :form_params => form_params,
305
+ :body => post_body,
306
+ :auth_names => auth_names,
307
+ :return_type => 'Object')
308
+ if @api_client.config.debugging
309
+ @api_client.config.logger.debug "API called: ZipArchiveApi#zip_archive_zip_create_quarantine\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
310
+ end
311
+ return data, status_code, headers
312
+ end
250
313
  # Decrypt and remove password protection on a zip file
251
314
  # Decrypts and removes password protection from an encrypted zip file with the specified password
252
315
  # @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 running a Get Macro Information command
17
+ class GetMacrosResponse
18
+ # True if successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the document contains VBA macros, false otherwise
22
+ attr_accessor :contains_vba_macros
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'contains_vba_macros' => :'ContainsVbaMacros'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'contains_vba_macros' => :'BOOLEAN'
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?(:'ContainsVbaMacros')
53
+ self.contains_vba_macros = attributes[:'ContainsVbaMacros']
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
+ contains_vba_macros == o.contains_vba_macros
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, contains_vba_macros].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,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 getting the language of the input HTML document
17
+ class HtmlGetLanguageResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # HTML language code of the HTML document, e.g. \"en\" or \"de\"
22
+ attr_accessor :language_code
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'language_code' => :'LanguageCode'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'language_code' => :'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?(:'LanguageCode')
53
+ self.language_code = attributes[:'LanguageCode']
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
+ language_code == o.language_code
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, language_code].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