aspose_email_cloud 19.12.0 → 20.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aspose-email-cloud.rb +65 -0
  3. data/lib/aspose-email-cloud/api/email_api.rb +158 -1
  4. data/lib/aspose-email-cloud/models/ai_bcr_parse_ocr_data_rq.rb +230 -0
  5. data/lib/aspose-email-cloud/models/alternate_view.rb +279 -0
  6. data/lib/aspose-email-cloud/models/append_email_model_rq.rb +333 -0
  7. data/lib/aspose-email-cloud/models/associated_person.rb +241 -0
  8. data/lib/aspose-email-cloud/models/attachment.rb +321 -0
  9. data/lib/aspose-email-cloud/models/attachment_base.rb +251 -0
  10. data/lib/aspose-email-cloud/models/base_object.rb +86 -86
  11. data/lib/aspose-email-cloud/models/calendar_dto.rb +554 -0
  12. data/lib/aspose-email-cloud/models/calendar_dto_alternate_rq.rb +265 -0
  13. data/lib/aspose-email-cloud/models/calendar_dto_list.rb +212 -0
  14. data/lib/aspose-email-cloud/models/calendar_reminder.rb +315 -0
  15. data/lib/aspose-email-cloud/models/contact_dto.rb +696 -0
  16. data/lib/aspose-email-cloud/models/contact_dto_list.rb +212 -0
  17. data/lib/aspose-email-cloud/models/contact_photo.rb +228 -0
  18. data/lib/aspose-email-cloud/models/content_type.rb +264 -0
  19. data/lib/aspose-email-cloud/models/content_type_parameter.rb +223 -0
  20. data/lib/aspose-email-cloud/models/customer_event.rb +228 -0
  21. data/lib/aspose-email-cloud/models/email_address.rb +267 -0
  22. data/lib/aspose-email-cloud/models/email_dto.rb +678 -0
  23. data/lib/aspose-email-cloud/models/email_dto_list.rb +212 -0
  24. data/lib/aspose-email-cloud/models/enum_with_custom_of_associated_person_category.rb +227 -0
  25. data/lib/aspose-email-cloud/models/enum_with_custom_of_email_address_category.rb +227 -0
  26. data/lib/aspose-email-cloud/models/enum_with_custom_of_event_category.rb +227 -0
  27. data/lib/aspose-email-cloud/models/enum_with_custom_of_instant_messenger_category.rb +227 -0
  28. data/lib/aspose-email-cloud/models/enum_with_custom_of_phone_number_category.rb +227 -0
  29. data/lib/aspose-email-cloud/models/enum_with_custom_of_postal_address_category.rb +227 -0
  30. data/lib/aspose-email-cloud/models/enum_with_custom_of_url_category.rb +227 -0
  31. data/lib/aspose-email-cloud/models/hierarchical_object.rb +101 -101
  32. data/lib/aspose-email-cloud/models/indexed_hierarchical_object.rb +119 -119
  33. data/lib/aspose-email-cloud/models/indexed_primitive_object.rb +117 -117
  34. data/lib/aspose-email-cloud/models/instant_messenger_address.rb +241 -0
  35. data/lib/aspose-email-cloud/models/linked_resource.rb +264 -0
  36. data/lib/aspose-email-cloud/models/list_response_of_contact_dto.rb +211 -0
  37. data/lib/aspose-email-cloud/models/list_response_of_email_dto.rb +211 -0
  38. data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_calendar_dto.rb +211 -0
  39. data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_contact_dto.rb +211 -0
  40. data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_email_dto.rb +211 -0
  41. data/lib/aspose-email-cloud/models/mail_address.rb +241 -0
  42. data/lib/aspose-email-cloud/models/phone_number.rb +241 -0
  43. data/lib/aspose-email-cloud/models/postal_address.rb +350 -0
  44. data/lib/aspose-email-cloud/models/primitive_object.rb +99 -99
  45. data/lib/aspose-email-cloud/models/reminder_attendee.rb +210 -0
  46. data/lib/aspose-email-cloud/models/reminder_trigger.rb +246 -0
  47. data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_model_request_data.rb +75 -0
  48. data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_ocr_data_model_request_data.rb +75 -0
  49. data/lib/aspose-email-cloud/models/requests/append_email_model_message_request_data.rb +75 -0
  50. data/lib/aspose-email-cloud/models/requests/convert_calendar_model_to_alternate_request_data.rb +75 -0
  51. data/lib/aspose-email-cloud/models/requests/convert_email_request_data.rb +83 -0
  52. data/lib/aspose-email-cloud/models/requests/fetch_email_model_request_data.rb +93 -0
  53. data/lib/aspose-email-cloud/models/requests/get_calendar_model_as_alternate_request_data.rb +91 -0
  54. data/lib/aspose-email-cloud/models/requests/get_calendar_model_list_request_data.rb +85 -0
  55. data/lib/aspose-email-cloud/models/requests/get_calendar_model_request_data.rb +81 -0
  56. data/lib/aspose-email-cloud/models/requests/get_contact_model_list_request_data.rb +87 -0
  57. data/lib/aspose-email-cloud/models/requests/get_contact_model_request_data.rb +88 -0
  58. data/lib/aspose-email-cloud/models/requests/get_email_as_file_request_data.rb +88 -0
  59. data/lib/aspose-email-cloud/models/requests/get_email_model_list_request_data.rb +87 -0
  60. data/lib/aspose-email-cloud/models/requests/get_email_model_request_data.rb +88 -0
  61. data/lib/aspose-email-cloud/models/requests/list_email_messages_request_data.rb +1 -1
  62. data/lib/aspose-email-cloud/models/requests/list_email_models_request_data.rb +105 -0
  63. data/lib/aspose-email-cloud/models/requests/save_calendar_model_request_data.rb +82 -0
  64. data/lib/aspose-email-cloud/models/requests/save_contact_model_request_data.rb +89 -0
  65. data/lib/aspose-email-cloud/models/requests/save_email_model_request_data.rb +89 -0
  66. data/lib/aspose-email-cloud/models/requests/send_email_model_request_data.rb +75 -0
  67. data/lib/aspose-email-cloud/models/send_email_model_rq.rb +273 -0
  68. data/lib/aspose-email-cloud/models/storage_model_of_calendar_dto.rb +222 -0
  69. data/lib/aspose-email-cloud/models/storage_model_of_contact_dto.rb +222 -0
  70. data/lib/aspose-email-cloud/models/storage_model_of_email_dto.rb +222 -0
  71. data/lib/aspose-email-cloud/models/storage_model_rq_of_calendar_dto.rb +222 -0
  72. data/lib/aspose-email-cloud/models/storage_model_rq_of_contact_dto.rb +222 -0
  73. data/lib/aspose-email-cloud/models/storage_model_rq_of_email_dto.rb +222 -0
  74. data/lib/aspose-email-cloud/models/url.rb +241 -0
  75. data/lib/aspose-email-cloud/models/value_response.rb +1 -1
  76. data/lib/aspose-email-cloud/version.rb +1 -1
  77. metadata +67 -2
@@ -0,0 +1,279 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="AlternateView.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
+ # Represents the format to view a message.
31
+ class AlternateView
32
+ # Attachment file content as Base64 string.
33
+ # @return [String]
34
+ attr_accessor :base64_data
35
+
36
+ # Attachment content id
37
+ # @return [String]
38
+ attr_accessor :content_id
39
+
40
+ # Content type
41
+ # @return [ContentType]
42
+ attr_accessor :content_type
43
+
44
+ # Attachment headers.
45
+ # @return [Hash<String, String>]
46
+ attr_accessor :headers
47
+
48
+ # Base URI.
49
+ # @return [String]
50
+ attr_accessor :base_uri
51
+
52
+ # Embedded resources referred to by this alternate view.
53
+ # @return [Array<LinkedResource>]
54
+ attr_accessor :linked_resources
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'base64_data' => :'base64Data',
60
+ :'content_id' => :'contentId',
61
+ :'content_type' => :'contentType',
62
+ :'headers' => :'headers',
63
+ :'base_uri' => :'baseUri',
64
+ :'linked_resources' => :'linkedResources'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'base64_data' => :'String',
72
+ :'content_id' => :'String',
73
+ :'content_type' => :'ContentType',
74
+ :'headers' => :'Hash<String, String>',
75
+ :'base_uri' => :'String',
76
+ :'linked_resources' => :'Array<LinkedResource>'
77
+ }
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ return unless attributes.is_a?(Hash)
84
+
85
+ # convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
87
+
88
+ if attributes.has_key?(:'base64Data')
89
+ self.base64_data = attributes[:'base64Data']
90
+ end
91
+
92
+ if attributes.has_key?(:'contentId')
93
+ self.content_id = attributes[:'contentId']
94
+ end
95
+
96
+ if attributes.has_key?(:'contentType')
97
+ self.content_type = attributes[:'contentType']
98
+ end
99
+
100
+ if attributes.has_key?(:'headers')
101
+ if (value = attributes[:'headers']).is_a?(Hash)
102
+ self.headers = value
103
+ end
104
+ end
105
+
106
+ if attributes.has_key?(:'baseUri')
107
+ self.base_uri = attributes[:'baseUri']
108
+ end
109
+
110
+ if attributes.has_key?(:'linkedResources')
111
+ if (value = attributes[:'linkedResources']).is_a?(Array)
112
+ self.linked_resources = value
113
+ end
114
+ end
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [String] base64_data Attachment file content as Base64 string.
119
+ # @param [String] content_id Attachment content id
120
+ # @param [ContentType] content_type Content type
121
+ # @param [Hash<String, String>] headers Attachment headers.
122
+ # @param [String] base_uri Base URI.
123
+ # @param [Array<LinkedResource>] linked_resources Embedded resources referred to by this alternate view.
124
+ def initialize(base64_data=nil, content_id=nil, content_type=nil, headers=nil, base_uri=nil, linked_resources=nil)
125
+ self.base64_data = base64_data if base64_data
126
+ self.content_id = content_id if content_id
127
+ self.content_type = content_type if content_type
128
+ self.headers = headers if headers
129
+ self.base_uri = base_uri if base_uri
130
+ self.linked_resources = linked_resources if linked_resources
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ invalid_properties = Array.new
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ true
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ base64_data == o.base64_data &&
152
+ content_id == o.content_id &&
153
+ content_type == o.content_type &&
154
+ headers == o.headers &&
155
+ base_uri == o.base_uri &&
156
+ linked_resources == o.linked_resources
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Fixnum] Hash code
167
+ def hash
168
+ [base64_data, content_id, content_type, headers, base_uri, linked_resources].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ self.class.swagger_types.each_pair do |key, type|
177
+ attribute_key = self.class.attribute_map[key]
178
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
179
+ if type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_key].is_a?(Array)
183
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[attribute_key].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
187
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :DateTime
200
+ DateTime.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :BOOLEAN
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ type = value[:type] || type
231
+ temp_model = AsposeEmailCloud.const_get(type).new
232
+ temp_model.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ next if value.nil?
255
+ hash[param] = _to_hash(value)
256
+ end
257
+ hash
258
+ end
259
+
260
+ # Outputs non-array value in the form of hash
261
+ # For object, use to_hash. Otherwise, just return the value
262
+ # @param [Object] value Any valid value
263
+ # @return [Hash] Returns the value in the form of hash
264
+ def _to_hash(value)
265
+ if value.is_a?(Array)
266
+ value.compact.map { |v| _to_hash(v) }
267
+ elsif value.is_a?(Hash)
268
+ {}.tap do |hash|
269
+ value.each { |k, v| hash[k] = _to_hash(v) }
270
+ end
271
+ elsif value.respond_to? :to_hash
272
+ value.to_hash
273
+ else
274
+ value
275
+ end
276
+ end
277
+
278
+ end
279
+ end
@@ -0,0 +1,333 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="AppendEmailModelRq.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
+ # Append email request
31
+ class AppendEmailModelRq
32
+ # First account storage file name for receiving emails (or universal one)
33
+ # @return [String]
34
+ attr_accessor :first_account
35
+
36
+ # Second account storage file name for sending emails (ignored if first is universal)
37
+ # @return [String]
38
+ attr_accessor :second_account
39
+
40
+ # Storage folder location of account files
41
+ # @return [StorageFolderLocation]
42
+ attr_accessor :storage_folder
43
+
44
+ # Email account folder to store a message
45
+ # @return [String]
46
+ attr_accessor :folder
47
+
48
+ # Mark message as sent
49
+ # @return [BOOLEAN]
50
+ attr_accessor :mark_as_sent
51
+
52
+ # Email document
53
+ # @return [EmailDto]
54
+ attr_accessor :message
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'first_account' => :'firstAccount',
60
+ :'second_account' => :'secondAccount',
61
+ :'storage_folder' => :'storageFolder',
62
+ :'folder' => :'folder',
63
+ :'mark_as_sent' => :'markAsSent',
64
+ :'message' => :'message'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'first_account' => :'String',
72
+ :'second_account' => :'String',
73
+ :'storage_folder' => :'StorageFolderLocation',
74
+ :'folder' => :'String',
75
+ :'mark_as_sent' => :'BOOLEAN',
76
+ :'message' => :'EmailDto'
77
+ }
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ return unless attributes.is_a?(Hash)
84
+
85
+ # convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
87
+
88
+ if attributes.has_key?(:'firstAccount')
89
+ self.first_account = attributes[:'firstAccount']
90
+ end
91
+
92
+ if attributes.has_key?(:'secondAccount')
93
+ self.second_account = attributes[:'secondAccount']
94
+ end
95
+
96
+ if attributes.has_key?(:'storageFolder')
97
+ self.storage_folder = attributes[:'storageFolder']
98
+ end
99
+
100
+ if attributes.has_key?(:'folder')
101
+ self.folder = attributes[:'folder']
102
+ end
103
+
104
+ if attributes.has_key?(:'markAsSent')
105
+ self.mark_as_sent = attributes[:'markAsSent']
106
+ end
107
+
108
+ if attributes.has_key?(:'message')
109
+ self.message = attributes[:'message']
110
+ end
111
+ end
112
+
113
+ # Initializes the object
114
+ # @param [String] first_account First account storage file name for receiving emails (or universal one)
115
+ # @param [String] second_account Second account storage file name for sending emails (ignored if first is universal)
116
+ # @param [StorageFolderLocation] storage_folder Storage folder location of account files
117
+ # @param [String] folder Email account folder to store a message
118
+ # @param [BOOLEAN] mark_as_sent Mark message as sent
119
+ # @param [EmailDto] message Email document
120
+ def initialize(first_account=nil, second_account=nil, storage_folder=nil, folder=nil, mark_as_sent=nil, message=nil)
121
+ self.first_account = first_account if first_account
122
+ self.second_account = second_account if second_account
123
+ self.storage_folder = storage_folder if storage_folder
124
+ self.folder = folder if folder
125
+ self.mark_as_sent = mark_as_sent if mark_as_sent
126
+ self.message = message if message
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ if @first_account.nil?
134
+ invalid_properties.push('invalid value for "first_account", first_account cannot be nil.')
135
+ end
136
+
137
+ if @first_account.to_s.length < 1
138
+ invalid_properties.push('invalid value for "first_account", the character length must be great than or equal to 1.')
139
+ end
140
+
141
+ if @folder.nil?
142
+ invalid_properties.push('invalid value for "folder", folder cannot be nil.')
143
+ end
144
+
145
+ if @folder.to_s.length < 1
146
+ invalid_properties.push('invalid value for "folder", the character length must be great than or equal to 1.')
147
+ end
148
+
149
+ if @mark_as_sent.nil?
150
+ invalid_properties.push('invalid value for "mark_as_sent", mark_as_sent cannot be nil.')
151
+ end
152
+
153
+ if @message.nil?
154
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
155
+ end
156
+
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ return false if @first_account.nil?
164
+ return false if @first_account.to_s.length < 1
165
+ return false if @folder.nil?
166
+ return false if @folder.to_s.length < 1
167
+ return false if @mark_as_sent.nil?
168
+ return false if @message.nil?
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] first_account Value to be assigned
174
+ def first_account=(first_account)
175
+ if first_account.nil?
176
+ fail ArgumentError, 'first_account cannot be nil'
177
+ end
178
+
179
+ if first_account.to_s.length < 1
180
+ fail ArgumentError, 'invalid value for "first_account", the character length must be great than or equal to 1.'
181
+ end
182
+
183
+ @first_account = first_account
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] folder Value to be assigned
188
+ def folder=(folder)
189
+ if folder.nil?
190
+ fail ArgumentError, 'folder cannot be nil'
191
+ end
192
+
193
+ if folder.to_s.length < 1
194
+ fail ArgumentError, 'invalid value for "folder", the character length must be great than or equal to 1.'
195
+ end
196
+
197
+ @folder = folder
198
+ end
199
+
200
+ # Checks equality by comparing each attribute.
201
+ # @param [Object] Object to be compared
202
+ def ==(o)
203
+ return true if self.equal?(o)
204
+ self.class == o.class &&
205
+ first_account == o.first_account &&
206
+ second_account == o.second_account &&
207
+ storage_folder == o.storage_folder &&
208
+ folder == o.folder &&
209
+ mark_as_sent == o.mark_as_sent &&
210
+ message == o.message
211
+ end
212
+
213
+ # @see the `==` method
214
+ # @param [Object] Object to be compared
215
+ def eql?(o)
216
+ self == o
217
+ end
218
+
219
+ # Calculates hash code according to all attributes.
220
+ # @return [Fixnum] Hash code
221
+ def hash
222
+ [first_account, second_account, storage_folder, folder, mark_as_sent, message].hash
223
+ end
224
+
225
+ # Builds the object from hash
226
+ # @param [Hash] attributes Model attributes in the form of hash
227
+ # @return [Object] Returns the model itself
228
+ def build_from_hash(attributes)
229
+ return nil unless attributes.is_a?(Hash)
230
+ self.class.swagger_types.each_pair do |key, type|
231
+ attribute_key = self.class.attribute_map[key]
232
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
233
+ if type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[attribute_key].is_a?(Array)
237
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
238
+ end
239
+ elsif !attributes[attribute_key].nil?
240
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
241
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def _deserialize(type, value)
252
+ case type.to_sym
253
+ when :DateTime
254
+ DateTime.parse(value)
255
+ when :Date
256
+ Date.parse(value)
257
+ when :String
258
+ value.to_s
259
+ when :Integer
260
+ value.to_i
261
+ when :Float
262
+ value.to_f
263
+ when :BOOLEAN
264
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
265
+ true
266
+ else
267
+ false
268
+ end
269
+ when :Object
270
+ # generic object (usually a Hash), return directly
271
+ value
272
+ when /\AArray<(?<inner_type>.+)>\z/
273
+ inner_type = Regexp.last_match[:inner_type]
274
+ value.map { |v| _deserialize(inner_type, v) }
275
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
276
+ k_type = Regexp.last_match[:k_type]
277
+ v_type = Regexp.last_match[:v_type]
278
+ {}.tap do |hash|
279
+ value.each do |k, v|
280
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
281
+ end
282
+ end
283
+ else # model
284
+ type = value[:type] || type
285
+ temp_model = AsposeEmailCloud.const_get(type).new
286
+ temp_model.build_from_hash(value)
287
+ end
288
+ end
289
+
290
+ # Returns the string representation of the object
291
+ # @return [String] String presentation of the object
292
+ def to_s
293
+ to_hash.to_s
294
+ end
295
+
296
+ # to_body is an alias to to_hash (backward compatibility)
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_body
299
+ to_hash
300
+ end
301
+
302
+ # Returns the object in the form of hash
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_hash
305
+ hash = {}
306
+ self.class.attribute_map.each_pair do |attr, param|
307
+ value = self.send(attr)
308
+ next if value.nil?
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+
332
+ end
333
+ end