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,241 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="PhoneNumber.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
+ # A phone number.
31
+ class PhoneNumber
32
+ # Phone number category.
33
+ # @return [EnumWithCustomOfPhoneNumberCategory]
34
+ attr_accessor :category
35
+
36
+ # Phone number.
37
+ # @return [String]
38
+ attr_accessor :number
39
+
40
+ # Defines whether phone number is preferred.
41
+ # @return [BOOLEAN]
42
+ attr_accessor :preferred
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'category' => :'category',
48
+ :'number' => :'number',
49
+ :'preferred' => :'preferred'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'category' => :'EnumWithCustomOfPhoneNumberCategory',
57
+ :'number' => :'String',
58
+ :'preferred' => :'BOOLEAN'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
69
+
70
+ if attributes.has_key?(:'category')
71
+ self.category = attributes[:'category']
72
+ end
73
+
74
+ if attributes.has_key?(:'number')
75
+ self.number = attributes[:'number']
76
+ end
77
+
78
+ if attributes.has_key?(:'preferred')
79
+ self.preferred = attributes[:'preferred']
80
+ end
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [EnumWithCustomOfPhoneNumberCategory] category Phone number category.
85
+ # @param [String] number Phone number.
86
+ # @param [BOOLEAN] preferred Defines whether phone number is preferred.
87
+ def initialize(category=nil, number=nil, preferred=nil)
88
+ self.category = category if category
89
+ self.number = number if number
90
+ self.preferred = preferred if preferred
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ if @preferred.nil?
98
+ invalid_properties.push('invalid value for "preferred", preferred cannot be nil.')
99
+ end
100
+
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ return false if @preferred.nil?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ category == o.category &&
117
+ number == o.number &&
118
+ preferred == o.preferred
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Fixnum] Hash code
129
+ def hash
130
+ [category, number, preferred].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.swagger_types.each_pair do |key, type|
139
+ attribute_key = self.class.attribute_map[key]
140
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
141
+ if type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[attribute_key].is_a?(Array)
145
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[attribute_key].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :BOOLEAN
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ type = value[:type] || type
193
+ temp_model = AsposeEmailCloud.const_get(type).new
194
+ temp_model.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ next if value.nil?
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+ end
@@ -0,0 +1,350 @@
1
+ # ----------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="PostalAddress.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
+ # A postal address
31
+ class PostalAddress
32
+ # Address.
33
+ # @return [String]
34
+ attr_accessor :address
35
+
36
+ # Address category.
37
+ # @return [EnumWithCustomOfPostalAddressCategory]
38
+ attr_accessor :category
39
+
40
+ # Address's city.
41
+ # @return [String]
42
+ attr_accessor :city
43
+
44
+ # Address's country.
45
+ # @return [String]
46
+ attr_accessor :country
47
+
48
+ # Country code.
49
+ # @return [String]
50
+ attr_accessor :country_code
51
+
52
+ # Defines whether address may be used for mailing.
53
+ # @return [BOOLEAN]
54
+ attr_accessor :is_mailing_address
55
+
56
+ # Postal code.
57
+ # @return [String]
58
+ attr_accessor :postal_code
59
+
60
+ # Post Office box.
61
+ # @return [String]
62
+ attr_accessor :post_office_box
63
+
64
+ # Defines whether postal address is preferred.
65
+ # @return [BOOLEAN]
66
+ attr_accessor :preferred
67
+
68
+ # Address's region.
69
+ # @return [String]
70
+ attr_accessor :state_or_province
71
+
72
+ # Address's street.
73
+ # @return [String]
74
+ attr_accessor :street
75
+
76
+ # Attribute mapping from ruby-style variable name to JSON key.
77
+ def self.attribute_map
78
+ {
79
+ :'address' => :'address',
80
+ :'category' => :'category',
81
+ :'city' => :'city',
82
+ :'country' => :'country',
83
+ :'country_code' => :'countryCode',
84
+ :'is_mailing_address' => :'isMailingAddress',
85
+ :'postal_code' => :'postalCode',
86
+ :'post_office_box' => :'postOfficeBox',
87
+ :'preferred' => :'preferred',
88
+ :'state_or_province' => :'stateOrProvince',
89
+ :'street' => :'street'
90
+ }
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.swagger_types
95
+ {
96
+ :'address' => :'String',
97
+ :'category' => :'EnumWithCustomOfPostalAddressCategory',
98
+ :'city' => :'String',
99
+ :'country' => :'String',
100
+ :'country_code' => :'String',
101
+ :'is_mailing_address' => :'BOOLEAN',
102
+ :'postal_code' => :'String',
103
+ :'post_office_box' => :'String',
104
+ :'preferred' => :'BOOLEAN',
105
+ :'state_or_province' => :'String',
106
+ :'street' => :'String'
107
+ }
108
+ end
109
+
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ return unless attributes.is_a?(Hash)
114
+
115
+ # convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
117
+
118
+ if attributes.has_key?(:'address')
119
+ self.address = attributes[:'address']
120
+ end
121
+
122
+ if attributes.has_key?(:'category')
123
+ self.category = attributes[:'category']
124
+ end
125
+
126
+ if attributes.has_key?(:'city')
127
+ self.city = attributes[:'city']
128
+ end
129
+
130
+ if attributes.has_key?(:'country')
131
+ self.country = attributes[:'country']
132
+ end
133
+
134
+ if attributes.has_key?(:'countryCode')
135
+ self.country_code = attributes[:'countryCode']
136
+ end
137
+
138
+ if attributes.has_key?(:'isMailingAddress')
139
+ self.is_mailing_address = attributes[:'isMailingAddress']
140
+ end
141
+
142
+ if attributes.has_key?(:'postalCode')
143
+ self.postal_code = attributes[:'postalCode']
144
+ end
145
+
146
+ if attributes.has_key?(:'postOfficeBox')
147
+ self.post_office_box = attributes[:'postOfficeBox']
148
+ end
149
+
150
+ if attributes.has_key?(:'preferred')
151
+ self.preferred = attributes[:'preferred']
152
+ end
153
+
154
+ if attributes.has_key?(:'stateOrProvince')
155
+ self.state_or_province = attributes[:'stateOrProvince']
156
+ end
157
+
158
+ if attributes.has_key?(:'street')
159
+ self.street = attributes[:'street']
160
+ end
161
+ end
162
+
163
+ # Initializes the object
164
+ # @param [String] address Address.
165
+ # @param [EnumWithCustomOfPostalAddressCategory] category Address category.
166
+ # @param [String] city Address's city.
167
+ # @param [String] country Address's country.
168
+ # @param [String] country_code Country code.
169
+ # @param [BOOLEAN] is_mailing_address Defines whether address may be used for mailing.
170
+ # @param [String] postal_code Postal code.
171
+ # @param [String] post_office_box Post Office box.
172
+ # @param [BOOLEAN] preferred Defines whether postal address is preferred.
173
+ # @param [String] state_or_province Address's region.
174
+ # @param [String] street Address's street.
175
+ def initialize(address=nil, category=nil, city=nil, country=nil, country_code=nil, is_mailing_address=nil, postal_code=nil, post_office_box=nil, preferred=nil, state_or_province=nil, street=nil)
176
+ self.address = address if address
177
+ self.category = category if category
178
+ self.city = city if city
179
+ self.country = country if country
180
+ self.country_code = country_code if country_code
181
+ self.is_mailing_address = is_mailing_address if is_mailing_address
182
+ self.postal_code = postal_code if postal_code
183
+ self.post_office_box = post_office_box if post_office_box
184
+ self.preferred = preferred if preferred
185
+ self.state_or_province = state_or_province if state_or_province
186
+ self.street = street if street
187
+ end
188
+
189
+ # Show invalid properties with the reasons. Usually used together with valid?
190
+ # @return Array for valid properties with the reasons
191
+ def list_invalid_properties
192
+ invalid_properties = Array.new
193
+ if @is_mailing_address.nil?
194
+ invalid_properties.push('invalid value for "is_mailing_address", is_mailing_address cannot be nil.')
195
+ end
196
+
197
+ if @preferred.nil?
198
+ invalid_properties.push('invalid value for "preferred", preferred cannot be nil.')
199
+ end
200
+
201
+ invalid_properties
202
+ end
203
+
204
+ # Check to see if the all the properties in the model are valid
205
+ # @return true if the model is valid
206
+ def valid?
207
+ return false if @is_mailing_address.nil?
208
+ return false if @preferred.nil?
209
+ true
210
+ end
211
+
212
+ # Checks equality by comparing each attribute.
213
+ # @param [Object] Object to be compared
214
+ def ==(o)
215
+ return true if self.equal?(o)
216
+ self.class == o.class &&
217
+ address == o.address &&
218
+ category == o.category &&
219
+ city == o.city &&
220
+ country == o.country &&
221
+ country_code == o.country_code &&
222
+ is_mailing_address == o.is_mailing_address &&
223
+ postal_code == o.postal_code &&
224
+ post_office_box == o.post_office_box &&
225
+ preferred == o.preferred &&
226
+ state_or_province == o.state_or_province &&
227
+ street == o.street
228
+ end
229
+
230
+ # @see the `==` method
231
+ # @param [Object] Object to be compared
232
+ def eql?(o)
233
+ self == o
234
+ end
235
+
236
+ # Calculates hash code according to all attributes.
237
+ # @return [Fixnum] Hash code
238
+ def hash
239
+ [address, category, city, country, country_code, is_mailing_address, postal_code, post_office_box, preferred, state_or_province, street].hash
240
+ end
241
+
242
+ # Builds the object from hash
243
+ # @param [Hash] attributes Model attributes in the form of hash
244
+ # @return [Object] Returns the model itself
245
+ def build_from_hash(attributes)
246
+ return nil unless attributes.is_a?(Hash)
247
+ self.class.swagger_types.each_pair do |key, type|
248
+ attribute_key = self.class.attribute_map[key]
249
+ attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
250
+ if type =~ /\AArray<(.*)>/i
251
+ # check to ensure the input is an array given that the the attribute
252
+ # is documented as an array but the input is not
253
+ if attributes[attribute_key].is_a?(Array)
254
+ self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
255
+ end
256
+ elsif !attributes[attribute_key].nil?
257
+ self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
258
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
259
+ end
260
+
261
+ self
262
+ end
263
+
264
+ # Deserializes the data based on type
265
+ # @param string type Data type
266
+ # @param string value Value to be deserialized
267
+ # @return [Object] Deserialized data
268
+ def _deserialize(type, value)
269
+ case type.to_sym
270
+ when :DateTime
271
+ DateTime.parse(value)
272
+ when :Date
273
+ Date.parse(value)
274
+ when :String
275
+ value.to_s
276
+ when :Integer
277
+ value.to_i
278
+ when :Float
279
+ value.to_f
280
+ when :BOOLEAN
281
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
282
+ true
283
+ else
284
+ false
285
+ end
286
+ when :Object
287
+ # generic object (usually a Hash), return directly
288
+ value
289
+ when /\AArray<(?<inner_type>.+)>\z/
290
+ inner_type = Regexp.last_match[:inner_type]
291
+ value.map { |v| _deserialize(inner_type, v) }
292
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
293
+ k_type = Regexp.last_match[:k_type]
294
+ v_type = Regexp.last_match[:v_type]
295
+ {}.tap do |hash|
296
+ value.each do |k, v|
297
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
298
+ end
299
+ end
300
+ else # model
301
+ type = value[:type] || type
302
+ temp_model = AsposeEmailCloud.const_get(type).new
303
+ temp_model.build_from_hash(value)
304
+ end
305
+ end
306
+
307
+ # Returns the string representation of the object
308
+ # @return [String] String presentation of the object
309
+ def to_s
310
+ to_hash.to_s
311
+ end
312
+
313
+ # to_body is an alias to to_hash (backward compatibility)
314
+ # @return [Hash] Returns the object in the form of hash
315
+ def to_body
316
+ to_hash
317
+ end
318
+
319
+ # Returns the object in the form of hash
320
+ # @return [Hash] Returns the object in the form of hash
321
+ def to_hash
322
+ hash = {}
323
+ self.class.attribute_map.each_pair do |attr, param|
324
+ value = self.send(attr)
325
+ next if value.nil?
326
+ hash[param] = _to_hash(value)
327
+ end
328
+ hash
329
+ end
330
+
331
+ # Outputs non-array value in the form of hash
332
+ # For object, use to_hash. Otherwise, just return the value
333
+ # @param [Object] value Any valid value
334
+ # @return [Hash] Returns the value in the form of hash
335
+ def _to_hash(value)
336
+ if value.is_a?(Array)
337
+ value.compact.map { |v| _to_hash(v) }
338
+ elsif value.is_a?(Hash)
339
+ {}.tap do |hash|
340
+ value.each { |k, v| hash[k] = _to_hash(v) }
341
+ end
342
+ elsif value.respond_to? :to_hash
343
+ value.to_hash
344
+ else
345
+ value
346
+ end
347
+ end
348
+
349
+ end
350
+ end