cloudmersive-convert-api-client 2.1.2 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -4
  3. data/docs/DocxMetadataCustomProperty.md +13 -0
  4. data/docs/DocxSetCustomMetadataPropertiesRequest.md +10 -0
  5. data/docs/EditDocumentApi.md +275 -0
  6. data/docs/EditHtmlApi.md +60 -0
  7. data/docs/GetDocxMetadataPropertiesResponse.md +16 -0
  8. data/docs/GetMacrosResponse.md +9 -0
  9. data/docs/HtmlGetLinksResponse.md +9 -0
  10. data/docs/HtmlHyperlink.md +9 -0
  11. data/docs/HtmlSsrfThreatCheckResult.md +10 -0
  12. data/docs/HtmlThreatLink.md +9 -0
  13. data/docs/MergeDocumentApi.md +134 -0
  14. data/docs/ValidateDocumentApi.md +220 -0
  15. data/docs/XxeThreatDetectionResult.md +9 -0
  16. data/docs/ZipArchiveApi.md +49 -0
  17. data/lib/cloudmersive-convert-api-client.rb +9 -0
  18. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +274 -0
  19. data/lib/cloudmersive-convert-api-client/api/edit_html_api.rb +55 -0
  20. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +148 -0
  21. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +220 -0
  22. data/lib/cloudmersive-convert-api-client/api/zip_archive_api.rb +46 -0
  23. data/lib/cloudmersive-convert-api-client/models/docx_metadata_custom_property.rb +236 -0
  24. data/lib/cloudmersive-convert-api-client/models/docx_set_custom_metadata_properties_request.rb +223 -0
  25. data/lib/cloudmersive-convert-api-client/models/get_docx_metadata_properties_response.rb +268 -0
  26. data/lib/cloudmersive-convert-api-client/models/get_macros_response.rb +196 -0
  27. data/lib/cloudmersive-convert-api-client/models/html_get_links_response.rb +198 -0
  28. data/lib/cloudmersive-convert-api-client/models/html_hyperlink.rb +196 -0
  29. data/lib/cloudmersive-convert-api-client/models/html_ssrf_threat_check_result.rb +208 -0
  30. data/lib/cloudmersive-convert-api-client/models/html_threat_link.rb +196 -0
  31. data/lib/cloudmersive-convert-api-client/models/xxe_threat_detection_result.rb +196 -0
  32. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  33. data/spec/api/edit_document_api_spec.rb +60 -0
  34. data/spec/api/edit_html_api_spec.rb +14 -0
  35. data/spec/api/merge_document_api_spec.rb +34 -0
  36. data/spec/api/validate_document_api_spec.rb +48 -0
  37. data/spec/api/zip_archive_api_spec.rb +11 -0
  38. data/spec/models/docx_metadata_custom_property_spec.rb +71 -0
  39. data/spec/models/docx_set_custom_metadata_properties_request_spec.rb +53 -0
  40. data/spec/models/get_docx_metadata_properties_response_spec.rb +89 -0
  41. data/spec/models/get_macros_response_spec.rb +47 -0
  42. data/spec/models/html_get_links_response_spec.rb +47 -0
  43. data/spec/models/html_hyperlink_spec.rb +47 -0
  44. data/spec/models/html_ssrf_threat_check_result_spec.rb +53 -0
  45. data/spec/models/html_threat_link_spec.rb +47 -0
  46. data/spec/models/xxe_threat_detection_result_spec.rb +47 -0
  47. metadata +29 -2
@@ -0,0 +1,236 @@
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
+ # Name and value pair for a custom-defined DOCX metadata property
17
+ class DocxMetadataCustomProperty
18
+ # Name of the property
19
+ attr_accessor :property_name
20
+
21
+ # Data type of the property; possible values are \"string\", \"integer\", \"double\" or \"date\"
22
+ attr_accessor :property_data_type
23
+
24
+ # If the property is of a string data type, then provides the string value if available
25
+ attr_accessor :string_value
26
+
27
+ # If the property is of a integer data type, then provides the integer value if available
28
+ attr_accessor :integer_value
29
+
30
+ # If the property is of a double floating point data type, then provides the double value if available
31
+ attr_accessor :double_value
32
+
33
+ # If the property is of a date time data type, then provides the date time value if available
34
+ attr_accessor :date_value
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'property_name' => :'PropertyName',
40
+ :'property_data_type' => :'PropertyDataType',
41
+ :'string_value' => :'StringValue',
42
+ :'integer_value' => :'IntegerValue',
43
+ :'double_value' => :'DoubleValue',
44
+ :'date_value' => :'DateValue'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'property_name' => :'String',
52
+ :'property_data_type' => :'String',
53
+ :'string_value' => :'String',
54
+ :'integer_value' => :'Integer',
55
+ :'double_value' => :'Float',
56
+ :'date_value' => :'DateTime'
57
+ }
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
+
68
+ if attributes.has_key?(:'PropertyName')
69
+ self.property_name = attributes[:'PropertyName']
70
+ end
71
+
72
+ if attributes.has_key?(:'PropertyDataType')
73
+ self.property_data_type = attributes[:'PropertyDataType']
74
+ end
75
+
76
+ if attributes.has_key?(:'StringValue')
77
+ self.string_value = attributes[:'StringValue']
78
+ end
79
+
80
+ if attributes.has_key?(:'IntegerValue')
81
+ self.integer_value = attributes[:'IntegerValue']
82
+ end
83
+
84
+ if attributes.has_key?(:'DoubleValue')
85
+ self.double_value = attributes[:'DoubleValue']
86
+ end
87
+
88
+ if attributes.has_key?(:'DateValue')
89
+ self.date_value = attributes[:'DateValue']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ property_name == o.property_name &&
112
+ property_data_type == o.property_data_type &&
113
+ string_value == o.string_value &&
114
+ integer_value == o.integer_value &&
115
+ double_value == o.double_value &&
116
+ date_value == o.date_value
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [property_name, property_data_type, string_value, integer_value, double_value, date_value].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+ end
@@ -0,0 +1,223 @@
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
+ # Request to set Word custom metadata properties
17
+ class DocxSetCustomMetadataPropertiesRequest
18
+ # Optional: Bytes of the input file to operate on
19
+ attr_accessor :input_file_bytes
20
+
21
+ # Optional: URL of a file to operate on as input. This can be a public URL, or you can also use the begin-editing API to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
22
+ attr_accessor :input_file_url
23
+
24
+ # Required: properties to set in the Word Document; provide one or more property definitions to set - be sure to specify the data type and value, together with the property name
25
+ attr_accessor :properties_to_set
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'input_file_bytes' => :'InputFileBytes',
31
+ :'input_file_url' => :'InputFileUrl',
32
+ :'properties_to_set' => :'PropertiesToSet'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'input_file_bytes' => :'String',
40
+ :'input_file_url' => :'String',
41
+ :'properties_to_set' => :'Array<DocxMetadataCustomProperty>'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'InputFileBytes')
54
+ self.input_file_bytes = attributes[:'InputFileBytes']
55
+ end
56
+
57
+ if attributes.has_key?(:'InputFileUrl')
58
+ self.input_file_url = attributes[:'InputFileUrl']
59
+ end
60
+
61
+ if attributes.has_key?(:'PropertiesToSet')
62
+ if (value = attributes[:'PropertiesToSet']).is_a?(Array)
63
+ self.properties_to_set = value
64
+ end
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
73
+ invalid_properties.push('invalid value for "input_file_bytes", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
83
+ true
84
+ end
85
+
86
+ # Custom attribute writer method with validation
87
+ # @param [Object] input_file_bytes Value to be assigned
88
+ def input_file_bytes=(input_file_bytes)
89
+ if !input_file_bytes.nil? && input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
90
+ fail ArgumentError, 'invalid value for "input_file_bytes", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
91
+ end
92
+
93
+ @input_file_bytes = input_file_bytes
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ input_file_bytes == o.input_file_bytes &&
102
+ input_file_url == o.input_file_url &&
103
+ properties_to_set == o.properties_to_set
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [input_file_bytes, input_file_url, properties_to_set].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+ end