aspose_email_cloud 18.7.0 → 19.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aspose-email-cloud.rb +145 -0
  3. data/lib/aspose-email-cloud/api/email_api.rb +577 -0
  4. data/{src/asposeemailcloud → lib/aspose-email-cloud}/api_client.rb +125 -133
  5. data/lib/aspose-email-cloud/api_error.rb +42 -0
  6. data/{src/asposeemailcloud → lib/aspose-email-cloud}/configuration.rb +56 -43
  7. data/lib/aspose-email-cloud/models/account_base_request.rb +250 -0
  8. data/lib/aspose-email-cloud/models/add_attachment_request.rb +219 -0
  9. data/lib/aspose-email-cloud/models/append_email_account_base_request.rb +300 -0
  10. data/lib/aspose-email-cloud/models/append_email_base_request.rb +316 -0
  11. data/lib/aspose-email-cloud/models/append_email_mime_base_request.rb +335 -0
  12. data/lib/aspose-email-cloud/models/base_object.rb +225 -0
  13. data/lib/aspose-email-cloud/models/contact_format.rb +45 -0
  14. data/lib/aspose-email-cloud/models/create_email_request.rb +224 -0
  15. data/lib/aspose-email-cloud/models/create_folder_base_request.rb +297 -0
  16. data/lib/aspose-email-cloud/models/delete_folder_base_request.rb +302 -0
  17. data/lib/aspose-email-cloud/models/delete_message_base_request.rb +302 -0
  18. data/lib/aspose-email-cloud/models/disc_usage.rb +229 -0
  19. data/lib/aspose-email-cloud/models/email_account_request.rb +342 -0
  20. data/lib/aspose-email-cloud/models/email_document.rb +226 -0
  21. data/{src/asposeemailcloud → lib/aspose-email-cloud}/models/email_document_response.rb +105 -109
  22. data/{src/asposeemailcloud → lib/aspose-email-cloud}/models/email_properties.rb +122 -97
  23. data/lib/aspose-email-cloud/models/email_property.rb +256 -0
  24. data/{src/asposeemailcloud → lib/aspose-email-cloud}/models/email_property_response.rb +105 -109
  25. data/lib/aspose-email-cloud/models/error.rb +241 -0
  26. data/lib/aspose-email-cloud/models/error_details.rb +224 -0
  27. data/lib/aspose-email-cloud/models/file_version.rb +289 -0
  28. data/lib/aspose-email-cloud/models/file_versions.rb +210 -0
  29. data/lib/aspose-email-cloud/models/files_list.rb +210 -0
  30. data/lib/aspose-email-cloud/models/files_upload_result.rb +223 -0
  31. data/lib/aspose-email-cloud/models/hierarchical_object.rb +238 -0
  32. data/lib/aspose-email-cloud/models/hierarchical_object_request.rb +224 -0
  33. data/lib/aspose-email-cloud/models/hierarchical_object_response.rb +219 -0
  34. data/lib/aspose-email-cloud/models/indexed_hierarchical_object.rb +254 -0
  35. data/lib/aspose-email-cloud/models/indexed_primitive_object.rb +252 -0
  36. data/{src/asposeemailcloud → lib/aspose-email-cloud}/models/link.rb +138 -116
  37. data/lib/aspose-email-cloud/models/list_response_of_hierarchical_object_response.rb +208 -0
  38. data/{src/asposeemailcloud/models/email_document.rb → lib/aspose-email-cloud/models/list_response_of_mail_server_folder.rb} +105 -98
  39. data/{src/asposeemailcloud/models/list_folders_response.rb → lib/aspose-email-cloud/models/list_response_of_string.rb} +105 -111
  40. data/{src/asposeemailcloud → lib/aspose-email-cloud}/models/mail_server_folder.rb +116 -96
  41. data/{src/asposeemailcloud → lib/aspose-email-cloud}/models/mime_response.rb +105 -109
  42. data/lib/aspose-email-cloud/models/object_exist.rb +229 -0
  43. data/lib/aspose-email-cloud/models/primitive_object.rb +236 -0
  44. data/lib/aspose-email-cloud/models/requests/add_calendar_attachment_request_data.rb +89 -0
  45. data/lib/aspose-email-cloud/models/requests/add_contact_attachment_request_data.rb +101 -0
  46. data/lib/aspose-email-cloud/models/requests/add_email_attachment_request_data.rb +89 -0
  47. data/lib/aspose-email-cloud/models/requests/add_mapi_attachment_request_data.rb +89 -0
  48. data/lib/aspose-email-cloud/models/requests/append_email_message_request_data.rb +75 -0
  49. data/lib/aspose-email-cloud/models/requests/append_mime_message_request_data.rb +75 -0
  50. data/lib/aspose-email-cloud/models/requests/copy_file_request_data.rb +92 -0
  51. data/lib/aspose-email-cloud/models/requests/copy_folder_request_data.rb +89 -0
  52. data/lib/aspose-email-cloud/models/requests/create_calendar_request_data.rb +82 -0
  53. data/lib/aspose-email-cloud/models/requests/create_contact_request_data.rb +94 -0
  54. data/lib/aspose-email-cloud/models/requests/create_email_folder_request_data.rb +75 -0
  55. data/lib/aspose-email-cloud/models/requests/create_email_request_data.rb +82 -0
  56. data/lib/aspose-email-cloud/models/requests/create_folder_request_data.rb +78 -0
  57. data/lib/aspose-email-cloud/models/requests/create_mapi_request_data.rb +82 -0
  58. data/lib/aspose-email-cloud/models/requests/delete_calendar_property_request_data.rb +96 -0
  59. data/lib/aspose-email-cloud/models/requests/delete_contact_property_request_data.rb +108 -0
  60. data/lib/aspose-email-cloud/models/requests/delete_email_folder_request_data.rb +75 -0
  61. data/lib/aspose-email-cloud/models/requests/delete_email_message_request_data.rb +75 -0
  62. data/lib/aspose-email-cloud/models/requests/delete_file_request_data.rb +81 -0
  63. data/lib/aspose-email-cloud/models/requests/delete_folder_request_data.rb +81 -0
  64. data/lib/aspose-email-cloud/models/requests/delete_mapi_attachment_request_data.rb +89 -0
  65. data/lib/aspose-email-cloud/models/requests/delete_mapi_properties_request_data.rb +82 -0
  66. data/lib/aspose-email-cloud/models/requests/download_file_request_data.rb +81 -0
  67. data/lib/aspose-email-cloud/models/requests/email_request.rb +75 -0
  68. data/lib/aspose-email-cloud/models/requests/fetch_email_message_request_data.rb +93 -0
  69. data/lib/aspose-email-cloud/models/requests/get_calendar_attachment_request_data.rb +88 -0
  70. data/lib/aspose-email-cloud/models/requests/get_calendar_list_request_data.rb +95 -0
  71. data/lib/aspose-email-cloud/models/requests/get_calendar_request_data.rb +81 -0
  72. data/lib/aspose-email-cloud/models/requests/get_contact_attachment_request_data.rb +100 -0
  73. data/lib/aspose-email-cloud/models/requests/get_contact_list_request_data.rb +92 -0
  74. data/lib/aspose-email-cloud/models/requests/get_contact_properties_request_data.rb +93 -0
  75. data/lib/aspose-email-cloud/models/requests/get_disc_usage_request_data.rb +71 -0
  76. data/lib/aspose-email-cloud/models/requests/get_email_attachment_request_data.rb +88 -0
  77. data/lib/aspose-email-cloud/models/requests/get_email_property_request_data.rb +88 -0
  78. data/lib/aspose-email-cloud/models/requests/get_email_request_data.rb +81 -0
  79. data/lib/aspose-email-cloud/models/requests/get_file_versions_request_data.rb +78 -0
  80. data/lib/aspose-email-cloud/models/requests/get_files_list_request_data.rb +78 -0
  81. data/lib/aspose-email-cloud/models/requests/get_mapi_attachment_request_data.rb +88 -0
  82. data/lib/aspose-email-cloud/models/requests/get_mapi_attachments_request_data.rb +81 -0
  83. data/lib/aspose-email-cloud/models/requests/get_mapi_list_request_data.rb +80 -0
  84. data/lib/aspose-email-cloud/models/requests/get_mapi_properties_request_data.rb +81 -0
  85. data/lib/aspose-email-cloud/models/requests/http_request.rb +51 -0
  86. data/lib/aspose-email-cloud/models/requests/list_email_folders_request_data.rb +88 -0
  87. data/lib/aspose-email-cloud/models/requests/list_email_messages_request_data.rb +105 -0
  88. data/lib/aspose-email-cloud/models/requests/move_file_request_data.rb +92 -0
  89. data/lib/aspose-email-cloud/models/requests/move_folder_request_data.rb +89 -0
  90. data/lib/aspose-email-cloud/models/requests/object_exists_request_data.rb +81 -0
  91. data/lib/aspose-email-cloud/models/requests/save_mail_account_request_data.rb +75 -0
  92. data/lib/aspose-email-cloud/models/requests/save_mail_o_auth_account_request_data.rb +75 -0
  93. data/lib/aspose-email-cloud/models/requests/send_email_mime_request_data.rb +75 -0
  94. data/lib/aspose-email-cloud/models/requests/send_email_request_data.rb +75 -0
  95. data/lib/aspose-email-cloud/models/requests/set_email_property_request_data.rb +89 -0
  96. data/lib/aspose-email-cloud/models/requests/set_email_read_flag_request_data.rb +75 -0
  97. data/lib/aspose-email-cloud/models/requests/storage_exists_request_data.rb +75 -0
  98. data/lib/aspose-email-cloud/models/requests/update_calendar_properties_request_data.rb +82 -0
  99. data/lib/aspose-email-cloud/models/requests/update_contact_properties_request_data.rb +94 -0
  100. data/lib/aspose-email-cloud/models/requests/update_mapi_properties_request_data.rb +82 -0
  101. data/lib/aspose-email-cloud/models/requests/upload_file_request_data.rb +87 -0
  102. data/lib/aspose-email-cloud/models/save_email_account_request.rb +377 -0
  103. data/lib/aspose-email-cloud/models/save_o_auth_email_account_request.rb +447 -0
  104. data/lib/aspose-email-cloud/models/send_email_base_request.rb +267 -0
  105. data/lib/aspose-email-cloud/models/send_email_mime_base_request.rb +286 -0
  106. data/lib/aspose-email-cloud/models/set_email_property_request.rb +224 -0
  107. data/lib/aspose-email-cloud/models/set_message_read_flag_account_base_request.rb +302 -0
  108. data/{src/asposeemailcloud/models/email_property.rb → lib/aspose-email-cloud/models/storage_exist.rb} +110 -96
  109. data/lib/aspose-email-cloud/models/storage_file.rb +262 -0
  110. data/lib/aspose-email-cloud/models/storage_file_location.rb +254 -0
  111. data/lib/aspose-email-cloud/models/storage_folder_location.rb +219 -0
  112. data/{src/asposeemailcloud/models/list_response.rb → lib/aspose-email-cloud/models/value_response.rb} +105 -111
  113. data/{src/asposeemailcloud → lib/aspose-email-cloud}/version.rb +4 -4
  114. metadata +128 -38
  115. data/src/asposeemailcloud.rb +0 -55
  116. data/src/asposeemailcloud/api/email_api.rb +0 -418
  117. data/src/asposeemailcloud/api/email_client_api.rb +0 -960
  118. data/src/asposeemailcloud/api_error.rb +0 -38
  119. data/src/asposeemailcloud/models/http_status_code.rb +0 -76
  120. data/src/asposeemailcloud/models/protocol_type.rb +0 -34
  121. data/src/asposeemailcloud/models/saa_spose_response.rb +0 -202
  122. data/src/asposeemailcloud/models/security_options.rb +0 -33
@@ -0,0 +1,447 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="SaveOAuthEmailAccountRequest.rb">
3
+ # Copyright (c) 2018-2019 Aspose Pty Ltd. All rights reserved.
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a
7
+ # copy of this software and associated documentation files (the "Software"),
8
+ # to deal in the Software without restriction, including without limitation
9
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ # and/or sell copies of the Software, and to permit persons to whom the
11
+ # Software is furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ # DEALINGS IN THE SOFTWARE.
23
+ # </summary>
24
+ # ----------------------------------------------------------------------------
25
+
26
+
27
+ require 'date'
28
+
29
+ module AsposeEmailCloud
30
+ # Save email account settings with OAuth request
31
+ class SaveOAuthEmailAccountRequest
32
+ # Email account host
33
+ attr_accessor :host
34
+
35
+ # Email account port
36
+ attr_accessor :port
37
+
38
+ # Email account login
39
+ attr_accessor :login
40
+
41
+ # Email account security options
42
+ attr_accessor :security_options
43
+
44
+ # Email account protocol type
45
+ attr_accessor :protocol_type
46
+
47
+ # Email account description
48
+ attr_accessor :description
49
+
50
+ # A storage file location info to store email account
51
+ attr_accessor :storage_file
52
+
53
+ # OAuth client identifier
54
+ attr_accessor :client_id
55
+
56
+ # OAuth client secret
57
+ attr_accessor :client_secret
58
+
59
+ # OAuth refresh token
60
+ attr_accessor :refresh_token
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'host' => :'host',
66
+ :'port' => :'port',
67
+ :'login' => :'login',
68
+ :'security_options' => :'securityOptions',
69
+ :'protocol_type' => :'protocolType',
70
+ :'description' => :'description',
71
+ :'storage_file' => :'storageFile',
72
+ :'client_id' => :'clientId',
73
+ :'client_secret' => :'clientSecret',
74
+ :'refresh_token' => :'refreshToken'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.swagger_types
80
+ {
81
+ :'host' => :'String',
82
+ :'port' => :'Integer',
83
+ :'login' => :'String',
84
+ :'security_options' => :'Object',
85
+ :'protocol_type' => :'Object',
86
+ :'description' => :'String',
87
+ :'storage_file' => :'StorageFileLocation',
88
+ :'client_id' => :'String',
89
+ :'client_secret' => :'String',
90
+ :'refresh_token' => :'String'
91
+ }
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ return unless attributes.is_a?(Hash)
98
+
99
+ # convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
101
+
102
+ if attributes.has_key?(:'host')
103
+ self.host = attributes[:'host']
104
+ end
105
+
106
+ if attributes.has_key?(:'port')
107
+ self.port = attributes[:'port']
108
+ end
109
+
110
+ if attributes.has_key?(:'login')
111
+ self.login = attributes[:'login']
112
+ end
113
+
114
+ if attributes.has_key?(:'securityOptions')
115
+ self.security_options = attributes[:'securityOptions']
116
+ end
117
+
118
+ if attributes.has_key?(:'protocolType')
119
+ self.protocol_type = attributes[:'protocolType']
120
+ end
121
+
122
+ if attributes.has_key?(:'description')
123
+ self.description = attributes[:'description']
124
+ end
125
+
126
+ if attributes.has_key?(:'storageFile')
127
+ self.storage_file = attributes[:'storageFile']
128
+ end
129
+
130
+ if attributes.has_key?(:'clientId')
131
+ self.client_id = attributes[:'clientId']
132
+ end
133
+
134
+ if attributes.has_key?(:'clientSecret')
135
+ self.client_secret = attributes[:'clientSecret']
136
+ end
137
+
138
+ if attributes.has_key?(:'refreshToken')
139
+ self.refresh_token = attributes[:'refreshToken']
140
+ end
141
+ end
142
+
143
+ # Initializes the object
144
+ def initialize(host=nil, port=nil, login=nil, security_options=nil, protocol_type=nil, description=nil, storage_file=nil, client_id=nil, client_secret=nil, refresh_token=nil)
145
+ self.host = host
146
+ self.port = port
147
+ self.login = login
148
+ self.security_options = security_options
149
+ self.protocol_type = protocol_type
150
+ self.description = description
151
+ self.storage_file = storage_file
152
+ self.client_id = client_id
153
+ self.client_secret = client_secret
154
+ self.refresh_token = refresh_token
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ invalid_properties = Array.new
161
+ if @host.nil?
162
+ invalid_properties.push('invalid value for "host", host cannot be nil.')
163
+ end
164
+
165
+ if @host.to_s.length < 1
166
+ invalid_properties.push('invalid value for "host", the character length must be great than or equal to 1.')
167
+ end
168
+
169
+ if @port.nil?
170
+ invalid_properties.push('invalid value for "port", port cannot be nil.')
171
+ end
172
+
173
+ if @login.nil?
174
+ invalid_properties.push('invalid value for "login", login cannot be nil.')
175
+ end
176
+
177
+ if @login.to_s.length < 1
178
+ invalid_properties.push('invalid value for "login", the character length must be great than or equal to 1.')
179
+ end
180
+
181
+ if @security_options.nil?
182
+ invalid_properties.push('invalid value for "security_options", security_options cannot be nil.')
183
+ end
184
+
185
+ if @protocol_type.nil?
186
+ invalid_properties.push('invalid value for "protocol_type", protocol_type cannot be nil.')
187
+ end
188
+
189
+ if @storage_file.nil?
190
+ invalid_properties.push('invalid value for "storage_file", storage_file cannot be nil.')
191
+ end
192
+
193
+ if @client_id.nil?
194
+ invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
195
+ end
196
+
197
+ if @client_id.to_s.length < 1
198
+ invalid_properties.push('invalid value for "client_id", the character length must be great than or equal to 1.')
199
+ end
200
+
201
+ if @client_secret.nil?
202
+ invalid_properties.push('invalid value for "client_secret", client_secret cannot be nil.')
203
+ end
204
+
205
+ if @client_secret.to_s.length < 1
206
+ invalid_properties.push('invalid value for "client_secret", the character length must be great than or equal to 1.')
207
+ end
208
+
209
+ if @refresh_token.nil?
210
+ invalid_properties.push('invalid value for "refresh_token", refresh_token cannot be nil.')
211
+ end
212
+
213
+ if @refresh_token.to_s.length < 1
214
+ invalid_properties.push('invalid value for "refresh_token", the character length must be great than or equal to 1.')
215
+ end
216
+
217
+ invalid_properties
218
+ end
219
+
220
+ # Check to see if the all the properties in the model are valid
221
+ # @return true if the model is valid
222
+ def valid?
223
+ return false if @host.nil?
224
+ return false if @host.to_s.length < 1
225
+ return false if @port.nil?
226
+ return false if @login.nil?
227
+ return false if @login.to_s.length < 1
228
+ return false if @security_options.nil?
229
+ return false if @protocol_type.nil?
230
+ return false if @storage_file.nil?
231
+ return false if @client_id.nil?
232
+ return false if @client_id.to_s.length < 1
233
+ return false if @client_secret.nil?
234
+ return false if @client_secret.to_s.length < 1
235
+ return false if @refresh_token.nil?
236
+ return false if @refresh_token.to_s.length < 1
237
+ true
238
+ end
239
+
240
+ # Custom attribute writer method with validation
241
+ # @param [Object] host Value to be assigned
242
+ def host=(host)
243
+ if host.nil?
244
+ fail ArgumentError, 'host cannot be nil'
245
+ end
246
+
247
+ if host.to_s.length < 1
248
+ fail ArgumentError, 'invalid value for "host", the character length must be great than or equal to 1.'
249
+ end
250
+
251
+ @host = host
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] login Value to be assigned
256
+ def login=(login)
257
+ if login.nil?
258
+ fail ArgumentError, 'login cannot be nil'
259
+ end
260
+
261
+ if login.to_s.length < 1
262
+ fail ArgumentError, 'invalid value for "login", the character length must be great than or equal to 1.'
263
+ end
264
+
265
+ @login = login
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] client_id Value to be assigned
270
+ def client_id=(client_id)
271
+ if client_id.nil?
272
+ fail ArgumentError, 'client_id cannot be nil'
273
+ end
274
+
275
+ if client_id.to_s.length < 1
276
+ fail ArgumentError, 'invalid value for "client_id", the character length must be great than or equal to 1.'
277
+ end
278
+
279
+ @client_id = client_id
280
+ end
281
+
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] client_secret Value to be assigned
284
+ def client_secret=(client_secret)
285
+ if client_secret.nil?
286
+ fail ArgumentError, 'client_secret cannot be nil'
287
+ end
288
+
289
+ if client_secret.to_s.length < 1
290
+ fail ArgumentError, 'invalid value for "client_secret", the character length must be great than or equal to 1.'
291
+ end
292
+
293
+ @client_secret = client_secret
294
+ end
295
+
296
+ # Custom attribute writer method with validation
297
+ # @param [Object] refresh_token Value to be assigned
298
+ def refresh_token=(refresh_token)
299
+ if refresh_token.nil?
300
+ fail ArgumentError, 'refresh_token cannot be nil'
301
+ end
302
+
303
+ if refresh_token.to_s.length < 1
304
+ fail ArgumentError, 'invalid value for "refresh_token", the character length must be great than or equal to 1.'
305
+ end
306
+
307
+ @refresh_token = refresh_token
308
+ end
309
+
310
+ # Checks equality by comparing each attribute.
311
+ # @param [Object] Object to be compared
312
+ def ==(o)
313
+ return true if self.equal?(o)
314
+ self.class == o.class &&
315
+ host == o.host &&
316
+ port == o.port &&
317
+ login == o.login &&
318
+ security_options == o.security_options &&
319
+ protocol_type == o.protocol_type &&
320
+ description == o.description &&
321
+ storage_file == o.storage_file &&
322
+ client_id == o.client_id &&
323
+ client_secret == o.client_secret &&
324
+ refresh_token == o.refresh_token
325
+ end
326
+
327
+ # @see the `==` method
328
+ # @param [Object] Object to be compared
329
+ def eql?(o)
330
+ self == o
331
+ end
332
+
333
+ # Calculates hash code according to all attributes.
334
+ # @return [Fixnum] Hash code
335
+ def hash
336
+ [host, port, login, security_options, protocol_type, description, storage_file, client_id, client_secret, refresh_token].hash
337
+ end
338
+
339
+ # Builds the object from hash
340
+ # @param [Hash] attributes Model attributes in the form of hash
341
+ # @return [Object] Returns the model itself
342
+ def build_from_hash(attributes)
343
+ return nil unless attributes.is_a?(Hash)
344
+ self.class.swagger_types.each_pair do |key, type|
345
+ attribute_key = self.class.attribute_map[key]
346
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
347
+ if type =~ /\AArray<(.*)>/i
348
+ # check to ensure the input is an array given that the the attribute
349
+ # is documented as an array but the input is not
350
+ if attributes[attribute_key].is_a?(Array)
351
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
352
+ end
353
+ elsif !attributes[attribute_key].nil?
354
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
355
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
356
+ end
357
+
358
+ self
359
+ end
360
+
361
+ # Deserializes the data based on type
362
+ # @param string type Data type
363
+ # @param string value Value to be deserialized
364
+ # @return [Object] Deserialized data
365
+ def _deserialize(type, value)
366
+ case type.to_sym
367
+ when :DateTime
368
+ DateTime.parse(value)
369
+ when :Date
370
+ Date.parse(value)
371
+ when :String
372
+ value.to_s
373
+ when :Integer
374
+ value.to_i
375
+ when :Float
376
+ value.to_f
377
+ when :BOOLEAN
378
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
379
+ true
380
+ else
381
+ false
382
+ end
383
+ when :Object
384
+ # generic object (usually a Hash), return directly
385
+ value
386
+ when /\AArray<(?<inner_type>.+)>\z/
387
+ inner_type = Regexp.last_match[:inner_type]
388
+ value.map { |v| _deserialize(inner_type, v) }
389
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
390
+ k_type = Regexp.last_match[:k_type]
391
+ v_type = Regexp.last_match[:v_type]
392
+ {}.tap do |hash|
393
+ value.each do |k, v|
394
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
395
+ end
396
+ end
397
+ else # model
398
+ type = value[:type] || type
399
+ temp_model = AsposeEmailCloud.const_get(type).new
400
+ temp_model.build_from_hash(value)
401
+ end
402
+ end
403
+
404
+ # Returns the string representation of the object
405
+ # @return [String] String presentation of the object
406
+ def to_s
407
+ to_hash.to_s
408
+ end
409
+
410
+ # to_body is an alias to to_hash (backward compatibility)
411
+ # @return [Hash] Returns the object in the form of hash
412
+ def to_body
413
+ to_hash
414
+ end
415
+
416
+ # Returns the object in the form of hash
417
+ # @return [Hash] Returns the object in the form of hash
418
+ def to_hash
419
+ hash = {}
420
+ self.class.attribute_map.each_pair do |attr, param|
421
+ value = self.send(attr)
422
+ next if value.nil?
423
+ hash[param] = _to_hash(value)
424
+ end
425
+ hash
426
+ end
427
+
428
+ # Outputs non-array value in the form of hash
429
+ # For object, use to_hash. Otherwise, just return the value
430
+ # @param [Object] value Any valid value
431
+ # @return [Hash] Returns the value in the form of hash
432
+ def _to_hash(value)
433
+ if value.is_a?(Array)
434
+ value.compact.map { |v| _to_hash(v) }
435
+ elsif value.is_a?(Hash)
436
+ {}.tap do |hash|
437
+ value.each { |k, v| hash[k] = _to_hash(v) }
438
+ end
439
+ elsif value.respond_to? :to_hash
440
+ value.to_hash
441
+ else
442
+ value
443
+ end
444
+ end
445
+
446
+ end
447
+ end
@@ -0,0 +1,267 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="SendEmailBaseRequest.rb">
3
+ # Copyright (c) 2018-2019 Aspose Pty Ltd. All rights reserved.
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a
7
+ # copy of this software and associated documentation files (the "Software"),
8
+ # to deal in the Software without restriction, including without limitation
9
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ # and/or sell copies of the Software, and to permit persons to whom the
11
+ # Software is furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ # DEALINGS IN THE SOFTWARE.
23
+ # </summary>
24
+ # ----------------------------------------------------------------------------
25
+
26
+
27
+ require 'date'
28
+
29
+ module AsposeEmailCloud
30
+ # Send email file request
31
+ class SendEmailBaseRequest
32
+ attr_accessor :first_account
33
+
34
+ attr_accessor :second_account
35
+
36
+ attr_accessor :storage_folder
37
+
38
+ # Email document (*.eml) file location in storage
39
+ attr_accessor :email_file
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'first_account' => :'firstAccount',
45
+ :'second_account' => :'secondAccount',
46
+ :'storage_folder' => :'storageFolder',
47
+ :'email_file' => :'emailFile'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'first_account' => :'String',
55
+ :'second_account' => :'String',
56
+ :'storage_folder' => :'StorageFolderLocation',
57
+ :'email_file' => :'StorageFileLocation'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.has_key?(:'firstAccount')
70
+ self.first_account = attributes[:'firstAccount']
71
+ end
72
+
73
+ if attributes.has_key?(:'secondAccount')
74
+ self.second_account = attributes[:'secondAccount']
75
+ end
76
+
77
+ if attributes.has_key?(:'storageFolder')
78
+ self.storage_folder = attributes[:'storageFolder']
79
+ end
80
+
81
+ if attributes.has_key?(:'emailFile')
82
+ self.email_file = attributes[:'emailFile']
83
+ end
84
+ end
85
+
86
+ # Initializes the object
87
+ def initialize(first_account=nil, second_account=nil, storage_folder=nil, email_file=nil)
88
+ self.first_account = first_account
89
+ self.second_account = second_account
90
+ self.storage_folder = storage_folder
91
+ self.email_file = email_file
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ if @first_account.nil?
99
+ invalid_properties.push('invalid value for "first_account", first_account cannot be nil.')
100
+ end
101
+
102
+ if @first_account.to_s.length < 1
103
+ invalid_properties.push('invalid value for "first_account", the character length must be great than or equal to 1.')
104
+ end
105
+
106
+ if @email_file.nil?
107
+ invalid_properties.push('invalid value for "email_file", email_file cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return false if @first_account.nil?
117
+ return false if @first_account.to_s.length < 1
118
+ return false if @email_file.nil?
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] first_account Value to be assigned
124
+ def first_account=(first_account)
125
+ if first_account.nil?
126
+ fail ArgumentError, 'first_account cannot be nil'
127
+ end
128
+
129
+ if first_account.to_s.length < 1
130
+ fail ArgumentError, 'invalid value for "first_account", the character length must be great than or equal to 1.'
131
+ end
132
+
133
+ @first_account = first_account
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ first_account == o.first_account &&
142
+ second_account == o.second_account &&
143
+ storage_folder == o.storage_folder &&
144
+ email_file == o.email_file
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Fixnum] Hash code
155
+ def hash
156
+ [first_account, second_account, storage_folder, email_file].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.swagger_types.each_pair do |key, type|
165
+ attribute_key = self.class.attribute_map[key]
166
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
167
+ if type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_key].is_a?(Array)
171
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
172
+ end
173
+ elsif !attributes[attribute_key].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
175
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ DateTime.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :BOOLEAN
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ type = value[:type] || type
219
+ temp_model = AsposeEmailCloud.const_get(type).new
220
+ temp_model.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ next if value.nil?
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+ end