cloudmersive-convert-api-client 1.7.3 → 1.7.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -5
  3. data/docs/AutodetectToThumbnailsResult.md +9 -0
  4. data/docs/ConvertDataApi.md +6 -2
  5. data/docs/ConvertDocumentApi.md +794 -84
  6. data/docs/CsvCollection.md +10 -0
  7. data/docs/CsvFileResult.md +9 -0
  8. data/docs/DocumentValidationResult.md +1 -0
  9. data/docs/DocxParagraph.md +1 -1
  10. data/docs/DocxRun.md +1 -1
  11. data/docs/DocxText.md +1 -1
  12. data/docs/DocxToPngResult.md +9 -0
  13. data/docs/EditDocumentApi.md +110 -0
  14. data/docs/EmlAttachment.md +9 -0
  15. data/docs/EmlToHtmlResult.md +16 -0
  16. data/docs/FindDocxParagraphRequest.md +11 -0
  17. data/docs/FindDocxParagraphResponse.md +10 -0
  18. data/docs/GetFileTypeIconResult.md +10 -0
  19. data/docs/MsgAttachment.md +9 -0
  20. data/docs/MsgToHtmlResult.md +16 -0
  21. data/docs/PptxToPngResult.md +9 -0
  22. data/docs/ReplaceDocxParagraphRequest.md +12 -0
  23. data/docs/ReplaceDocxParagraphResponse.md +9 -0
  24. data/docs/Thumbnail.md +9 -0
  25. data/docs/ValidateDocumentApi.md +386 -1
  26. data/docs/XlsxToPngResult.md +9 -0
  27. data/docs/ZipArchiveApi.md +144 -5
  28. data/docs/ZipEncryptionAdvancedRequest.md +10 -0
  29. data/lib/cloudmersive-convert-api-client.rb +17 -0
  30. data/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +3 -0
  31. data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +722 -6
  32. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +110 -0
  33. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +394 -2
  34. data/lib/cloudmersive-convert-api-client/api/zip_archive_api.rb +160 -6
  35. data/lib/cloudmersive-convert-api-client/models/autodetect_to_thumbnails_result.rb +201 -0
  36. data/lib/cloudmersive-convert-api-client/models/csv_collection.rb +211 -0
  37. data/lib/cloudmersive-convert-api-client/models/csv_file_result.rb +215 -0
  38. data/lib/cloudmersive-convert-api-client/models/document_validation_result.rb +11 -1
  39. data/lib/cloudmersive-convert-api-client/models/docx_paragraph.rb +1 -1
  40. data/lib/cloudmersive-convert-api-client/models/docx_run.rb +1 -1
  41. data/lib/cloudmersive-convert-api-client/models/docx_text.rb +1 -1
  42. data/lib/cloudmersive-convert-api-client/models/docx_to_png_result.rb +201 -0
  43. data/lib/cloudmersive-convert-api-client/models/eml_attachment.rb +215 -0
  44. data/lib/cloudmersive-convert-api-client/models/eml_to_html_result.rb +271 -0
  45. data/lib/cloudmersive-convert-api-client/models/find_docx_paragraph_request.rb +235 -0
  46. data/lib/cloudmersive-convert-api-client/models/find_docx_paragraph_response.rb +211 -0
  47. data/lib/cloudmersive-convert-api-client/models/get_file_type_icon_result.rb +225 -0
  48. data/lib/cloudmersive-convert-api-client/models/msg_attachment.rb +215 -0
  49. data/lib/cloudmersive-convert-api-client/models/msg_to_html_result.rb +271 -0
  50. data/lib/cloudmersive-convert-api-client/models/pptx_to_png_result.rb +201 -0
  51. data/lib/cloudmersive-convert-api-client/models/replace_docx_paragraph_request.rb +245 -0
  52. data/lib/cloudmersive-convert-api-client/models/replace_docx_paragraph_response.rb +199 -0
  53. data/lib/cloudmersive-convert-api-client/models/thumbnail.rb +215 -0
  54. data/lib/cloudmersive-convert-api-client/models/xlsx_to_png_result.rb +201 -0
  55. data/lib/cloudmersive-convert-api-client/models/zip_encryption_advanced_request.rb +225 -0
  56. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  57. data/spec/api/convert_data_api_spec.rb +1 -0
  58. data/spec/api/convert_document_api_spec.rb +163 -3
  59. data/spec/api/edit_document_api_spec.rb +24 -0
  60. data/spec/api/validate_document_api_spec.rb +85 -1
  61. data/spec/api/zip_archive_api_spec.rb +36 -1
  62. data/spec/models/autodetect_to_thumbnails_result_spec.rb +48 -0
  63. data/spec/models/csv_collection_spec.rb +54 -0
  64. data/spec/models/csv_file_result_spec.rb +48 -0
  65. data/spec/models/document_validation_result_spec.rb +6 -0
  66. data/spec/models/docx_to_png_result_spec.rb +48 -0
  67. data/spec/models/eml_attachment_spec.rb +48 -0
  68. data/spec/models/eml_to_html_result_spec.rb +90 -0
  69. data/spec/models/find_docx_paragraph_request_spec.rb +60 -0
  70. data/spec/models/find_docx_paragraph_response_spec.rb +54 -0
  71. data/spec/models/get_file_type_icon_result_spec.rb +54 -0
  72. data/spec/models/msg_attachment_spec.rb +48 -0
  73. data/spec/models/msg_to_html_result_spec.rb +90 -0
  74. data/spec/models/pptx_to_png_result_spec.rb +48 -0
  75. data/spec/models/replace_docx_paragraph_request_spec.rb +66 -0
  76. data/spec/models/replace_docx_paragraph_response_spec.rb +48 -0
  77. data/spec/models/thumbnail_spec.rb +48 -0
  78. data/spec/models/xlsx_to_png_result_spec.rb +48 -0
  79. data/spec/models/zip_encryption_advanced_request_spec.rb +54 -0
  80. metadata +53 -2
@@ -22,21 +22,45 @@ module CloudmersiveConvertApiClient
22
22
 
23
23
  # Compress files to create a new zip archive
24
24
  # Create a new zip archive by compressing input files.
25
+ # @param input_file1 First input file to perform the operation on.
25
26
  # @param [Hash] opts the optional parameters
26
- # @return [Object]
27
- def zip_archive_zip_create(opts = {})
28
- data, _status_code, _headers = zip_archive_zip_create_with_http_info(opts)
27
+ # @option opts [File] :input_file2 Second input file to perform the operation on.
28
+ # @option opts [File] :input_file3 Third input file to perform the operation on.
29
+ # @option opts [File] :input_file4 Fourth input file to perform the operation on.
30
+ # @option opts [File] :input_file5 Fifth input file to perform the operation on.
31
+ # @option opts [File] :input_file6 Sixth input file to perform the operation on.
32
+ # @option opts [File] :input_file7 Seventh input file to perform the operation on.
33
+ # @option opts [File] :input_file8 Eighth input file to perform the operation on.
34
+ # @option opts [File] :input_file9 Ninth input file to perform the operation on.
35
+ # @option opts [File] :input_file10 Tenth input file to perform the operation on.
36
+ # @return [String]
37
+ def zip_archive_zip_create(input_file1, opts = {})
38
+ data, _status_code, _headers = zip_archive_zip_create_with_http_info(input_file1, opts)
29
39
  return data
30
40
  end
31
41
 
32
42
  # Compress files to create a new zip archive
33
43
  # Create a new zip archive by compressing input files.
44
+ # @param input_file1 First input file to perform the operation on.
34
45
  # @param [Hash] opts the optional parameters
35
- # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
36
- def zip_archive_zip_create_with_http_info(opts = {})
46
+ # @option opts [File] :input_file2 Second input file to perform the operation on.
47
+ # @option opts [File] :input_file3 Third input file to perform the operation on.
48
+ # @option opts [File] :input_file4 Fourth input file to perform the operation on.
49
+ # @option opts [File] :input_file5 Fifth input file to perform the operation on.
50
+ # @option opts [File] :input_file6 Sixth input file to perform the operation on.
51
+ # @option opts [File] :input_file7 Seventh input file to perform the operation on.
52
+ # @option opts [File] :input_file8 Eighth input file to perform the operation on.
53
+ # @option opts [File] :input_file9 Ninth input file to perform the operation on.
54
+ # @option opts [File] :input_file10 Tenth input file to perform the operation on.
55
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
56
+ def zip_archive_zip_create_with_http_info(input_file1, opts = {})
37
57
  if @api_client.config.debugging
38
58
  @api_client.config.logger.debug "Calling API: ZipArchiveApi.zip_archive_zip_create ..."
39
59
  end
60
+ # verify the required parameter 'input_file1' is set
61
+ if @api_client.config.client_side_validation && input_file1.nil?
62
+ fail ArgumentError, "Missing the required parameter 'input_file1' when calling ZipArchiveApi.zip_archive_zip_create"
63
+ end
40
64
  # resource path
41
65
  local_var_path = "/convert/archive/zip/create"
42
66
 
@@ -47,9 +71,21 @@ module CloudmersiveConvertApiClient
47
71
  header_params = {}
48
72
  # HTTP header 'Accept' (if needed)
49
73
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
74
+ # HTTP header 'Content-Type'
75
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
50
76
 
51
77
  # form parameters
52
78
  form_params = {}
79
+ form_params["inputFile1"] = input_file1
80
+ form_params["inputFile2"] = opts[:'input_file2'] if !opts[:'input_file2'].nil?
81
+ form_params["inputFile3"] = opts[:'input_file3'] if !opts[:'input_file3'].nil?
82
+ form_params["inputFile4"] = opts[:'input_file4'] if !opts[:'input_file4'].nil?
83
+ form_params["inputFile5"] = opts[:'input_file5'] if !opts[:'input_file5'].nil?
84
+ form_params["inputFile6"] = opts[:'input_file6'] if !opts[:'input_file6'].nil?
85
+ form_params["inputFile7"] = opts[:'input_file7'] if !opts[:'input_file7'].nil?
86
+ form_params["inputFile8"] = opts[:'input_file8'] if !opts[:'input_file8'].nil?
87
+ form_params["inputFile9"] = opts[:'input_file9'] if !opts[:'input_file9'].nil?
88
+ form_params["inputFile10"] = opts[:'input_file10'] if !opts[:'input_file10'].nil?
53
89
 
54
90
  # http body (model)
55
91
  post_body = nil
@@ -60,7 +96,7 @@ module CloudmersiveConvertApiClient
60
96
  :form_params => form_params,
61
97
  :body => post_body,
62
98
  :auth_names => auth_names,
63
- :return_type => 'Object')
99
+ :return_type => 'String')
64
100
  if @api_client.config.debugging
65
101
  @api_client.config.logger.debug "API called: ZipArchiveApi#zip_archive_zip_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
66
102
  end
@@ -122,6 +158,124 @@ module CloudmersiveConvertApiClient
122
158
  return data, status_code, headers
123
159
  end
124
160
 
161
+ # Decrypt and remove password protection on a zip file
162
+ # Decrypts and removes password protection from an encrypted zip file with the specified password
163
+ # @param input_file Input file to perform the operation on.
164
+ # @param zip_password Required; Password for the input archive
165
+ # @param [Hash] opts the optional parameters
166
+ # @return [Object]
167
+ def zip_archive_zip_decrypt(input_file, zip_password, opts = {})
168
+ data, _status_code, _headers = zip_archive_zip_decrypt_with_http_info(input_file, zip_password, opts)
169
+ return data
170
+ end
171
+
172
+ # Decrypt and remove password protection on a zip file
173
+ # Decrypts and removes password protection from an encrypted zip file with the specified password
174
+ # @param input_file Input file to perform the operation on.
175
+ # @param zip_password Required; Password for the input archive
176
+ # @param [Hash] opts the optional parameters
177
+ # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
178
+ def zip_archive_zip_decrypt_with_http_info(input_file, zip_password, opts = {})
179
+ if @api_client.config.debugging
180
+ @api_client.config.logger.debug "Calling API: ZipArchiveApi.zip_archive_zip_decrypt ..."
181
+ end
182
+ # verify the required parameter 'input_file' is set
183
+ if @api_client.config.client_side_validation && input_file.nil?
184
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ZipArchiveApi.zip_archive_zip_decrypt"
185
+ end
186
+ # verify the required parameter 'zip_password' is set
187
+ if @api_client.config.client_side_validation && zip_password.nil?
188
+ fail ArgumentError, "Missing the required parameter 'zip_password' when calling ZipArchiveApi.zip_archive_zip_decrypt"
189
+ end
190
+ # resource path
191
+ local_var_path = "/convert/archive/zip/decrypt"
192
+
193
+ # query parameters
194
+ query_params = {}
195
+
196
+ # header parameters
197
+ header_params = {}
198
+ # HTTP header 'Accept' (if needed)
199
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
200
+ # HTTP header 'Content-Type'
201
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
202
+ header_params[:'zipPassword'] = zip_password
203
+
204
+ # form parameters
205
+ form_params = {}
206
+ form_params["inputFile"] = input_file
207
+
208
+ # http body (model)
209
+ post_body = nil
210
+ auth_names = ['Apikey']
211
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
212
+ :header_params => header_params,
213
+ :query_params => query_params,
214
+ :form_params => form_params,
215
+ :body => post_body,
216
+ :auth_names => auth_names,
217
+ :return_type => 'Object')
218
+ if @api_client.config.debugging
219
+ @api_client.config.logger.debug "API called: ZipArchiveApi#zip_archive_zip_decrypt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
220
+ end
221
+ return data, status_code, headers
222
+ end
223
+
224
+ # Encrypt and password protect a zip file
225
+ # Encrypts and password protects an existing zip file with the specified password and encryption algorithm
226
+ # @param encryption_request Encryption request
227
+ # @param [Hash] opts the optional parameters
228
+ # @return [Object]
229
+ def zip_archive_zip_encrypt_advanced(encryption_request, opts = {})
230
+ data, _status_code, _headers = zip_archive_zip_encrypt_advanced_with_http_info(encryption_request, opts)
231
+ return data
232
+ end
233
+
234
+ # Encrypt and password protect a zip file
235
+ # Encrypts and password protects an existing zip file with the specified password and encryption algorithm
236
+ # @param encryption_request Encryption request
237
+ # @param [Hash] opts the optional parameters
238
+ # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
239
+ def zip_archive_zip_encrypt_advanced_with_http_info(encryption_request, opts = {})
240
+ if @api_client.config.debugging
241
+ @api_client.config.logger.debug "Calling API: ZipArchiveApi.zip_archive_zip_encrypt_advanced ..."
242
+ end
243
+ # verify the required parameter 'encryption_request' is set
244
+ if @api_client.config.client_side_validation && encryption_request.nil?
245
+ fail ArgumentError, "Missing the required parameter 'encryption_request' when calling ZipArchiveApi.zip_archive_zip_encrypt_advanced"
246
+ end
247
+ # resource path
248
+ local_var_path = "/convert/archive/zip/encrypt/advanced"
249
+
250
+ # query parameters
251
+ query_params = {}
252
+
253
+ # header parameters
254
+ header_params = {}
255
+ # HTTP header 'Accept' (if needed)
256
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
257
+ # HTTP header 'Content-Type'
258
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
259
+
260
+ # form parameters
261
+ form_params = {}
262
+
263
+ # http body (model)
264
+ post_body = @api_client.object_to_http_body(encryption_request)
265
+ auth_names = ['Apikey']
266
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
267
+ :header_params => header_params,
268
+ :query_params => query_params,
269
+ :form_params => form_params,
270
+ :body => post_body,
271
+ :auth_names => auth_names,
272
+ :return_type => 'Object')
273
+ if @api_client.config.debugging
274
+ @api_client.config.logger.debug "API called: ZipArchiveApi#zip_archive_zip_encrypt_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
275
+ end
276
+ return data, status_code, headers
277
+ end
278
+
125
279
  # Extract, decompress files and folders from a zip archive
126
280
  # Extracts a zip archive by decompressing files, and folders.
127
281
  # @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,211 @@
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
+ # Collection of CSV Files
17
+ class CsvCollection
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Array of CSV File results
22
+ attr_accessor :csv_files
23
+
24
+ # Count of the number of CSV files produced
25
+ attr_accessor :file_count
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'successful' => :'Successful',
32
+ :'csv_files' => :'CsvFiles',
33
+ :'file_count' => :'FileCount'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'successful' => :'BOOLEAN',
41
+ :'csv_files' => :'Array<CsvFileResult>',
42
+ :'file_count' => :'Integer'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'Successful')
55
+ self.successful = attributes[:'Successful']
56
+ end
57
+
58
+ if attributes.has_key?(:'CsvFiles')
59
+ if (value = attributes[:'CsvFiles']).is_a?(Array)
60
+ self.csv_files = value
61
+ end
62
+ end
63
+
64
+ if attributes.has_key?(:'FileCount')
65
+ self.file_count = attributes[:'FileCount']
66
+ end
67
+
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ return invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ successful == o.successful &&
89
+ csv_files == o.csv_files &&
90
+ file_count == o.file_count
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Fixnum] Hash code
101
+ def hash
102
+ [successful, csv_files, file_count].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.swagger_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :BOOLEAN
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
163
+ temp_model.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ next if value.nil?
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end