cloudmersive-convert-api-client 2.1.7 → 2.2.1

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 +18 -4
  3. data/docs/DocxTableTableFillRequest.md +12 -0
  4. data/docs/DocxTableTableFillTableCell.md +9 -0
  5. data/docs/DocxTableTableFillTableRow.md +8 -0
  6. data/docs/EditHtmlApi.md +418 -0
  7. data/docs/EditPdfApi.md +6 -2
  8. data/docs/HtmlGetLanguageResult.md +9 -0
  9. data/docs/HtmlGetRelCanonicalUrlResult.md +9 -0
  10. data/docs/HtmlGetSitemapUrlResult.md +9 -0
  11. data/docs/MergeDocumentApi.md +2 -2
  12. data/docs/TransformDocumentApi.md +55 -0
  13. data/docs/ZipArchiveApi.md +16 -3
  14. data/lib/cloudmersive-convert-api-client.rb +6 -0
  15. data/lib/cloudmersive-convert-api-client/api/edit_html_api.rb +392 -0
  16. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +3 -0
  17. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +3 -3
  18. data/lib/cloudmersive-convert-api-client/api/transform_document_api.rb +54 -0
  19. data/lib/cloudmersive-convert-api-client/api/zip_archive_api.rb +20 -3
  20. data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_request.rb +243 -0
  21. data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_table_cell.rb +196 -0
  22. data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_table_row.rb +188 -0
  23. data/lib/cloudmersive-convert-api-client/models/html_get_language_result.rb +196 -0
  24. data/lib/cloudmersive-convert-api-client/models/html_get_rel_canonical_url_result.rb +196 -0
  25. data/lib/cloudmersive-convert-api-client/models/html_get_sitemap_url_result.rb +196 -0
  26. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  27. data/spec/api/edit_html_api_spec.rb +95 -0
  28. data/spec/api/edit_pdf_api_spec.rb +1 -0
  29. data/spec/api/merge_document_api_spec.rb +1 -1
  30. data/spec/api/transform_document_api_spec.rb +12 -0
  31. data/spec/api/zip_archive_api_spec.rb +3 -0
  32. data/spec/models/docx_table_table_fill_request_spec.rb +65 -0
  33. data/spec/models/docx_table_table_fill_table_cell_spec.rb +47 -0
  34. data/spec/models/docx_table_table_fill_table_row_spec.rb +41 -0
  35. data/spec/models/html_get_language_result_spec.rb +47 -0
  36. data/spec/models/html_get_rel_canonical_url_result_spec.rb +47 -0
  37. data/spec/models/html_get_sitemap_url_result_spec.rb +47 -0
  38. metadata +20 -2
@@ -746,6 +746,7 @@ module CloudmersiveConvertApiClient
746
746
  # Reduces the file size and optimizes the content of a PDF to minimize its file size.
747
747
  # @param input_file Input file to perform the operation on.
748
748
  # @param [Hash] opts the optional parameters
749
+ # @option opts [Float] :quality Quality level for the images in the PDF, ranging from 0.0 (low quality) to 1.0 (high quality); default is 0.3
749
750
  # @return [String]
750
751
  def edit_pdf_reduce_file_size(input_file, opts = {})
751
752
  data, _status_code, _headers = edit_pdf_reduce_file_size_with_http_info(input_file, opts)
@@ -756,6 +757,7 @@ module CloudmersiveConvertApiClient
756
757
  # Reduces the file size and optimizes the content of a PDF to minimize its file size.
757
758
  # @param input_file Input file to perform the operation on.
758
759
  # @param [Hash] opts the optional parameters
760
+ # @option opts [Float] :quality Quality level for the images in the PDF, ranging from 0.0 (low quality) to 1.0 (high quality); default is 0.3
759
761
  # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
760
762
  def edit_pdf_reduce_file_size_with_http_info(input_file, opts = {})
761
763
  if @api_client.config.debugging
@@ -777,6 +779,7 @@ module CloudmersiveConvertApiClient
777
779
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
778
780
  # HTTP header 'Content-Type'
779
781
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
782
+ header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?
780
783
 
781
784
  # form parameters
782
785
  form_params = {}
@@ -172,7 +172,7 @@ module CloudmersiveConvertApiClient
172
172
  # @param input_file1 First input file to perform the operation on.
173
173
  # @param input_file2 Second input file to perform the operation on (more than 2 can be supplied).
174
174
  # @param [Hash] opts the optional parameters
175
- # @return [Object]
175
+ # @return [String]
176
176
  def merge_document_html(input_file1, input_file2, opts = {})
177
177
  data, _status_code, _headers = merge_document_html_with_http_info(input_file1, input_file2, opts)
178
178
  data
@@ -183,7 +183,7 @@ module CloudmersiveConvertApiClient
183
183
  # @param input_file1 First input file to perform the operation on.
184
184
  # @param input_file2 Second input file to perform the operation on (more than 2 can be supplied).
185
185
  # @param [Hash] opts the optional parameters
186
- # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
186
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
187
187
  def merge_document_html_with_http_info(input_file1, input_file2, opts = {})
188
188
  if @api_client.config.debugging
189
189
  @api_client.config.logger.debug 'Calling API: MergeDocumentApi.merge_document_html ...'
@@ -223,7 +223,7 @@ module CloudmersiveConvertApiClient
223
223
  :form_params => form_params,
224
224
  :body => post_body,
225
225
  :auth_names => auth_names,
226
- :return_type => 'Object')
226
+ :return_type => 'String')
227
227
  if @api_client.config.debugging
228
228
  @api_client.config.logger.debug "API called: MergeDocumentApi#merge_document_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
229
229
  end
@@ -88,6 +88,60 @@ module CloudmersiveConvertApiClient
88
88
  end
89
89
  return data, status_code, headers
90
90
  end
91
+ # Fill in data in a table in a Word DOCX document
92
+ # Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates
93
+ # @param request
94
+ # @param [Hash] opts the optional parameters
95
+ # @return [String]
96
+ def transform_document_docx_table_fill_in(request, opts = {})
97
+ data, _status_code, _headers = transform_document_docx_table_fill_in_with_http_info(request, opts)
98
+ data
99
+ end
100
+
101
+ # Fill in data in a table in a Word DOCX document
102
+ # Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates
103
+ # @param request
104
+ # @param [Hash] opts the optional parameters
105
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
106
+ def transform_document_docx_table_fill_in_with_http_info(request, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_table_fill_in ...'
109
+ end
110
+ # verify the required parameter 'request' is set
111
+ if @api_client.config.client_side_validation && request.nil?
112
+ fail ArgumentError, "Missing the required parameter 'request' when calling TransformDocumentApi.transform_document_docx_table_fill_in"
113
+ end
114
+ # resource path
115
+ local_var_path = '/convert/transform/docx/table/fill/data'
116
+
117
+ # query parameters
118
+ query_params = {}
119
+
120
+ # header parameters
121
+ header_params = {}
122
+ # HTTP header 'Accept' (if needed)
123
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
124
+ # HTTP header 'Content-Type'
125
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
126
+
127
+ # form parameters
128
+ form_params = {}
129
+
130
+ # http body (model)
131
+ post_body = @api_client.object_to_http_body(request)
132
+ auth_names = ['Apikey']
133
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
134
+ :header_params => header_params,
135
+ :query_params => query_params,
136
+ :form_params => form_params,
137
+ :body => post_body,
138
+ :auth_names => auth_names,
139
+ :return_type => 'String')
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_table_fill_in\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
91
145
  # Replace string in PowerPoint PPTX presentation
92
146
  # Replace all instances of a string in an Office PowerPoint Document (pptx)
93
147
  # @param match_string String to search for and match against, to be replaced
@@ -249,21 +249,35 @@ module CloudmersiveConvertApiClient
249
249
  end
250
250
  # Create an encrypted zip file to quarantine a dangerous file
251
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.
252
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.
253
256
  # @return [Object]
254
- def zip_archive_zip_create_quarantine(opts = {})
255
- data, _status_code, _headers = zip_archive_zip_create_quarantine_with_http_info(opts)
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)
256
259
  data
257
260
  end
258
261
 
259
262
  # Create an encrypted zip file to quarantine a dangerous file
260
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.
261
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.
262
268
  # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
263
- def zip_archive_zip_create_quarantine_with_http_info(opts = {})
269
+ def zip_archive_zip_create_quarantine_with_http_info(password, input_file1, opts = {})
264
270
  if @api_client.config.debugging
265
271
  @api_client.config.logger.debug 'Calling API: ZipArchiveApi.zip_archive_zip_create_quarantine ...'
266
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
267
281
  # resource path
268
282
  local_var_path = '/convert/archive/zip/create/quarantine'
269
283
 
@@ -274,9 +288,12 @@ module CloudmersiveConvertApiClient
274
288
  header_params = {}
275
289
  # HTTP header 'Accept' (if needed)
276
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?
277
293
 
278
294
  # form parameters
279
295
  form_params = {}
296
+ form_params['inputFile1'] = input_file1
280
297
 
281
298
  # http body (model)
282
299
  post_body = nil
@@ -0,0 +1,243 @@
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 update data in a table in a Word DOCX Document
17
+ class DocxTableTableFillRequest
18
+ # Optional; Input URL of the document; use BeginEditing to create this
19
+ attr_accessor :input_file_url
20
+
21
+ # Optional; Input Word Document file content for the operation
22
+ attr_accessor :input_file_data
23
+
24
+ # Start tag that delineates the beginning of the table
25
+ attr_accessor :table_start_tag
26
+
27
+ # End tag that delineates the end of the table
28
+ attr_accessor :table_end_tag
29
+
30
+ # Data set to populate the table with
31
+ attr_accessor :data_to_fill_in
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'input_file_url' => :'InputFileUrl',
37
+ :'input_file_data' => :'InputFileData',
38
+ :'table_start_tag' => :'TableStartTag',
39
+ :'table_end_tag' => :'TableEndTag',
40
+ :'data_to_fill_in' => :'DataToFillIn'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'input_file_url' => :'String',
48
+ :'input_file_data' => :'String',
49
+ :'table_start_tag' => :'String',
50
+ :'table_end_tag' => :'String',
51
+ :'data_to_fill_in' => :'Array<DocxTableTableFillTableRow>'
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?(:'InputFileUrl')
64
+ self.input_file_url = attributes[:'InputFileUrl']
65
+ end
66
+
67
+ if attributes.has_key?(:'InputFileData')
68
+ self.input_file_data = attributes[:'InputFileData']
69
+ end
70
+
71
+ if attributes.has_key?(:'TableStartTag')
72
+ self.table_start_tag = attributes[:'TableStartTag']
73
+ end
74
+
75
+ if attributes.has_key?(:'TableEndTag')
76
+ self.table_end_tag = attributes[:'TableEndTag']
77
+ end
78
+
79
+ if attributes.has_key?(:'DataToFillIn')
80
+ if (value = attributes[:'DataToFillIn']).is_a?(Array)
81
+ self.data_to_fill_in = value
82
+ end
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ if !@input_file_data.nil? && @input_file_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
91
+ invalid_properties.push('invalid value for "input_file_data", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if !@input_file_data.nil? && @input_file_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] input_file_data Value to be assigned
106
+ def input_file_data=(input_file_data)
107
+ if !input_file_data.nil? && input_file_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
108
+ fail ArgumentError, 'invalid value for "input_file_data", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
109
+ end
110
+
111
+ @input_file_data = input_file_data
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ input_file_url == o.input_file_url &&
120
+ input_file_data == o.input_file_data &&
121
+ table_start_tag == o.table_start_tag &&
122
+ table_end_tag == o.table_end_tag &&
123
+ data_to_fill_in == o.data_to_fill_in
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Fixnum] Hash code
134
+ def hash
135
+ [input_file_url, input_file_data, table_start_tag, table_end_tag, data_to_fill_in].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.swagger_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :DateTime
165
+ DateTime.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :BOOLEAN
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
196
+ temp_model.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ next if value.nil?
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+
242
+ end
243
+ 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
+ # Cell data to fill in to the DOCX Table
17
+ class DocxTableTableFillTableCell
18
+ # Target tag to replace
19
+ attr_accessor :target_tag
20
+
21
+ # Replacement value for the target tag
22
+ attr_accessor :replacement_value
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'target_tag' => :'TargetTag',
28
+ :'replacement_value' => :'ReplacementValue'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'target_tag' => :'String',
36
+ :'replacement_value' => :'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?(:'TargetTag')
49
+ self.target_tag = attributes[:'TargetTag']
50
+ end
51
+
52
+ if attributes.has_key?(:'ReplacementValue')
53
+ self.replacement_value = attributes[:'ReplacementValue']
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
+ target_tag == o.target_tag &&
76
+ replacement_value == o.replacement_value
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
+ [target_tag, replacement_value].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