aspose_email_cloud 20.5.0 → 20.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aspose-email-cloud.rb +74 -0
  3. data/lib/aspose-email-cloud/api/email_api.rb +147 -0
  4. data/lib/aspose-email-cloud/models/ai_bcr_image_storage_file.rb +3 -3
  5. data/lib/aspose-email-cloud/models/ai_bcr_parse_storage_rq.rb +3 -3
  6. data/lib/aspose-email-cloud/models/append_email_base_request.rb +3 -3
  7. data/lib/aspose-email-cloud/models/append_email_model_rq.rb +3 -3
  8. data/lib/aspose-email-cloud/models/calendar_dto.rb +17 -4
  9. data/lib/aspose-email-cloud/models/contact_photo.rb +29 -5
  10. data/lib/aspose-email-cloud/models/daily_recurrence_pattern_dto.rb +296 -0
  11. data/lib/aspose-email-cloud/models/mapi_attachment_dto.rb +226 -0
  12. data/lib/aspose-email-cloud/models/mapi_binary_property_dto.rb +250 -0
  13. data/lib/aspose-email-cloud/models/mapi_boolean_property_dto.rb +255 -0
  14. data/lib/aspose-email-cloud/models/mapi_calendar_attendees_dto.rb +266 -0
  15. data/lib/aspose-email-cloud/models/mapi_calendar_daily_recurrence_pattern_dto.rb +464 -0
  16. data/lib/aspose-email-cloud/models/mapi_calendar_dto.rb +728 -0
  17. data/lib/aspose-email-cloud/models/mapi_calendar_event_recurrence_dto.rb +293 -0
  18. data/lib/aspose-email-cloud/models/mapi_calendar_exception_info_dto.rb +431 -0
  19. data/lib/aspose-email-cloud/models/mapi_calendar_recurrence_pattern_dto.rb +449 -0
  20. data/lib/aspose-email-cloud/models/mapi_calendar_time_zone_dto.rb +228 -0
  21. data/lib/aspose-email-cloud/models/mapi_calendar_time_zone_info_dto.rb +313 -0
  22. data/lib/aspose-email-cloud/models/mapi_calendar_time_zone_rule_dto.rb +362 -0
  23. data/lib/aspose-email-cloud/models/mapi_calendar_weekly_recurrence_pattern_dto.rb +464 -0
  24. data/lib/aspose-email-cloud/models/mapi_calendar_yearly_and_monthly_recurrence_pattern_dto.rb +500 -0
  25. data/lib/aspose-email-cloud/models/mapi_contact_dto.rb +569 -0
  26. data/lib/aspose-email-cloud/models/mapi_contact_electronic_address_dto.rb +283 -0
  27. data/lib/aspose-email-cloud/models/mapi_contact_electronic_address_property_set_dto.rb +327 -0
  28. data/lib/aspose-email-cloud/models/mapi_contact_event_property_set_dto.rb +236 -0
  29. data/lib/aspose-email-cloud/models/mapi_contact_name_property_set_dto.rb +335 -0
  30. data/lib/aspose-email-cloud/models/mapi_contact_other_property_set_dto.rb +319 -0
  31. data/lib/aspose-email-cloud/models/mapi_contact_personal_info_property_set_dto.rb +454 -0
  32. data/lib/aspose-email-cloud/models/mapi_contact_photo_dto.rb +255 -0
  33. data/lib/aspose-email-cloud/models/mapi_contact_physical_address_dto.rb +322 -0
  34. data/lib/aspose-email-cloud/models/mapi_contact_physical_address_property_set_dto.rb +239 -0
  35. data/lib/aspose-email-cloud/models/mapi_contact_professional_property_set_dto.rb +291 -0
  36. data/lib/aspose-email-cloud/models/mapi_contact_telephone_property_set_dto.rb +457 -0
  37. data/lib/aspose-email-cloud/models/mapi_date_time_property_dto.rb +255 -0
  38. data/lib/aspose-email-cloud/models/mapi_electronic_address_dto.rb +265 -0
  39. data/lib/aspose-email-cloud/models/mapi_file_as_property_dto.rb +255 -0
  40. data/lib/aspose-email-cloud/models/mapi_importance_property_dto.rb +255 -0
  41. data/lib/aspose-email-cloud/models/mapi_int_property_dto.rb +255 -0
  42. data/lib/aspose-email-cloud/models/mapi_known_property_descriptor.rb +237 -0
  43. data/lib/aspose-email-cloud/models/mapi_legacy_free_busy_property_dto.rb +255 -0
  44. data/lib/aspose-email-cloud/models/mapi_message_dto.rb +801 -0
  45. data/lib/aspose-email-cloud/models/mapi_message_item_base_dto.rb +452 -0
  46. data/lib/aspose-email-cloud/models/mapi_multi_int_property_dto.rb +252 -0
  47. data/lib/aspose-email-cloud/models/mapi_multi_string_property_dto.rb +252 -0
  48. data/lib/aspose-email-cloud/models/mapi_physical_address_index_property_dto.rb +255 -0
  49. data/lib/aspose-email-cloud/models/mapi_pid_lid_property_descriptor.rb +322 -0
  50. data/lib/aspose-email-cloud/models/mapi_pid_name_property_descriptor.rb +304 -0
  51. data/lib/aspose-email-cloud/models/mapi_pid_property_descriptor.rb +286 -0
  52. data/lib/aspose-email-cloud/models/mapi_pid_tag_property_descriptor.rb +322 -0
  53. data/lib/aspose-email-cloud/models/mapi_property_descriptor.rb +224 -0
  54. data/lib/aspose-email-cloud/models/mapi_property_dto.rb +237 -0
  55. data/lib/aspose-email-cloud/models/mapi_recipient_dto.rb +257 -0
  56. data/lib/aspose-email-cloud/models/mapi_response_type_property_dto.rb +255 -0
  57. data/lib/aspose-email-cloud/models/mapi_string_property_dto.rb +250 -0
  58. data/lib/aspose-email-cloud/models/monthly_recurrence_pattern_dto.rb +350 -0
  59. data/lib/aspose-email-cloud/models/recurrence_pattern_dto.rb +296 -0
  60. data/lib/aspose-email-cloud/models/requests/convert_calendar_model_to_mapi_model_request_data.rb +79 -0
  61. data/lib/aspose-email-cloud/models/requests/convert_contact_model_to_mapi_model_request_data.rb +79 -0
  62. data/lib/aspose-email-cloud/models/requests/convert_email_model_to_file_request_data.rb +2 -2
  63. data/lib/aspose-email-cloud/models/requests/convert_email_model_to_mapi_model_request_data.rb +79 -0
  64. data/lib/aspose-email-cloud/models/requests/convert_email_request_data.rb +2 -2
  65. data/lib/aspose-email-cloud/models/requests/convert_mapi_calendar_model_to_calendar_model_request_data.rb +79 -0
  66. data/lib/aspose-email-cloud/models/requests/convert_mapi_calendar_model_to_file_request_data.rb +89 -0
  67. data/lib/aspose-email-cloud/models/requests/convert_mapi_contact_model_to_contact_model_request_data.rb +79 -0
  68. data/lib/aspose-email-cloud/models/requests/convert_mapi_contact_model_to_file_request_data.rb +89 -0
  69. data/lib/aspose-email-cloud/models/requests/convert_mapi_message_model_to_email_model_request_data.rb +79 -0
  70. data/lib/aspose-email-cloud/models/requests/convert_mapi_message_model_to_file_request_data.rb +89 -0
  71. data/lib/aspose-email-cloud/models/requests/get_calendar_file_as_mapi_model_request_data.rb +80 -0
  72. data/lib/aspose-email-cloud/models/requests/get_contact_file_as_mapi_model_request_data.rb +90 -0
  73. data/lib/aspose-email-cloud/models/requests/get_email_as_file_request_data.rb +2 -2
  74. data/lib/aspose-email-cloud/models/requests/get_email_file_as_mapi_model_request_data.rb +90 -0
  75. data/lib/aspose-email-cloud/models/requests/get_email_model_list_request_data.rb +2 -2
  76. data/lib/aspose-email-cloud/models/requests/get_email_model_request_data.rb +2 -2
  77. data/lib/aspose-email-cloud/models/requests/get_mapi_calendar_model_request_data.rb +91 -0
  78. data/lib/aspose-email-cloud/models/requests/get_mapi_contact_model_request_data.rb +101 -0
  79. data/lib/aspose-email-cloud/models/requests/get_mapi_message_model_request_data.rb +101 -0
  80. data/lib/aspose-email-cloud/models/requests/save_calendar_model_request_data.rb +2 -2
  81. data/lib/aspose-email-cloud/models/requests/save_contact_model_request_data.rb +2 -2
  82. data/lib/aspose-email-cloud/models/requests/save_email_model_request_data.rb +4 -4
  83. data/lib/aspose-email-cloud/models/requests/save_mapi_calendar_model_request_data.rb +99 -0
  84. data/lib/aspose-email-cloud/models/requests/save_mapi_contact_model_request_data.rb +99 -0
  85. data/lib/aspose-email-cloud/models/requests/save_mapi_message_model_request_data.rb +99 -0
  86. data/lib/aspose-email-cloud/models/send_email_base_request.rb +3 -3
  87. data/lib/aspose-email-cloud/models/send_email_model_rq.rb +3 -3
  88. data/lib/aspose-email-cloud/models/storage_model_rq_of_mapi_calendar_dto.rb +225 -0
  89. data/lib/aspose-email-cloud/models/storage_model_rq_of_mapi_contact_dto.rb +225 -0
  90. data/lib/aspose-email-cloud/models/storage_model_rq_of_mapi_message_dto.rb +225 -0
  91. data/lib/aspose-email-cloud/models/task_regenerating_pattern_dto.rb +314 -0
  92. data/lib/aspose-email-cloud/models/weekly_recurrence_pattern_dto.rb +311 -0
  93. data/lib/aspose-email-cloud/models/yearly_recurrence_pattern_dto.rb +368 -0
  94. data/lib/aspose-email-cloud/version.rb +1 -1
  95. metadata +76 -2
@@ -0,0 +1,452 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="MapiMessageItemBaseDto.rb">
3
+ # Copyright (c) 2018-2020 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
+ # Base Dto for MapiMessage, MapiCalendar or MapiContact
31
+ class MapiMessageItemBaseDto
32
+ # Message item attachments.
33
+ # @return [Array<MapiAttachmentDto>]
34
+ attr_accessor :attachments
35
+
36
+ # Billing information associated with an item.
37
+ # @return [String]
38
+ attr_accessor :billing
39
+
40
+ # Message text.
41
+ # @return [String]
42
+ attr_accessor :body
43
+
44
+ # Gets the BodyRtf of the message converted to HTML, if present, otherwise an empty string.
45
+ # @return [String]
46
+ attr_accessor :body_html
47
+
48
+ # RTF formatted message text.
49
+ # @return [String]
50
+ attr_accessor :body_rtf
51
+
52
+ # The content type of message body. Enum, available values: PlainText, Html, Rtf
53
+ # @return [String]
54
+ attr_accessor :body_type
55
+
56
+ # Contains keywords or categories for the message object.
57
+ # @return [Array<String>]
58
+ attr_accessor :categories
59
+
60
+ # Contains the names of the companies that are associated with an item.
61
+ # @return [Array<String>]
62
+ attr_accessor :companies
63
+
64
+ # The item id, uses with a server.
65
+ # @return [String]
66
+ attr_accessor :item_id
67
+
68
+ # Case-sensitive string that identifies the sender-defined message class, such as IPM.Note. The message class specifies the type, purpose, or content of the message.
69
+ # @return [String]
70
+ attr_accessor :message_class
71
+
72
+ # Contains the mileage information that is associated with an item.
73
+ # @return [String]
74
+ attr_accessor :mileage
75
+
76
+ # Recipients of the message.
77
+ # @return [Array<MapiRecipientDto>]
78
+ attr_accessor :recipients
79
+
80
+ # Contains values that indicate the message sensitivity. Enum, available values: None, Personal, Private, CompanyConfidential
81
+ # @return [String]
82
+ attr_accessor :sensitivity
83
+
84
+ # Subject of the message.
85
+ # @return [String]
86
+ attr_accessor :subject
87
+
88
+ # Subject prefix that typically indicates some action on a message, such as \"FW: \" for forwarding.
89
+ # @return [String]
90
+ attr_accessor :subject_prefix
91
+
92
+ # List of MAPI properties
93
+ # @return [Array<MapiPropertyDto>]
94
+ attr_accessor :properties
95
+
96
+
97
+ # @return [String]
98
+ def discriminator #getter method
99
+ self.class.name.split('::').last
100
+ end
101
+
102
+ def discriminator=(discriminator) #setter method, parameter ignored
103
+ @discriminator = self.class.name.split('::').last
104
+ end
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'attachments' => :'attachments',
110
+ :'billing' => :'billing',
111
+ :'body' => :'body',
112
+ :'body_html' => :'bodyHtml',
113
+ :'body_rtf' => :'bodyRtf',
114
+ :'body_type' => :'bodyType',
115
+ :'categories' => :'categories',
116
+ :'companies' => :'companies',
117
+ :'item_id' => :'itemId',
118
+ :'message_class' => :'messageClass',
119
+ :'mileage' => :'mileage',
120
+ :'recipients' => :'recipients',
121
+ :'sensitivity' => :'sensitivity',
122
+ :'subject' => :'subject',
123
+ :'subject_prefix' => :'subjectPrefix',
124
+ :'properties' => :'properties',
125
+ :'discriminator' => :'discriminator'
126
+ }
127
+ end
128
+
129
+ # Attribute type mapping.
130
+ def self.swagger_types
131
+ {
132
+ :'attachments' => :'Array<MapiAttachmentDto>',
133
+ :'billing' => :'String',
134
+ :'body' => :'String',
135
+ :'body_html' => :'String',
136
+ :'body_rtf' => :'String',
137
+ :'body_type' => :'String',
138
+ :'categories' => :'Array<String>',
139
+ :'companies' => :'Array<String>',
140
+ :'item_id' => :'String',
141
+ :'message_class' => :'String',
142
+ :'mileage' => :'String',
143
+ :'recipients' => :'Array<MapiRecipientDto>',
144
+ :'sensitivity' => :'String',
145
+ :'subject' => :'String',
146
+ :'subject_prefix' => :'String',
147
+ :'properties' => :'Array<MapiPropertyDto>',
148
+ :'discriminator' => :'String'
149
+ }
150
+ end
151
+
152
+ # Initializes the object
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ def initialize(attributes = {})
155
+ return unless attributes.is_a?(Hash)
156
+
157
+ # convert string to symbol for hash key
158
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
159
+
160
+ if attributes.has_key?(:'attachments')
161
+ if (value = attributes[:'attachments']).is_a?(Array)
162
+ self.attachments = value
163
+ end
164
+ end
165
+
166
+ if attributes.has_key?(:'billing')
167
+ self.billing = attributes[:'billing']
168
+ end
169
+
170
+ if attributes.has_key?(:'body')
171
+ self.body = attributes[:'body']
172
+ end
173
+
174
+ if attributes.has_key?(:'bodyHtml')
175
+ self.body_html = attributes[:'bodyHtml']
176
+ end
177
+
178
+ if attributes.has_key?(:'bodyRtf')
179
+ self.body_rtf = attributes[:'bodyRtf']
180
+ end
181
+
182
+ if attributes.has_key?(:'bodyType')
183
+ self.body_type = attributes[:'bodyType']
184
+ end
185
+
186
+ if attributes.has_key?(:'categories')
187
+ if (value = attributes[:'categories']).is_a?(Array)
188
+ self.categories = value
189
+ end
190
+ end
191
+
192
+ if attributes.has_key?(:'companies')
193
+ if (value = attributes[:'companies']).is_a?(Array)
194
+ self.companies = value
195
+ end
196
+ end
197
+
198
+ if attributes.has_key?(:'itemId')
199
+ self.item_id = attributes[:'itemId']
200
+ end
201
+
202
+ if attributes.has_key?(:'messageClass')
203
+ self.message_class = attributes[:'messageClass']
204
+ end
205
+
206
+ if attributes.has_key?(:'mileage')
207
+ self.mileage = attributes[:'mileage']
208
+ end
209
+
210
+ if attributes.has_key?(:'recipients')
211
+ if (value = attributes[:'recipients']).is_a?(Array)
212
+ self.recipients = value
213
+ end
214
+ end
215
+
216
+ if attributes.has_key?(:'sensitivity')
217
+ self.sensitivity = attributes[:'sensitivity']
218
+ end
219
+
220
+ if attributes.has_key?(:'subject')
221
+ self.subject = attributes[:'subject']
222
+ end
223
+
224
+ if attributes.has_key?(:'subjectPrefix')
225
+ self.subject_prefix = attributes[:'subjectPrefix']
226
+ end
227
+
228
+ if attributes.has_key?(:'properties')
229
+ if (value = attributes[:'properties']).is_a?(Array)
230
+ self.properties = value
231
+ end
232
+ end
233
+
234
+ if attributes.has_key?(:'discriminator')
235
+ @discriminator = self.class.name.split('::').last
236
+ end
237
+ end
238
+
239
+ # Initializes the object
240
+ # @param [Array<MapiAttachmentDto>] attachments Message item attachments.
241
+ # @param [String] billing Billing information associated with an item.
242
+ # @param [String] body Message text.
243
+ # @param [String] body_html Gets the BodyRtf of the message converted to HTML, if present, otherwise an empty string.
244
+ # @param [String] body_rtf RTF formatted message text.
245
+ # @param [String] body_type The content type of message body. Enum, available values: PlainText, Html, Rtf
246
+ # @param [Array<String>] categories Contains keywords or categories for the message object.
247
+ # @param [Array<String>] companies Contains the names of the companies that are associated with an item.
248
+ # @param [String] item_id The item id, uses with a server.
249
+ # @param [String] message_class Case-sensitive string that identifies the sender-defined message class, such as IPM.Note. The message class specifies the type, purpose, or content of the message.
250
+ # @param [String] mileage Contains the mileage information that is associated with an item.
251
+ # @param [Array<MapiRecipientDto>] recipients Recipients of the message.
252
+ # @param [String] sensitivity Contains values that indicate the message sensitivity. Enum, available values: None, Personal, Private, CompanyConfidential
253
+ # @param [String] subject Subject of the message.
254
+ # @param [String] subject_prefix Subject prefix that typically indicates some action on a message, such as \"FW: \" for forwarding.
255
+ # @param [Array<MapiPropertyDto>] properties List of MAPI properties
256
+ # @param [String] discriminator
257
+ def initialize(attachments=nil, billing=nil, body=nil, body_html=nil, body_rtf=nil, body_type=nil, categories=nil, companies=nil, item_id=nil, message_class=nil, mileage=nil, recipients=nil, sensitivity=nil, subject=nil, subject_prefix=nil, properties=nil, discriminator=nil)
258
+ self.attachments = attachments if attachments
259
+ self.billing = billing if billing
260
+ self.body = body if body
261
+ self.body_html = body_html if body_html
262
+ self.body_rtf = body_rtf if body_rtf
263
+ self.body_type = body_type if body_type
264
+ self.categories = categories if categories
265
+ self.companies = companies if companies
266
+ self.item_id = item_id if item_id
267
+ self.message_class = message_class if message_class
268
+ self.mileage = mileage if mileage
269
+ self.recipients = recipients if recipients
270
+ self.sensitivity = sensitivity if sensitivity
271
+ self.subject = subject if subject
272
+ self.subject_prefix = subject_prefix if subject_prefix
273
+ self.properties = properties if properties
274
+ @discriminator = self.class.name.split('::').last
275
+ end
276
+
277
+ # Show invalid properties with the reasons. Usually used together with valid?
278
+ # @return Array for valid properties with the reasons
279
+ def list_invalid_properties
280
+ invalid_properties = Array.new
281
+ if @body_type.nil?
282
+ invalid_properties.push('invalid value for "body_type", body_type cannot be nil.')
283
+ end
284
+
285
+ if @sensitivity.nil?
286
+ invalid_properties.push('invalid value for "sensitivity", sensitivity cannot be nil.')
287
+ end
288
+
289
+ if @discriminator.nil?
290
+ invalid_properties.push('invalid value for "discriminator", discriminator cannot be nil.')
291
+ end
292
+
293
+ invalid_properties
294
+ end
295
+
296
+ # Check to see if the all the properties in the model are valid
297
+ # @return true if the model is valid
298
+ def valid?
299
+ return false if @body_type.nil?
300
+ return false if @sensitivity.nil?
301
+ return false if @discriminator.nil?
302
+ true
303
+ end
304
+
305
+ # Checks equality by comparing each attribute.
306
+ # @param [Object] Object to be compared
307
+ def ==(o)
308
+ return true if self.equal?(o)
309
+ self.class == o.class &&
310
+ attachments == o.attachments &&
311
+ billing == o.billing &&
312
+ body == o.body &&
313
+ body_html == o.body_html &&
314
+ body_rtf == o.body_rtf &&
315
+ body_type == o.body_type &&
316
+ categories == o.categories &&
317
+ companies == o.companies &&
318
+ item_id == o.item_id &&
319
+ message_class == o.message_class &&
320
+ mileage == o.mileage &&
321
+ recipients == o.recipients &&
322
+ sensitivity == o.sensitivity &&
323
+ subject == o.subject &&
324
+ subject_prefix == o.subject_prefix &&
325
+ properties == o.properties &&
326
+ discriminator == o.discriminator
327
+ end
328
+
329
+ # @see the `==` method
330
+ # @param [Object] Object to be compared
331
+ def eql?(o)
332
+ self == o
333
+ end
334
+
335
+ # Calculates hash code according to all attributes.
336
+ # @return [Fixnum] Hash code
337
+ def hash
338
+ [attachments, billing, body, body_html, body_rtf, body_type, categories, companies, item_id, message_class, mileage, recipients, sensitivity, subject, subject_prefix, properties, discriminator].hash
339
+ end
340
+
341
+ # Builds the object from hash
342
+ # @param [Hash] attributes Model attributes in the form of hash
343
+ # @return [Object] Returns the model itself
344
+ def build_from_hash(attributes)
345
+ return nil unless attributes.is_a?(Hash)
346
+ self.class.swagger_types.each_pair do |key, type|
347
+ attribute_key = self.class.attribute_map[key]
348
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
349
+ if type =~ /\AArray<(.*)>/i
350
+ # check to ensure the input is an array given that the the attribute
351
+ # is documented as an array but the input is not
352
+ if attributes[attribute_key].is_a?(Array)
353
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
354
+ end
355
+ elsif !attributes[attribute_key].nil?
356
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
357
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
358
+ end
359
+
360
+ self
361
+ end
362
+
363
+ # Deserializes the data based on type
364
+ # @param string type Data type
365
+ # @param string value Value to be deserialized
366
+ # @return [Object] Deserialized data
367
+ def _deserialize(type, value)
368
+ case type.to_sym
369
+ when :DateTime
370
+ DateTime.parse(value)
371
+ when :Date
372
+ Date.parse(value)
373
+ when :String
374
+ value.to_s
375
+ when :Integer
376
+ value.to_i
377
+ when :Float
378
+ value.to_f
379
+ when :BOOLEAN
380
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
381
+ true
382
+ else
383
+ false
384
+ end
385
+ when :Object
386
+ # generic object (usually a Hash), return directly
387
+ value
388
+ when /\AArray<(?<inner_type>.+)>\z/
389
+ inner_type = Regexp.last_match[:inner_type]
390
+ value.map { |v| _deserialize(inner_type, v) }
391
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
392
+ k_type = Regexp.last_match[:k_type]
393
+ v_type = Regexp.last_match[:v_type]
394
+ {}.tap do |hash|
395
+ value.each do |k, v|
396
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
397
+ end
398
+ end
399
+ else # model
400
+ sub_type = value[:type] || value[:discriminator] || type
401
+ if AsposeEmailCloud.const_defined?(sub_type)
402
+ type = sub_type
403
+ end
404
+ temp_model = AsposeEmailCloud.const_get(type).new
405
+ temp_model.build_from_hash(value)
406
+ end
407
+ end
408
+
409
+ # Returns the string representation of the object
410
+ # @return [String] String presentation of the object
411
+ def to_s
412
+ to_hash.to_s
413
+ end
414
+
415
+ # to_body is an alias to to_hash (backward compatibility)
416
+ # @return [Hash] Returns the object in the form of hash
417
+ def to_body
418
+ to_hash
419
+ end
420
+
421
+ # Returns the object in the form of hash
422
+ # @return [Hash] Returns the object in the form of hash
423
+ def to_hash
424
+ hash = {}
425
+ self.class.attribute_map.each_pair do |attr, param|
426
+ value = self.send(attr)
427
+ next if value.nil?
428
+ hash[param] = _to_hash(value)
429
+ end
430
+ hash
431
+ end
432
+
433
+ # Outputs non-array value in the form of hash
434
+ # For object, use to_hash. Otherwise, just return the value
435
+ # @param [Object] value Any valid value
436
+ # @return [Hash] Returns the value in the form of hash
437
+ def _to_hash(value)
438
+ if value.is_a?(Array)
439
+ value.compact.map { |v| _to_hash(v) }
440
+ elsif value.is_a?(Hash)
441
+ {}.tap do |hash|
442
+ value.each { |k, v| hash[k] = _to_hash(v) }
443
+ end
444
+ elsif value.respond_to? :to_hash
445
+ value.to_hash
446
+ else
447
+ value
448
+ end
449
+ end
450
+
451
+ end
452
+ end
@@ -0,0 +1,252 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="MapiMultiIntPropertyDto.rb">
3
+ # Copyright (c) 2018-2020 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
+ # Mapi property with Multiple Integer values
31
+ class MapiMultiIntPropertyDto
32
+ # Property descriptor
33
+ # @return [MapiPropertyDescriptor]
34
+ attr_accessor :descriptor
35
+
36
+
37
+ # @return [String]
38
+ def discriminator #getter method
39
+ self.class.name.split('::').last
40
+ end
41
+
42
+ def discriminator=(discriminator) #setter method, parameter ignored
43
+ @discriminator = self.class.name.split('::').last
44
+ end
45
+
46
+ # Property values
47
+ # @return [Array<Integer>]
48
+ attr_accessor :values
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'descriptor' => :'descriptor',
54
+ :'discriminator' => :'discriminator',
55
+ :'values' => :'values'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'descriptor' => :'MapiPropertyDescriptor',
63
+ :'discriminator' => :'String',
64
+ :'values' => :'Array<Integer>'
65
+ }
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ return unless attributes.is_a?(Hash)
72
+
73
+ # convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
75
+
76
+ if attributes.has_key?(:'descriptor')
77
+ self.descriptor = attributes[:'descriptor']
78
+ end
79
+
80
+ if attributes.has_key?(:'discriminator')
81
+ @discriminator = self.class.name.split('::').last
82
+ end
83
+
84
+ if attributes.has_key?(:'values')
85
+ if (value = attributes[:'values']).is_a?(Array)
86
+ self.values = value
87
+ end
88
+ end
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [MapiPropertyDescriptor] descriptor Property descriptor
93
+ # @param [String] discriminator
94
+ # @param [Array<Integer>] values Property values
95
+ def initialize(descriptor=nil, discriminator=nil, values=nil)
96
+ self.descriptor = descriptor if descriptor
97
+ @discriminator = self.class.name.split('::').last
98
+ self.values = values if values
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if @discriminator.nil?
106
+ invalid_properties.push('invalid value for "discriminator", discriminator cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ return false if @discriminator.nil?
116
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ descriptor == o.descriptor &&
125
+ discriminator == o.discriminator &&
126
+ values == o.values
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Fixnum] Hash code
137
+ def hash
138
+ [descriptor, discriminator, values].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.swagger_types.each_pair do |key, type|
147
+ attribute_key = self.class.attribute_map[key]
148
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[attribute_key].is_a?(Array)
153
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[attribute_key].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
157
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :BOOLEAN
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ sub_type = value[:type] || value[:discriminator] || type
201
+ if AsposeEmailCloud.const_defined?(sub_type)
202
+ type = sub_type
203
+ end
204
+ temp_model = AsposeEmailCloud.const_get(type).new
205
+ temp_model.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ next if value.nil?
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+ end