aspose_email_cloud 20.2.0 → 20.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aspose-email-cloud.rb +13 -0
  3. data/lib/aspose-email-cloud/api/email_api.rb +921 -879
  4. data/lib/aspose-email-cloud/api_client.rb +386 -382
  5. data/lib/aspose-email-cloud/api_error.rb +41 -41
  6. data/lib/aspose-email-cloud/configuration.rb +240 -240
  7. data/lib/aspose-email-cloud/models/account_base_request.rb +263 -260
  8. data/lib/aspose-email-cloud/models/add_attachment_request.rb +226 -223
  9. data/lib/aspose-email-cloud/models/ai_bcr_base64_image.rb +231 -228
  10. data/lib/aspose-email-cloud/models/ai_bcr_base64_rq.rb +228 -225
  11. data/lib/aspose-email-cloud/models/ai_bcr_image.rb +218 -215
  12. data/lib/aspose-email-cloud/models/ai_bcr_image_storage_file.rb +231 -228
  13. data/lib/aspose-email-cloud/models/ai_bcr_ocr_data.rb +256 -253
  14. data/lib/aspose-email-cloud/models/ai_bcr_ocr_data_part.rb +300 -297
  15. data/lib/aspose-email-cloud/models/ai_bcr_options.rb +226 -223
  16. data/lib/aspose-email-cloud/models/ai_bcr_parse_ocr_data_rq.rb +233 -230
  17. data/lib/aspose-email-cloud/models/ai_bcr_parse_storage_rq.rb +251 -248
  18. data/lib/aspose-email-cloud/models/ai_bcr_rq.rb +213 -210
  19. data/lib/aspose-email-cloud/models/ai_bcr_storage_image_rq.rb +233 -230
  20. data/lib/aspose-email-cloud/models/ai_name_component.rb +267 -264
  21. data/lib/aspose-email-cloud/models/ai_name_cultural_context.rb +270 -267
  22. data/lib/aspose-email-cloud/models/ai_name_extracted.rb +233 -230
  23. data/lib/aspose-email-cloud/models/ai_name_extracted_component.rb +231 -228
  24. data/lib/aspose-email-cloud/models/ai_name_formatted.rb +226 -223
  25. data/lib/aspose-email-cloud/models/ai_name_gender_hypothesis.rb +236 -233
  26. data/lib/aspose-email-cloud/models/ai_name_match_result.rb +233 -230
  27. data/lib/aspose-email-cloud/models/ai_name_mismatch.rb +249 -246
  28. data/lib/aspose-email-cloud/models/ai_name_parsed_match_rq.rb +266 -263
  29. data/lib/aspose-email-cloud/models/ai_name_parsed_rq.rb +246 -243
  30. data/lib/aspose-email-cloud/models/ai_name_weighted.rb +231 -228
  31. data/lib/aspose-email-cloud/models/ai_name_weighted_variants.rb +228 -225
  32. data/lib/aspose-email-cloud/models/alternate_view.rb +282 -279
  33. data/lib/aspose-email-cloud/models/append_email_account_base_request.rb +318 -315
  34. data/lib/aspose-email-cloud/models/append_email_base_request.rb +336 -333
  35. data/lib/aspose-email-cloud/models/append_email_mime_base_request.rb +355 -352
  36. data/lib/aspose-email-cloud/models/append_email_model_rq.rb +336 -333
  37. data/lib/aspose-email-cloud/models/associated_person.rb +244 -241
  38. data/lib/aspose-email-cloud/models/attachment.rb +324 -321
  39. data/lib/aspose-email-cloud/models/attachment_base.rb +254 -251
  40. data/lib/aspose-email-cloud/models/base_object.rb +5 -2
  41. data/lib/aspose-email-cloud/models/calendar_dto.rb +557 -554
  42. data/lib/aspose-email-cloud/models/calendar_dto_alternate_rq.rb +268 -265
  43. data/lib/aspose-email-cloud/models/calendar_dto_list.rb +215 -212
  44. data/lib/aspose-email-cloud/models/calendar_reminder.rb +318 -315
  45. data/lib/aspose-email-cloud/models/contact_dto.rb +699 -696
  46. data/lib/aspose-email-cloud/models/contact_dto_list.rb +215 -212
  47. data/lib/aspose-email-cloud/models/contact_photo.rb +231 -228
  48. data/lib/aspose-email-cloud/models/content_type.rb +267 -264
  49. data/lib/aspose-email-cloud/models/content_type_parameter.rb +226 -223
  50. data/lib/aspose-email-cloud/models/create_email_request.rb +231 -228
  51. data/lib/aspose-email-cloud/models/create_folder_base_request.rb +313 -310
  52. data/lib/aspose-email-cloud/models/customer_event.rb +231 -228
  53. data/lib/aspose-email-cloud/models/delete_folder_base_request.rb +318 -315
  54. data/lib/aspose-email-cloud/models/delete_message_base_request.rb +318 -315
  55. data/lib/aspose-email-cloud/models/disc_usage.rb +236 -233
  56. data/lib/aspose-email-cloud/models/discover_email_config_oauth.rb +391 -388
  57. data/lib/aspose-email-cloud/models/discover_email_config_password.rb +304 -301
  58. data/lib/aspose-email-cloud/models/discover_email_config_rq.rb +268 -265
  59. data/lib/aspose-email-cloud/models/email_account_config.rb +323 -320
  60. data/lib/aspose-email-cloud/models/email_account_config_list.rb +215 -212
  61. data/lib/aspose-email-cloud/models/email_account_request.rb +397 -394
  62. data/lib/aspose-email-cloud/models/email_address.rb +270 -267
  63. data/lib/aspose-email-cloud/models/email_client_account.rb +337 -0
  64. data/lib/aspose-email-cloud/models/email_client_account_credentials.rb +261 -0
  65. data/lib/aspose-email-cloud/models/email_client_account_oauth_credentials.rb +385 -0
  66. data/lib/aspose-email-cloud/models/email_client_account_password_credentials.rb +298 -0
  67. data/lib/aspose-email-cloud/models/email_client_multi_account.rb +233 -0
  68. data/lib/aspose-email-cloud/models/email_document.rb +233 -230
  69. data/lib/aspose-email-cloud/models/email_document_response.rb +213 -210
  70. data/lib/aspose-email-cloud/models/email_dto.rb +681 -678
  71. data/lib/aspose-email-cloud/models/email_dto_list.rb +215 -212
  72. data/lib/aspose-email-cloud/models/email_properties.rb +233 -230
  73. data/lib/aspose-email-cloud/models/email_property.rb +268 -265
  74. data/lib/aspose-email-cloud/models/email_property_response.rb +213 -210
  75. data/lib/aspose-email-cloud/models/enum_with_custom_of_associated_person_category.rb +230 -227
  76. data/lib/aspose-email-cloud/models/enum_with_custom_of_email_address_category.rb +230 -227
  77. data/lib/aspose-email-cloud/models/enum_with_custom_of_event_category.rb +230 -227
  78. data/lib/aspose-email-cloud/models/enum_with_custom_of_instant_messenger_category.rb +230 -227
  79. data/lib/aspose-email-cloud/models/enum_with_custom_of_phone_number_category.rb +230 -227
  80. data/lib/aspose-email-cloud/models/enum_with_custom_of_postal_address_category.rb +230 -227
  81. data/lib/aspose-email-cloud/models/enum_with_custom_of_url_category.rb +230 -227
  82. data/lib/aspose-email-cloud/models/error.rb +252 -249
  83. data/lib/aspose-email-cloud/models/error_details.rb +231 -228
  84. data/lib/aspose-email-cloud/models/file_version.rb +306 -303
  85. data/lib/aspose-email-cloud/models/file_versions.rb +215 -212
  86. data/lib/aspose-email-cloud/models/files_list.rb +215 -212
  87. data/lib/aspose-email-cloud/models/files_upload_result.rb +230 -227
  88. data/lib/aspose-email-cloud/models/hierarchical_object.rb +5 -2
  89. data/lib/aspose-email-cloud/models/hierarchical_object_request.rb +231 -228
  90. data/lib/aspose-email-cloud/models/hierarchical_object_response.rb +226 -223
  91. data/lib/aspose-email-cloud/models/indexed_hierarchical_object.rb +5 -2
  92. data/lib/aspose-email-cloud/models/indexed_primitive_object.rb +5 -2
  93. data/lib/aspose-email-cloud/models/instant_messenger_address.rb +244 -241
  94. data/lib/aspose-email-cloud/models/link.rb +252 -249
  95. data/lib/aspose-email-cloud/models/linked_resource.rb +267 -264
  96. data/lib/aspose-email-cloud/models/list_response_of_ai_bcr_ocr_data.rb +214 -211
  97. data/lib/aspose-email-cloud/models/list_response_of_ai_name_component.rb +214 -211
  98. data/lib/aspose-email-cloud/models/list_response_of_ai_name_extracted.rb +214 -211
  99. data/lib/aspose-email-cloud/models/list_response_of_ai_name_gender_hypothesis.rb +214 -211
  100. data/lib/aspose-email-cloud/models/list_response_of_contact_dto.rb +214 -211
  101. data/lib/aspose-email-cloud/models/list_response_of_email_account_config.rb +214 -211
  102. data/lib/aspose-email-cloud/models/list_response_of_email_dto.rb +214 -211
  103. data/lib/aspose-email-cloud/models/list_response_of_hierarchical_object.rb +214 -211
  104. data/lib/aspose-email-cloud/models/list_response_of_hierarchical_object_response.rb +214 -211
  105. data/lib/aspose-email-cloud/models/list_response_of_mail_server_folder.rb +214 -211
  106. data/lib/aspose-email-cloud/models/list_response_of_storage_file_location.rb +214 -211
  107. data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_calendar_dto.rb +214 -211
  108. data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_contact_dto.rb +214 -211
  109. data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_email_dto.rb +214 -211
  110. data/lib/aspose-email-cloud/models/list_response_of_string.rb +214 -211
  111. data/lib/aspose-email-cloud/models/mail_address.rb +244 -241
  112. data/lib/aspose-email-cloud/models/mail_server_folder.rb +226 -223
  113. data/lib/aspose-email-cloud/models/mime_response.rb +213 -210
  114. data/lib/aspose-email-cloud/models/name_value_pair.rb +226 -222
  115. data/lib/aspose-email-cloud/models/object_exist.rb +236 -233
  116. data/lib/aspose-email-cloud/models/phone_number.rb +244 -241
  117. data/lib/aspose-email-cloud/models/postal_address.rb +353 -350
  118. data/lib/aspose-email-cloud/models/primitive_object.rb +5 -2
  119. data/lib/aspose-email-cloud/models/reminder_attendee.rb +213 -210
  120. data/lib/aspose-email-cloud/models/reminder_trigger.rb +249 -246
  121. data/lib/aspose-email-cloud/models/requests/add_calendar_attachment_request_data.rb +99 -99
  122. data/lib/aspose-email-cloud/models/requests/add_contact_attachment_request_data.rb +109 -109
  123. data/lib/aspose-email-cloud/models/requests/add_email_attachment_request_data.rb +99 -99
  124. data/lib/aspose-email-cloud/models/requests/add_mapi_attachment_request_data.rb +99 -99
  125. data/lib/aspose-email-cloud/models/requests/ai_bcr_ocr_request_data.rb +79 -79
  126. data/lib/aspose-email-cloud/models/requests/ai_bcr_ocr_storage_request_data.rb +79 -79
  127. data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_model_request_data.rb +79 -79
  128. data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_ocr_data_model_request_data.rb +79 -79
  129. data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_request_data.rb +79 -79
  130. data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_storage_request_data.rb +79 -79
  131. data/lib/aspose-email-cloud/models/requests/ai_name_complete_request_data.rb +110 -110
  132. data/lib/aspose-email-cloud/models/requests/ai_name_expand_parsed_request_data.rb +79 -79
  133. data/lib/aspose-email-cloud/models/requests/ai_name_expand_request_data.rb +110 -110
  134. data/lib/aspose-email-cloud/models/requests/ai_name_format_parsed_request_data.rb +79 -79
  135. data/lib/aspose-email-cloud/models/requests/ai_name_format_request_data.rb +116 -116
  136. data/lib/aspose-email-cloud/models/requests/ai_name_genderize_parsed_request_data.rb +79 -79
  137. data/lib/aspose-email-cloud/models/requests/ai_name_genderize_request_data.rb +110 -110
  138. data/lib/aspose-email-cloud/models/requests/ai_name_match_parsed_request_data.rb +79 -79
  139. data/lib/aspose-email-cloud/models/requests/ai_name_match_request_data.rb +121 -121
  140. data/lib/aspose-email-cloud/models/requests/ai_name_parse_email_address_request_data.rb +110 -110
  141. data/lib/aspose-email-cloud/models/requests/ai_name_parse_request_data.rb +110 -110
  142. data/lib/aspose-email-cloud/models/requests/append_email_message_request_data.rb +79 -79
  143. data/lib/aspose-email-cloud/models/requests/append_email_model_message_request_data.rb +79 -79
  144. data/lib/aspose-email-cloud/models/requests/append_mime_message_request_data.rb +79 -79
  145. data/lib/aspose-email-cloud/models/requests/convert_calendar_model_to_alternate_request_data.rb +79 -79
  146. data/lib/aspose-email-cloud/models/requests/convert_email_request_data.rb +90 -90
  147. data/lib/aspose-email-cloud/models/requests/copy_file_request_data.rb +108 -108
  148. data/lib/aspose-email-cloud/models/requests/copy_folder_request_data.rb +102 -102
  149. data/lib/aspose-email-cloud/models/requests/create_calendar_request_data.rb +89 -89
  150. data/lib/aspose-email-cloud/models/requests/create_contact_request_data.rb +99 -99
  151. data/lib/aspose-email-cloud/models/requests/create_email_folder_request_data.rb +79 -79
  152. data/lib/aspose-email-cloud/models/requests/create_email_request_data.rb +89 -89
  153. data/lib/aspose-email-cloud/models/requests/create_folder_request_data.rb +85 -85
  154. data/lib/aspose-email-cloud/models/requests/create_mapi_request_data.rb +89 -89
  155. data/lib/aspose-email-cloud/models/requests/delete_calendar_property_request_data.rb +109 -109
  156. data/lib/aspose-email-cloud/models/requests/delete_contact_property_request_data.rb +119 -119
  157. data/lib/aspose-email-cloud/models/requests/delete_email_folder_request_data.rb +79 -79
  158. data/lib/aspose-email-cloud/models/requests/delete_email_message_request_data.rb +79 -79
  159. data/lib/aspose-email-cloud/models/requests/delete_file_request_data.rb +91 -91
  160. data/lib/aspose-email-cloud/models/requests/delete_folder_request_data.rb +91 -91
  161. data/lib/aspose-email-cloud/models/requests/delete_mapi_attachment_request_data.rb +99 -99
  162. data/lib/aspose-email-cloud/models/requests/delete_mapi_properties_request_data.rb +89 -89
  163. data/lib/aspose-email-cloud/models/requests/discover_email_config_oauth_request_data.rb +79 -79
  164. data/lib/aspose-email-cloud/models/requests/discover_email_config_password_request_data.rb +79 -79
  165. data/lib/aspose-email-cloud/models/requests/discover_email_config_request_data.rb +86 -86
  166. data/lib/aspose-email-cloud/models/requests/download_file_request_data.rb +91 -91
  167. data/lib/aspose-email-cloud/models/requests/email_request.rb +75 -75
  168. data/lib/aspose-email-cloud/models/requests/fetch_email_message_request_data.rb +109 -109
  169. data/lib/aspose-email-cloud/models/requests/fetch_email_model_request_data.rb +109 -109
  170. data/lib/aspose-email-cloud/models/requests/get_calendar_attachment_request_data.rb +101 -101
  171. data/lib/aspose-email-cloud/models/requests/get_calendar_list_request_data.rb +108 -108
  172. data/lib/aspose-email-cloud/models/requests/get_calendar_model_as_alternate_request_data.rb +107 -107
  173. data/lib/aspose-email-cloud/models/requests/get_calendar_model_list_request_data.rb +98 -98
  174. data/lib/aspose-email-cloud/models/requests/get_calendar_model_request_data.rb +91 -91
  175. data/lib/aspose-email-cloud/models/requests/get_calendar_request_data.rb +91 -91
  176. data/lib/aspose-email-cloud/models/requests/get_contact_attachment_request_data.rb +111 -111
  177. data/lib/aspose-email-cloud/models/requests/get_contact_list_request_data.rb +103 -103
  178. data/lib/aspose-email-cloud/models/requests/get_contact_model_list_request_data.rb +103 -103
  179. data/lib/aspose-email-cloud/models/requests/get_contact_model_request_data.rb +101 -101
  180. data/lib/aspose-email-cloud/models/requests/get_contact_properties_request_data.rb +101 -101
  181. data/lib/aspose-email-cloud/models/requests/get_disc_usage_request_data.rb +75 -75
  182. data/lib/aspose-email-cloud/models/requests/get_email_as_file_request_data.rb +101 -101
  183. data/lib/aspose-email-cloud/models/requests/get_email_attachment_request_data.rb +101 -101
  184. data/lib/aspose-email-cloud/models/requests/get_email_client_account_request_data.rb +102 -0
  185. data/lib/aspose-email-cloud/models/requests/get_email_client_multi_account_request_data.rb +102 -0
  186. data/lib/aspose-email-cloud/models/requests/get_email_model_list_request_data.rb +103 -103
  187. data/lib/aspose-email-cloud/models/requests/get_email_model_request_data.rb +101 -101
  188. data/lib/aspose-email-cloud/models/requests/get_email_property_request_data.rb +101 -101
  189. data/lib/aspose-email-cloud/models/requests/get_email_request_data.rb +91 -91
  190. data/lib/aspose-email-cloud/models/requests/get_file_versions_request_data.rb +85 -85
  191. data/lib/aspose-email-cloud/models/requests/get_files_list_request_data.rb +85 -85
  192. data/lib/aspose-email-cloud/models/requests/get_mapi_attachment_request_data.rb +101 -101
  193. data/lib/aspose-email-cloud/models/requests/get_mapi_attachments_request_data.rb +91 -91
  194. data/lib/aspose-email-cloud/models/requests/get_mapi_list_request_data.rb +93 -93
  195. data/lib/aspose-email-cloud/models/requests/get_mapi_properties_request_data.rb +91 -91
  196. data/lib/aspose-email-cloud/models/requests/http_request.rb +51 -51
  197. data/lib/aspose-email-cloud/models/requests/is_email_address_disposable_request_data.rb +79 -0
  198. data/lib/aspose-email-cloud/models/requests/list_email_folders_request_data.rb +104 -104
  199. data/lib/aspose-email-cloud/models/requests/list_email_messages_request_data.rb +127 -127
  200. data/lib/aspose-email-cloud/models/requests/list_email_models_request_data.rb +127 -127
  201. data/lib/aspose-email-cloud/models/requests/move_file_request_data.rb +108 -108
  202. data/lib/aspose-email-cloud/models/requests/move_folder_request_data.rb +102 -102
  203. data/lib/aspose-email-cloud/models/requests/object_exists_request_data.rb +91 -91
  204. data/lib/aspose-email-cloud/models/requests/save_calendar_model_request_data.rb +89 -89
  205. data/lib/aspose-email-cloud/models/requests/save_contact_model_request_data.rb +99 -99
  206. data/lib/aspose-email-cloud/models/requests/save_email_client_account_request_data.rb +79 -0
  207. data/lib/aspose-email-cloud/models/requests/save_email_client_multi_account_request_data.rb +79 -0
  208. data/lib/aspose-email-cloud/models/requests/save_email_model_request_data.rb +99 -99
  209. data/lib/aspose-email-cloud/models/requests/save_mail_account_request_data.rb +79 -79
  210. data/lib/aspose-email-cloud/models/requests/save_mail_o_auth_account_request_data.rb +79 -79
  211. data/lib/aspose-email-cloud/models/requests/send_email_mime_request_data.rb +79 -79
  212. data/lib/aspose-email-cloud/models/requests/send_email_model_request_data.rb +79 -79
  213. data/lib/aspose-email-cloud/models/requests/send_email_request_data.rb +79 -79
  214. data/lib/aspose-email-cloud/models/requests/set_email_property_request_data.rb +99 -99
  215. data/lib/aspose-email-cloud/models/requests/set_email_read_flag_request_data.rb +79 -79
  216. data/lib/aspose-email-cloud/models/requests/storage_exists_request_data.rb +79 -79
  217. data/lib/aspose-email-cloud/models/requests/update_calendar_properties_request_data.rb +89 -89
  218. data/lib/aspose-email-cloud/models/requests/update_contact_properties_request_data.rb +99 -99
  219. data/lib/aspose-email-cloud/models/requests/update_mapi_properties_request_data.rb +89 -89
  220. data/lib/aspose-email-cloud/models/requests/upload_file_request_data.rb +97 -97
  221. data/lib/aspose-email-cloud/models/save_email_account_request.rb +434 -431
  222. data/lib/aspose-email-cloud/models/save_o_auth_email_account_request.rb +521 -505
  223. data/lib/aspose-email-cloud/models/send_email_base_request.rb +281 -278
  224. data/lib/aspose-email-cloud/models/send_email_mime_base_request.rb +300 -297
  225. data/lib/aspose-email-cloud/models/send_email_model_rq.rb +276 -273
  226. data/lib/aspose-email-cloud/models/set_email_property_request.rb +231 -228
  227. data/lib/aspose-email-cloud/models/set_message_read_flag_account_base_request.rb +318 -315
  228. data/lib/aspose-email-cloud/models/storage_exist.rb +218 -215
  229. data/lib/aspose-email-cloud/models/storage_file.rb +275 -272
  230. data/lib/aspose-email-cloud/models/storage_file_location.rb +263 -260
  231. data/lib/aspose-email-cloud/models/storage_file_rq_of_email_client_account.rb +225 -0
  232. data/lib/aspose-email-cloud/models/storage_file_rq_of_email_client_multi_account.rb +225 -0
  233. data/lib/aspose-email-cloud/models/storage_folder_location.rb +226 -223
  234. data/lib/aspose-email-cloud/models/storage_model_of_calendar_dto.rb +225 -222
  235. data/lib/aspose-email-cloud/models/storage_model_of_contact_dto.rb +225 -222
  236. data/lib/aspose-email-cloud/models/storage_model_of_email_dto.rb +225 -222
  237. data/lib/aspose-email-cloud/models/storage_model_rq_of_calendar_dto.rb +225 -222
  238. data/lib/aspose-email-cloud/models/storage_model_rq_of_contact_dto.rb +225 -222
  239. data/lib/aspose-email-cloud/models/storage_model_rq_of_email_dto.rb +225 -222
  240. data/lib/aspose-email-cloud/models/url.rb +244 -241
  241. data/lib/aspose-email-cloud/models/value_response.rb +213 -210
  242. data/lib/aspose-email-cloud/models/value_t_of_boolean.rb +217 -0
  243. data/lib/aspose-email-cloud/version.rb +1 -1
  244. metadata +15 -2
@@ -1,388 +1,391 @@
1
- # ----------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="DiscoverEmailConfigOauth.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
- class DiscoverEmailConfigOauth
31
- # Email address to discover.
32
- # @return [String]
33
- attr_accessor :address
34
-
35
- # Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.
36
- # @return [BOOLEAN]
37
- attr_accessor :fast_processing
38
-
39
- # Email account login. If not specified, address used as a login.
40
- # @return [String]
41
- attr_accessor :login
42
-
43
- # OAuth client id.
44
- # @return [String]
45
- attr_accessor :client_id
46
-
47
- # OAuth client secret.
48
- # @return [String]
49
- attr_accessor :client_secret
50
-
51
- # OAuth refresh token.
52
- # @return [String]
53
- attr_accessor :refresh_token
54
-
55
- # The url to obtain access token. If not specified, will be discovered from email configuration.
56
- # @return [String]
57
- attr_accessor :request_url
58
-
59
- # Attribute mapping from ruby-style variable name to JSON key.
60
- def self.attribute_map
61
- {
62
- :'address' => :'address',
63
- :'fast_processing' => :'fastProcessing',
64
- :'login' => :'login',
65
- :'client_id' => :'clientId',
66
- :'client_secret' => :'clientSecret',
67
- :'refresh_token' => :'refreshToken',
68
- :'request_url' => :'requestUrl'
69
- }
70
- end
71
-
72
- # Attribute type mapping.
73
- def self.swagger_types
74
- {
75
- :'address' => :'String',
76
- :'fast_processing' => :'BOOLEAN',
77
- :'login' => :'String',
78
- :'client_id' => :'String',
79
- :'client_secret' => :'String',
80
- :'refresh_token' => :'String',
81
- :'request_url' => :'String'
82
- }
83
- end
84
-
85
- # Initializes the object
86
- # @param [Hash] attributes Model attributes in the form of hash
87
- def initialize(attributes = {})
88
- return unless attributes.is_a?(Hash)
89
-
90
- # convert string to symbol for hash key
91
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
92
-
93
- if attributes.has_key?(:'address')
94
- self.address = attributes[:'address']
95
- end
96
-
97
- if attributes.has_key?(:'fastProcessing')
98
- self.fast_processing = attributes[:'fastProcessing']
99
- end
100
-
101
- if attributes.has_key?(:'login')
102
- self.login = attributes[:'login']
103
- end
104
-
105
- if attributes.has_key?(:'clientId')
106
- self.client_id = attributes[:'clientId']
107
- end
108
-
109
- if attributes.has_key?(:'clientSecret')
110
- self.client_secret = attributes[:'clientSecret']
111
- end
112
-
113
- if attributes.has_key?(:'refreshToken')
114
- self.refresh_token = attributes[:'refreshToken']
115
- end
116
-
117
- if attributes.has_key?(:'requestUrl')
118
- self.request_url = attributes[:'requestUrl']
119
- end
120
- end
121
-
122
- # Initializes the object
123
- # @param [String] address Email address to discover.
124
- # @param [BOOLEAN] fast_processing Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.
125
- # @param [String] login Email account login. If not specified, address used as a login.
126
- # @param [String] client_id OAuth client id.
127
- # @param [String] client_secret OAuth client secret.
128
- # @param [String] refresh_token OAuth refresh token.
129
- # @param [String] request_url The url to obtain access token. If not specified, will be discovered from email configuration.
130
- def initialize(address=nil, fast_processing=nil, login=nil, client_id=nil, client_secret=nil, refresh_token=nil, request_url=nil)
131
- self.address = address if address
132
- self.fast_processing = fast_processing if fast_processing
133
- self.login = login if login
134
- self.client_id = client_id if client_id
135
- self.client_secret = client_secret if client_secret
136
- self.refresh_token = refresh_token if refresh_token
137
- self.request_url = request_url if request_url
138
- end
139
-
140
- # Show invalid properties with the reasons. Usually used together with valid?
141
- # @return Array for valid properties with the reasons
142
- def list_invalid_properties
143
- invalid_properties = Array.new
144
- if @address.nil?
145
- invalid_properties.push('invalid value for "address", address cannot be nil.')
146
- end
147
-
148
- if @address.to_s.length < 1
149
- invalid_properties.push('invalid value for "address", the character length must be great than or equal to 1.')
150
- end
151
-
152
- if @fast_processing.nil?
153
- invalid_properties.push('invalid value for "fast_processing", fast_processing cannot be nil.')
154
- end
155
-
156
- if @client_id.nil?
157
- invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
158
- end
159
-
160
- if @client_id.to_s.length < 1
161
- invalid_properties.push('invalid value for "client_id", the character length must be great than or equal to 1.')
162
- end
163
-
164
- if @client_secret.nil?
165
- invalid_properties.push('invalid value for "client_secret", client_secret cannot be nil.')
166
- end
167
-
168
- if @client_secret.to_s.length < 1
169
- invalid_properties.push('invalid value for "client_secret", the character length must be great than or equal to 1.')
170
- end
171
-
172
- if @refresh_token.nil?
173
- invalid_properties.push('invalid value for "refresh_token", refresh_token cannot be nil.')
174
- end
175
-
176
- if @refresh_token.to_s.length < 1
177
- invalid_properties.push('invalid value for "refresh_token", the character length must be great than or equal to 1.')
178
- end
179
-
180
- invalid_properties
181
- end
182
-
183
- # Check to see if the all the properties in the model are valid
184
- # @return true if the model is valid
185
- def valid?
186
- return false if @address.nil?
187
- return false if @address.to_s.length < 1
188
- return false if @fast_processing.nil?
189
- return false if @client_id.nil?
190
- return false if @client_id.to_s.length < 1
191
- return false if @client_secret.nil?
192
- return false if @client_secret.to_s.length < 1
193
- return false if @refresh_token.nil?
194
- return false if @refresh_token.to_s.length < 1
195
- true
196
- end
197
-
198
- # Custom attribute writer method with validation
199
- # @param [Object] address Value to be assigned
200
- def address=(address)
201
- if address.nil?
202
- fail ArgumentError, 'address cannot be nil'
203
- end
204
-
205
- if address.to_s.length < 1
206
- fail ArgumentError, 'invalid value for "address", the character length must be great than or equal to 1.'
207
- end
208
-
209
- @address = address
210
- end
211
-
212
- # Custom attribute writer method with validation
213
- # @param [Object] client_id Value to be assigned
214
- def client_id=(client_id)
215
- if client_id.nil?
216
- fail ArgumentError, 'client_id cannot be nil'
217
- end
218
-
219
- if client_id.to_s.length < 1
220
- fail ArgumentError, 'invalid value for "client_id", the character length must be great than or equal to 1.'
221
- end
222
-
223
- @client_id = client_id
224
- end
225
-
226
- # Custom attribute writer method with validation
227
- # @param [Object] client_secret Value to be assigned
228
- def client_secret=(client_secret)
229
- if client_secret.nil?
230
- fail ArgumentError, 'client_secret cannot be nil'
231
- end
232
-
233
- if client_secret.to_s.length < 1
234
- fail ArgumentError, 'invalid value for "client_secret", the character length must be great than or equal to 1.'
235
- end
236
-
237
- @client_secret = client_secret
238
- end
239
-
240
- # Custom attribute writer method with validation
241
- # @param [Object] refresh_token Value to be assigned
242
- def refresh_token=(refresh_token)
243
- if refresh_token.nil?
244
- fail ArgumentError, 'refresh_token cannot be nil'
245
- end
246
-
247
- if refresh_token.to_s.length < 1
248
- fail ArgumentError, 'invalid value for "refresh_token", the character length must be great than or equal to 1.'
249
- end
250
-
251
- @refresh_token = refresh_token
252
- end
253
-
254
- # Checks equality by comparing each attribute.
255
- # @param [Object] Object to be compared
256
- def ==(o)
257
- return true if self.equal?(o)
258
- self.class == o.class &&
259
- address == o.address &&
260
- fast_processing == o.fast_processing &&
261
- login == o.login &&
262
- client_id == o.client_id &&
263
- client_secret == o.client_secret &&
264
- refresh_token == o.refresh_token &&
265
- request_url == o.request_url
266
- end
267
-
268
- # @see the `==` method
269
- # @param [Object] Object to be compared
270
- def eql?(o)
271
- self == o
272
- end
273
-
274
- # Calculates hash code according to all attributes.
275
- # @return [Fixnum] Hash code
276
- def hash
277
- [address, fast_processing, login, client_id, client_secret, refresh_token, request_url].hash
278
- end
279
-
280
- # Builds the object from hash
281
- # @param [Hash] attributes Model attributes in the form of hash
282
- # @return [Object] Returns the model itself
283
- def build_from_hash(attributes)
284
- return nil unless attributes.is_a?(Hash)
285
- self.class.swagger_types.each_pair do |key, type|
286
- attribute_key = self.class.attribute_map[key]
287
- attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
288
- if type =~ /\AArray<(.*)>/i
289
- # check to ensure the input is an array given that the the attribute
290
- # is documented as an array but the input is not
291
- if attributes[attribute_key].is_a?(Array)
292
- self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
293
- end
294
- elsif !attributes[attribute_key].nil?
295
- self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
296
- end # or else data not found in attributes(hash), not an issue as the data can be optional
297
- end
298
-
299
- self
300
- end
301
-
302
- # Deserializes the data based on type
303
- # @param string type Data type
304
- # @param string value Value to be deserialized
305
- # @return [Object] Deserialized data
306
- def _deserialize(type, value)
307
- case type.to_sym
308
- when :DateTime
309
- DateTime.parse(value)
310
- when :Date
311
- Date.parse(value)
312
- when :String
313
- value.to_s
314
- when :Integer
315
- value.to_i
316
- when :Float
317
- value.to_f
318
- when :BOOLEAN
319
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
320
- true
321
- else
322
- false
323
- end
324
- when :Object
325
- # generic object (usually a Hash), return directly
326
- value
327
- when /\AArray<(?<inner_type>.+)>\z/
328
- inner_type = Regexp.last_match[:inner_type]
329
- value.map { |v| _deserialize(inner_type, v) }
330
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
331
- k_type = Regexp.last_match[:k_type]
332
- v_type = Regexp.last_match[:v_type]
333
- {}.tap do |hash|
334
- value.each do |k, v|
335
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
336
- end
337
- end
338
- else # model
339
- type = value[:type] || type
340
- temp_model = AsposeEmailCloud.const_get(type).new
341
- temp_model.build_from_hash(value)
342
- end
343
- end
344
-
345
- # Returns the string representation of the object
346
- # @return [String] String presentation of the object
347
- def to_s
348
- to_hash.to_s
349
- end
350
-
351
- # to_body is an alias to to_hash (backward compatibility)
352
- # @return [Hash] Returns the object in the form of hash
353
- def to_body
354
- to_hash
355
- end
356
-
357
- # Returns the object in the form of hash
358
- # @return [Hash] Returns the object in the form of hash
359
- def to_hash
360
- hash = {}
361
- self.class.attribute_map.each_pair do |attr, param|
362
- value = self.send(attr)
363
- next if value.nil?
364
- hash[param] = _to_hash(value)
365
- end
366
- hash
367
- end
368
-
369
- # Outputs non-array value in the form of hash
370
- # For object, use to_hash. Otherwise, just return the value
371
- # @param [Object] value Any valid value
372
- # @return [Hash] Returns the value in the form of hash
373
- def _to_hash(value)
374
- if value.is_a?(Array)
375
- value.compact.map { |v| _to_hash(v) }
376
- elsif value.is_a?(Hash)
377
- {}.tap do |hash|
378
- value.each { |k, v| hash[k] = _to_hash(v) }
379
- end
380
- elsif value.respond_to? :to_hash
381
- value.to_hash
382
- else
383
- value
384
- end
385
- end
386
-
387
- end
388
- end
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="DiscoverEmailConfigOauth.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
+ class DiscoverEmailConfigOauth
31
+ # Email address to discover.
32
+ # @return [String]
33
+ attr_accessor :address
34
+
35
+ # Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.
36
+ # @return [BOOLEAN]
37
+ attr_accessor :fast_processing
38
+
39
+ # Email account login. If not specified, address used as a login.
40
+ # @return [String]
41
+ attr_accessor :login
42
+
43
+ # OAuth client id.
44
+ # @return [String]
45
+ attr_accessor :client_id
46
+
47
+ # OAuth client secret.
48
+ # @return [String]
49
+ attr_accessor :client_secret
50
+
51
+ # OAuth refresh token.
52
+ # @return [String]
53
+ attr_accessor :refresh_token
54
+
55
+ # The url to obtain access token. If not specified, will be discovered from email configuration.
56
+ # @return [String]
57
+ attr_accessor :request_url
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'address' => :'address',
63
+ :'fast_processing' => :'fastProcessing',
64
+ :'login' => :'login',
65
+ :'client_id' => :'clientId',
66
+ :'client_secret' => :'clientSecret',
67
+ :'refresh_token' => :'refreshToken',
68
+ :'request_url' => :'requestUrl'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.swagger_types
74
+ {
75
+ :'address' => :'String',
76
+ :'fast_processing' => :'BOOLEAN',
77
+ :'login' => :'String',
78
+ :'client_id' => :'String',
79
+ :'client_secret' => :'String',
80
+ :'refresh_token' => :'String',
81
+ :'request_url' => :'String'
82
+ }
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ return unless attributes.is_a?(Hash)
89
+
90
+ # convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
92
+
93
+ if attributes.has_key?(:'address')
94
+ self.address = attributes[:'address']
95
+ end
96
+
97
+ if attributes.has_key?(:'fastProcessing')
98
+ self.fast_processing = attributes[:'fastProcessing']
99
+ end
100
+
101
+ if attributes.has_key?(:'login')
102
+ self.login = attributes[:'login']
103
+ end
104
+
105
+ if attributes.has_key?(:'clientId')
106
+ self.client_id = attributes[:'clientId']
107
+ end
108
+
109
+ if attributes.has_key?(:'clientSecret')
110
+ self.client_secret = attributes[:'clientSecret']
111
+ end
112
+
113
+ if attributes.has_key?(:'refreshToken')
114
+ self.refresh_token = attributes[:'refreshToken']
115
+ end
116
+
117
+ if attributes.has_key?(:'requestUrl')
118
+ self.request_url = attributes[:'requestUrl']
119
+ end
120
+ end
121
+
122
+ # Initializes the object
123
+ # @param [String] address Email address to discover.
124
+ # @param [BOOLEAN] fast_processing Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.
125
+ # @param [String] login Email account login. If not specified, address used as a login.
126
+ # @param [String] client_id OAuth client id.
127
+ # @param [String] client_secret OAuth client secret.
128
+ # @param [String] refresh_token OAuth refresh token.
129
+ # @param [String] request_url The url to obtain access token. If not specified, will be discovered from email configuration.
130
+ def initialize(address=nil, fast_processing=nil, login=nil, client_id=nil, client_secret=nil, refresh_token=nil, request_url=nil)
131
+ self.address = address if address
132
+ self.fast_processing = fast_processing if fast_processing
133
+ self.login = login if login
134
+ self.client_id = client_id if client_id
135
+ self.client_secret = client_secret if client_secret
136
+ self.refresh_token = refresh_token if refresh_token
137
+ self.request_url = request_url if request_url
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ invalid_properties = Array.new
144
+ if @address.nil?
145
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
146
+ end
147
+
148
+ if @address.to_s.length < 1
149
+ invalid_properties.push('invalid value for "address", the character length must be great than or equal to 1.')
150
+ end
151
+
152
+ if @fast_processing.nil?
153
+ invalid_properties.push('invalid value for "fast_processing", fast_processing cannot be nil.')
154
+ end
155
+
156
+ if @client_id.nil?
157
+ invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
158
+ end
159
+
160
+ if @client_id.to_s.length < 1
161
+ invalid_properties.push('invalid value for "client_id", the character length must be great than or equal to 1.')
162
+ end
163
+
164
+ if @client_secret.nil?
165
+ invalid_properties.push('invalid value for "client_secret", client_secret cannot be nil.')
166
+ end
167
+
168
+ if @client_secret.to_s.length < 1
169
+ invalid_properties.push('invalid value for "client_secret", the character length must be great than or equal to 1.')
170
+ end
171
+
172
+ if @refresh_token.nil?
173
+ invalid_properties.push('invalid value for "refresh_token", refresh_token cannot be nil.')
174
+ end
175
+
176
+ if @refresh_token.to_s.length < 1
177
+ invalid_properties.push('invalid value for "refresh_token", the character length must be great than or equal to 1.')
178
+ end
179
+
180
+ invalid_properties
181
+ end
182
+
183
+ # Check to see if the all the properties in the model are valid
184
+ # @return true if the model is valid
185
+ def valid?
186
+ return false if @address.nil?
187
+ return false if @address.to_s.length < 1
188
+ return false if @fast_processing.nil?
189
+ return false if @client_id.nil?
190
+ return false if @client_id.to_s.length < 1
191
+ return false if @client_secret.nil?
192
+ return false if @client_secret.to_s.length < 1
193
+ return false if @refresh_token.nil?
194
+ return false if @refresh_token.to_s.length < 1
195
+ true
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] address Value to be assigned
200
+ def address=(address)
201
+ if address.nil?
202
+ fail ArgumentError, 'address cannot be nil'
203
+ end
204
+
205
+ if address.to_s.length < 1
206
+ fail ArgumentError, 'invalid value for "address", the character length must be great than or equal to 1.'
207
+ end
208
+
209
+ @address = address
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] client_id Value to be assigned
214
+ def client_id=(client_id)
215
+ if client_id.nil?
216
+ fail ArgumentError, 'client_id cannot be nil'
217
+ end
218
+
219
+ if client_id.to_s.length < 1
220
+ fail ArgumentError, 'invalid value for "client_id", the character length must be great than or equal to 1.'
221
+ end
222
+
223
+ @client_id = client_id
224
+ end
225
+
226
+ # Custom attribute writer method with validation
227
+ # @param [Object] client_secret Value to be assigned
228
+ def client_secret=(client_secret)
229
+ if client_secret.nil?
230
+ fail ArgumentError, 'client_secret cannot be nil'
231
+ end
232
+
233
+ if client_secret.to_s.length < 1
234
+ fail ArgumentError, 'invalid value for "client_secret", the character length must be great than or equal to 1.'
235
+ end
236
+
237
+ @client_secret = client_secret
238
+ end
239
+
240
+ # Custom attribute writer method with validation
241
+ # @param [Object] refresh_token Value to be assigned
242
+ def refresh_token=(refresh_token)
243
+ if refresh_token.nil?
244
+ fail ArgumentError, 'refresh_token cannot be nil'
245
+ end
246
+
247
+ if refresh_token.to_s.length < 1
248
+ fail ArgumentError, 'invalid value for "refresh_token", the character length must be great than or equal to 1.'
249
+ end
250
+
251
+ @refresh_token = refresh_token
252
+ end
253
+
254
+ # Checks equality by comparing each attribute.
255
+ # @param [Object] Object to be compared
256
+ def ==(o)
257
+ return true if self.equal?(o)
258
+ self.class == o.class &&
259
+ address == o.address &&
260
+ fast_processing == o.fast_processing &&
261
+ login == o.login &&
262
+ client_id == o.client_id &&
263
+ client_secret == o.client_secret &&
264
+ refresh_token == o.refresh_token &&
265
+ request_url == o.request_url
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(o)
271
+ self == o
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Fixnum] Hash code
276
+ def hash
277
+ [address, fast_processing, login, client_id, client_secret, refresh_token, request_url].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ self.class.swagger_types.each_pair do |key, type|
286
+ attribute_key = self.class.attribute_map[key]
287
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
288
+ if type =~ /\AArray<(.*)>/i
289
+ # check to ensure the input is an array given that the the attribute
290
+ # is documented as an array but the input is not
291
+ if attributes[attribute_key].is_a?(Array)
292
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
293
+ end
294
+ elsif !attributes[attribute_key].nil?
295
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
296
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
297
+ end
298
+
299
+ self
300
+ end
301
+
302
+ # Deserializes the data based on type
303
+ # @param string type Data type
304
+ # @param string value Value to be deserialized
305
+ # @return [Object] Deserialized data
306
+ def _deserialize(type, value)
307
+ case type.to_sym
308
+ when :DateTime
309
+ DateTime.parse(value)
310
+ when :Date
311
+ Date.parse(value)
312
+ when :String
313
+ value.to_s
314
+ when :Integer
315
+ value.to_i
316
+ when :Float
317
+ value.to_f
318
+ when :BOOLEAN
319
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
320
+ true
321
+ else
322
+ false
323
+ end
324
+ when :Object
325
+ # generic object (usually a Hash), return directly
326
+ value
327
+ when /\AArray<(?<inner_type>.+)>\z/
328
+ inner_type = Regexp.last_match[:inner_type]
329
+ value.map { |v| _deserialize(inner_type, v) }
330
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
331
+ k_type = Regexp.last_match[:k_type]
332
+ v_type = Regexp.last_match[:v_type]
333
+ {}.tap do |hash|
334
+ value.each do |k, v|
335
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
336
+ end
337
+ end
338
+ else # model
339
+ sub_type = value[:type] || value[:discriminator] || type
340
+ if AsposeEmailCloud.const_defined?(sub_type)
341
+ type = sub_type
342
+ end
343
+ temp_model = AsposeEmailCloud.const_get(type).new
344
+ temp_model.build_from_hash(value)
345
+ end
346
+ end
347
+
348
+ # Returns the string representation of the object
349
+ # @return [String] String presentation of the object
350
+ def to_s
351
+ to_hash.to_s
352
+ end
353
+
354
+ # to_body is an alias to to_hash (backward compatibility)
355
+ # @return [Hash] Returns the object in the form of hash
356
+ def to_body
357
+ to_hash
358
+ end
359
+
360
+ # Returns the object in the form of hash
361
+ # @return [Hash] Returns the object in the form of hash
362
+ def to_hash
363
+ hash = {}
364
+ self.class.attribute_map.each_pair do |attr, param|
365
+ value = self.send(attr)
366
+ next if value.nil?
367
+ hash[param] = _to_hash(value)
368
+ end
369
+ hash
370
+ end
371
+
372
+ # Outputs non-array value in the form of hash
373
+ # For object, use to_hash. Otherwise, just return the value
374
+ # @param [Object] value Any valid value
375
+ # @return [Hash] Returns the value in the form of hash
376
+ def _to_hash(value)
377
+ if value.is_a?(Array)
378
+ value.compact.map { |v| _to_hash(v) }
379
+ elsif value.is_a?(Hash)
380
+ {}.tap do |hash|
381
+ value.each { |k, v| hash[k] = _to_hash(v) }
382
+ end
383
+ elsif value.respond_to? :to_hash
384
+ value.to_hash
385
+ else
386
+ value
387
+ end
388
+ end
389
+
390
+ end
391
+ end