aspose_email_cloud 19.11.0 → 19.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aspose-email-cloud.rb +43 -1
- data/lib/aspose-email-cloud/api/email_api.rb +221 -100
- data/lib/aspose-email-cloud/api_client.rb +4 -3
- data/lib/aspose-email-cloud/configuration.rb +4 -0
- data/lib/aspose-email-cloud/models/account_base_request.rb +123 -113
- data/lib/aspose-email-cloud/models/add_attachment_request.rb +86 -82
- data/lib/aspose-email-cloud/models/ai_bcr_base64_image.rb +228 -0
- data/lib/aspose-email-cloud/models/ai_bcr_base64_rq.rb +225 -0
- data/lib/aspose-email-cloud/models/ai_bcr_image.rb +215 -0
- data/lib/aspose-email-cloud/models/ai_bcr_image_storage_file.rb +228 -0
- data/lib/aspose-email-cloud/models/ai_bcr_ocr_data.rb +253 -0
- data/lib/aspose-email-cloud/models/ai_bcr_ocr_data_part.rb +297 -0
- data/lib/aspose-email-cloud/models/ai_bcr_options.rb +223 -0
- data/lib/aspose-email-cloud/models/ai_bcr_parse_storage_rq.rb +248 -0
- data/lib/aspose-email-cloud/models/ai_bcr_rq.rb +210 -0
- data/lib/aspose-email-cloud/models/ai_bcr_storage_image_rq.rb +230 -0
- data/lib/aspose-email-cloud/models/ai_name_component.rb +264 -0
- data/lib/aspose-email-cloud/models/ai_name_cultural_context.rb +267 -0
- data/lib/aspose-email-cloud/models/ai_name_extracted.rb +230 -0
- data/lib/aspose-email-cloud/models/ai_name_extracted_component.rb +228 -0
- data/lib/aspose-email-cloud/models/ai_name_formatted.rb +223 -0
- data/lib/aspose-email-cloud/models/ai_name_gender_hypothesis.rb +233 -0
- data/lib/aspose-email-cloud/models/ai_name_match_result.rb +230 -0
- data/lib/aspose-email-cloud/models/ai_name_mismatch.rb +246 -0
- data/lib/aspose-email-cloud/models/ai_name_parsed_match_rq.rb +263 -0
- data/lib/aspose-email-cloud/models/ai_name_parsed_rq.rb +243 -0
- data/lib/aspose-email-cloud/models/ai_name_weighted.rb +228 -0
- data/lib/aspose-email-cloud/models/ai_name_weighted_variants.rb +225 -0
- data/lib/aspose-email-cloud/models/append_email_account_base_request.rb +178 -163
- data/lib/aspose-email-cloud/models/append_email_base_request.rb +196 -179
- data/lib/aspose-email-cloud/models/append_email_mime_base_request.rb +215 -198
- data/lib/aspose-email-cloud/models/base_object.rb +9 -5
- data/lib/aspose-email-cloud/models/create_email_request.rb +91 -87
- data/lib/aspose-email-cloud/models/create_folder_base_request.rb +173 -160
- data/lib/aspose-email-cloud/models/delete_folder_base_request.rb +178 -165
- data/lib/aspose-email-cloud/models/delete_message_base_request.rb +178 -165
- data/lib/aspose-email-cloud/models/disc_usage.rb +96 -92
- data/lib/aspose-email-cloud/models/email_account_request.rb +257 -205
- data/lib/aspose-email-cloud/models/email_document.rb +93 -89
- data/lib/aspose-email-cloud/models/email_document_response.rb +73 -71
- data/lib/aspose-email-cloud/models/email_properties.rb +93 -88
- data/lib/aspose-email-cloud/models/email_property.rb +128 -119
- data/lib/aspose-email-cloud/models/email_property_response.rb +73 -71
- data/lib/aspose-email-cloud/models/error.rb +112 -104
- data/lib/aspose-email-cloud/models/error_details.rb +91 -87
- data/lib/aspose-email-cloud/models/file_version.rb +166 -152
- data/lib/aspose-email-cloud/models/file_versions.rb +75 -73
- data/lib/aspose-email-cloud/models/files_list.rb +75 -73
- data/lib/aspose-email-cloud/models/files_upload_result.rb +90 -86
- data/lib/aspose-email-cloud/models/hierarchical_object.rb +13 -7
- data/lib/aspose-email-cloud/models/hierarchical_object_request.rb +91 -87
- data/lib/aspose-email-cloud/models/hierarchical_object_response.rb +86 -82
- data/lib/aspose-email-cloud/models/indexed_hierarchical_object.rb +17 -9
- data/lib/aspose-email-cloud/models/indexed_primitive_object.rb +17 -9
- data/lib/aspose-email-cloud/models/link.rb +112 -104
- data/lib/aspose-email-cloud/models/list_response_of_ai_bcr_ocr_data.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_ai_name_component.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_ai_name_extracted.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_ai_name_gender_hypothesis.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_hierarchical_object.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_hierarchical_object_response.rb +74 -71
- data/lib/aspose-email-cloud/models/list_response_of_mail_server_folder.rb +74 -71
- data/lib/aspose-email-cloud/models/list_response_of_storage_file_location.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_string.rb +74 -71
- data/lib/aspose-email-cloud/models/mail_server_folder.rb +86 -82
- data/lib/aspose-email-cloud/models/mime_response.rb +73 -71
- data/lib/aspose-email-cloud/models/object_exist.rb +96 -92
- data/lib/aspose-email-cloud/models/primitive_object.rb +13 -7
- data/lib/aspose-email-cloud/models/requests/add_calendar_attachment_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/add_contact_attachment_request_data.rb +6 -11
- data/lib/aspose-email-cloud/models/requests/add_email_attachment_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/add_mapi_attachment_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/ai_bcr_ocr_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_bcr_ocr_storage_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_storage_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_complete_request_data.rb +91 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_expand_parsed_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_expand_request_data.rb +91 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_format_parsed_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_format_request_data.rb +94 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_genderize_parsed_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_genderize_request_data.rb +91 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_match_parsed_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_match_request_data.rb +99 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_parse_email_address_request_data.rb +91 -0
- data/lib/aspose-email-cloud/models/requests/ai_name_parse_request_data.rb +91 -0
- data/lib/aspose-email-cloud/models/requests/append_email_message_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/append_mime_message_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/copy_file_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/copy_folder_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/create_calendar_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/create_contact_request_data.rb +5 -10
- data/lib/aspose-email-cloud/models/requests/create_email_folder_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/create_email_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/create_folder_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/create_mapi_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/delete_calendar_property_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/delete_contact_property_request_data.rb +7 -12
- data/lib/aspose-email-cloud/models/requests/delete_email_folder_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/delete_email_message_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/delete_file_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/delete_folder_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/delete_mapi_attachment_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/delete_mapi_properties_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/download_file_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/fetch_email_message_request_data.rb +7 -7
- data/lib/aspose-email-cloud/models/requests/get_calendar_attachment_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/get_calendar_list_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/get_calendar_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/get_contact_attachment_request_data.rb +7 -12
- data/lib/aspose-email-cloud/models/requests/get_contact_list_request_data.rb +7 -12
- data/lib/aspose-email-cloud/models/requests/get_contact_properties_request_data.rb +6 -11
- data/lib/aspose-email-cloud/models/requests/get_disc_usage_request_data.rb +1 -1
- data/lib/aspose-email-cloud/models/requests/get_email_attachment_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/get_email_property_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/get_email_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/get_file_versions_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/get_files_list_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/get_mapi_attachment_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/get_mapi_attachments_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/get_mapi_list_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/get_mapi_properties_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/list_email_folders_request_data.rb +7 -7
- data/lib/aspose-email-cloud/models/requests/list_email_messages_request_data.rb +10 -10
- data/lib/aspose-email-cloud/models/requests/move_file_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/move_folder_request_data.rb +4 -4
- data/lib/aspose-email-cloud/models/requests/object_exists_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/save_mail_account_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/save_mail_o_auth_account_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/send_email_mime_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/send_email_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/set_email_property_request_data.rb +5 -5
- data/lib/aspose-email-cloud/models/requests/set_email_read_flag_request_data.rb +2 -2
- data/lib/aspose-email-cloud/models/requests/storage_exists_request_data.rb +1 -1
- data/lib/aspose-email-cloud/models/requests/update_calendar_properties_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/update_contact_properties_request_data.rb +5 -10
- data/lib/aspose-email-cloud/models/requests/update_mapi_properties_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/requests/upload_file_request_data.rb +3 -3
- data/lib/aspose-email-cloud/models/save_email_account_request.rb +294 -240
- data/lib/aspose-email-cloud/models/save_o_auth_email_account_request.rb +368 -310
- data/lib/aspose-email-cloud/models/send_email_base_request.rb +141 -130
- data/lib/aspose-email-cloud/models/send_email_mime_base_request.rb +160 -149
- data/lib/aspose-email-cloud/models/set_email_property_request.rb +91 -87
- data/lib/aspose-email-cloud/models/set_message_read_flag_account_base_request.rb +178 -165
- data/lib/aspose-email-cloud/models/storage_exist.rb +78 -76
- data/lib/aspose-email-cloud/models/storage_file.rb +135 -125
- data/lib/aspose-email-cloud/models/storage_file_location.rb +123 -117
- data/lib/aspose-email-cloud/models/storage_folder_location.rb +86 -82
- data/lib/aspose-email-cloud/models/value_response.rb +73 -71
- data/lib/aspose-email-cloud/version.rb +1 -1
- metadata +45 -3
- data/lib/aspose-email-cloud/models/contact_format.rb +0 -45
@@ -0,0 +1,246 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="AiNameMismatch.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
|
+
# Names mismatch detailed description
|
31
|
+
class AiNameMismatch
|
32
|
+
# Mismatch type. Enum, available values: Unknown, FirstName, MiddleName, MiddleLastName, MiddleNickname, Gender, Context
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :category
|
35
|
+
|
36
|
+
# Similarity score
|
37
|
+
# @return [Float]
|
38
|
+
attr_accessor :similarity
|
39
|
+
|
40
|
+
# Explanation or mismatch subtype
|
41
|
+
# @return [String]
|
42
|
+
attr_accessor :explanation
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'category' => :'category',
|
48
|
+
:'similarity' => :'similarity',
|
49
|
+
:'explanation' => :'explanation'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
:'category' => :'String',
|
57
|
+
:'similarity' => :'Float',
|
58
|
+
:'explanation' => :'String'
|
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?(:'similarity')
|
75
|
+
self.similarity = attributes[:'similarity']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'explanation')
|
79
|
+
self.explanation = attributes[:'explanation']
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Initializes the object
|
84
|
+
# @param [String] category Mismatch type. Enum, available values: Unknown, FirstName, MiddleName, MiddleLastName, MiddleNickname, Gender, Context
|
85
|
+
# @param [Float] similarity Similarity score
|
86
|
+
# @param [String] explanation Explanation or mismatch subtype
|
87
|
+
def initialize(category=nil, similarity=nil, explanation=nil)
|
88
|
+
self.category = category if category
|
89
|
+
self.similarity = similarity if similarity
|
90
|
+
self.explanation = explanation if explanation
|
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 @category.nil?
|
98
|
+
invalid_properties.push('invalid value for "category", category cannot be nil.')
|
99
|
+
end
|
100
|
+
|
101
|
+
if @similarity.nil?
|
102
|
+
invalid_properties.push('invalid value for "similarity", similarity cannot be nil.')
|
103
|
+
end
|
104
|
+
|
105
|
+
invalid_properties
|
106
|
+
end
|
107
|
+
|
108
|
+
# Check to see if the all the properties in the model are valid
|
109
|
+
# @return true if the model is valid
|
110
|
+
def valid?
|
111
|
+
return false if @category.nil?
|
112
|
+
return false if @similarity.nil?
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Checks equality by comparing each attribute.
|
117
|
+
# @param [Object] Object to be compared
|
118
|
+
def ==(o)
|
119
|
+
return true if self.equal?(o)
|
120
|
+
self.class == o.class &&
|
121
|
+
category == o.category &&
|
122
|
+
similarity == o.similarity &&
|
123
|
+
explanation == o.explanation
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Fixnum] Hash code
|
134
|
+
def hash
|
135
|
+
[category, similarity, explanation].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.swagger_types.each_pair do |key, type|
|
144
|
+
attribute_key = self.class.attribute_map[key]
|
145
|
+
attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
|
146
|
+
if type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[attribute_key].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
|
151
|
+
end
|
152
|
+
elsif !attributes[attribute_key].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
|
154
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :DateTime
|
167
|
+
DateTime.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :BOOLEAN
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
type = value[:type] || type
|
198
|
+
temp_model = AsposeEmailCloud.const_get(type).new
|
199
|
+
temp_model.build_from_hash(value)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the string representation of the object
|
204
|
+
# @return [String] String presentation of the object
|
205
|
+
def to_s
|
206
|
+
to_hash.to_s
|
207
|
+
end
|
208
|
+
|
209
|
+
# to_body is an alias to to_hash (backward compatibility)
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_body
|
212
|
+
to_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the object in the form of hash
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_hash
|
218
|
+
hash = {}
|
219
|
+
self.class.attribute_map.each_pair do |attr, param|
|
220
|
+
value = self.send(attr)
|
221
|
+
next if value.nil?
|
222
|
+
hash[param] = _to_hash(value)
|
223
|
+
end
|
224
|
+
hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Outputs non-array value in the form of hash
|
228
|
+
# For object, use to_hash. Otherwise, just return the value
|
229
|
+
# @param [Object] value Any valid value
|
230
|
+
# @return [Hash] Returns the value in the form of hash
|
231
|
+
def _to_hash(value)
|
232
|
+
if value.is_a?(Array)
|
233
|
+
value.compact.map { |v| _to_hash(v) }
|
234
|
+
elsif value.is_a?(Hash)
|
235
|
+
{}.tap do |hash|
|
236
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
237
|
+
end
|
238
|
+
elsif value.respond_to? :to_hash
|
239
|
+
value.to_hash
|
240
|
+
else
|
241
|
+
value
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
end
|
@@ -0,0 +1,263 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="AiNameParsedMatchRq.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
|
+
# Two parsed names to match request
|
31
|
+
class AiNameParsedMatchRq
|
32
|
+
# AiName parser cultural context
|
33
|
+
# @return [AiNameCulturalContext]
|
34
|
+
attr_accessor :cultural_context
|
35
|
+
|
36
|
+
# Format of the name. Predefined format can be used by ID, or custom format can be specified. Predefined formats: /format/default/ (= '%t%F%m%N%L%p') /format/FN+LN/ (= '%F%L') /format/title+FN+LN/ (= '%t%F%L') /format/FN+MN+LN/ (= '%F%M%N%L') /format/title+FN+MN+LN/ (= '%t%F%M%N%L') /format/FN+MI+LN/ (= '%F%m%N%L') /format/title+FN+MI+LN/ (= '%t%F%m%N%L') /format/LN/ (= '%L') /format/title+LN/ (= '%t%L') /format/LN+FN+MN/ (= '%L,%F%M%N') /format/LN+title+FN+MN/ (= '%L,%t%F%M%N') /format/LN+FN+MI/ (= '%L,%F%m%N') /format/LN+title+FN+MI/ (= '%L,%t%F%m%N') Custom format string - custom combination of characters and the next term placeholders: '%t' - Title (prefix) '%F' - First name '%f' - First initial '%M' - Middle name(s) '%m' - Middle initial(s) '%N' - Nickname '%L' - Last name '%l' - Last initial '%p' - Postfix If no value for format option was provided, its default value is '%t%F%m%N%L%p'
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :format
|
39
|
+
|
40
|
+
# Parsed name
|
41
|
+
# @return [Array<AiNameComponent>]
|
42
|
+
attr_accessor :parsed_name
|
43
|
+
|
44
|
+
# Other parsed name to match
|
45
|
+
# @return [Array<AiNameComponent>]
|
46
|
+
attr_accessor :other_parsed_name
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'cultural_context' => :'culturalContext',
|
52
|
+
:'format' => :'format',
|
53
|
+
:'parsed_name' => :'parsedName',
|
54
|
+
:'other_parsed_name' => :'otherParsedName'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.swagger_types
|
60
|
+
{
|
61
|
+
:'cultural_context' => :'AiNameCulturalContext',
|
62
|
+
:'format' => :'String',
|
63
|
+
:'parsed_name' => :'Array<AiNameComponent>',
|
64
|
+
:'other_parsed_name' => :'Array<AiNameComponent>'
|
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?(:'culturalContext')
|
77
|
+
self.cultural_context = attributes[:'culturalContext']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'format')
|
81
|
+
self.format = attributes[:'format']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'parsedName')
|
85
|
+
if (value = attributes[:'parsedName']).is_a?(Array)
|
86
|
+
self.parsed_name = value
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'otherParsedName')
|
91
|
+
if (value = attributes[:'otherParsedName']).is_a?(Array)
|
92
|
+
self.other_parsed_name = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Initializes the object
|
98
|
+
# @param [AiNameCulturalContext] cultural_context AiName parser cultural context
|
99
|
+
# @param [String] format Format of the name. Predefined format can be used by ID, or custom format can be specified. Predefined formats: /format/default/ (= '%t%F%m%N%L%p') /format/FN+LN/ (= '%F%L') /format/title+FN+LN/ (= '%t%F%L') /format/FN+MN+LN/ (= '%F%M%N%L') /format/title+FN+MN+LN/ (= '%t%F%M%N%L') /format/FN+MI+LN/ (= '%F%m%N%L') /format/title+FN+MI+LN/ (= '%t%F%m%N%L') /format/LN/ (= '%L') /format/title+LN/ (= '%t%L') /format/LN+FN+MN/ (= '%L,%F%M%N') /format/LN+title+FN+MN/ (= '%L,%t%F%M%N') /format/LN+FN+MI/ (= '%L,%F%m%N') /format/LN+title+FN+MI/ (= '%L,%t%F%m%N') Custom format string - custom combination of characters and the next term placeholders: '%t' - Title (prefix) '%F' - First name '%f' - First initial '%M' - Middle name(s) '%m' - Middle initial(s) '%N' - Nickname '%L' - Last name '%l' - Last initial '%p' - Postfix If no value for format option was provided, its default value is '%t%F%m%N%L%p'
|
100
|
+
# @param [Array<AiNameComponent>] parsed_name Parsed name
|
101
|
+
# @param [Array<AiNameComponent>] other_parsed_name Other parsed name to match
|
102
|
+
def initialize(cultural_context=nil, format=nil, parsed_name=nil, other_parsed_name=nil)
|
103
|
+
self.cultural_context = cultural_context if cultural_context
|
104
|
+
self.format = format if format
|
105
|
+
self.parsed_name = parsed_name if parsed_name
|
106
|
+
self.other_parsed_name = other_parsed_name if other_parsed_name
|
107
|
+
end
|
108
|
+
|
109
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
110
|
+
# @return Array for valid properties with the reasons
|
111
|
+
def list_invalid_properties
|
112
|
+
invalid_properties = Array.new
|
113
|
+
if @parsed_name.nil?
|
114
|
+
invalid_properties.push('invalid value for "parsed_name", parsed_name cannot be nil.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if @other_parsed_name.nil?
|
118
|
+
invalid_properties.push('invalid value for "other_parsed_name", other_parsed_name cannot be nil.')
|
119
|
+
end
|
120
|
+
|
121
|
+
invalid_properties
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check to see if the all the properties in the model are valid
|
125
|
+
# @return true if the model is valid
|
126
|
+
def valid?
|
127
|
+
return false if @parsed_name.nil?
|
128
|
+
return false if @other_parsed_name.nil?
|
129
|
+
true
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
cultural_context == o.cultural_context &&
|
138
|
+
format == o.format &&
|
139
|
+
parsed_name == o.parsed_name &&
|
140
|
+
other_parsed_name == o.other_parsed_name
|
141
|
+
end
|
142
|
+
|
143
|
+
# @see the `==` method
|
144
|
+
# @param [Object] Object to be compared
|
145
|
+
def eql?(o)
|
146
|
+
self == o
|
147
|
+
end
|
148
|
+
|
149
|
+
# Calculates hash code according to all attributes.
|
150
|
+
# @return [Fixnum] Hash code
|
151
|
+
def hash
|
152
|
+
[cultural_context, format, parsed_name, other_parsed_name].hash
|
153
|
+
end
|
154
|
+
|
155
|
+
# Builds the object from hash
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
+
# @return [Object] Returns the model itself
|
158
|
+
def build_from_hash(attributes)
|
159
|
+
return nil unless attributes.is_a?(Hash)
|
160
|
+
self.class.swagger_types.each_pair do |key, type|
|
161
|
+
attribute_key = self.class.attribute_map[key]
|
162
|
+
attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
|
163
|
+
if type =~ /\AArray<(.*)>/i
|
164
|
+
# check to ensure the input is an array given that the the attribute
|
165
|
+
# is documented as an array but the input is not
|
166
|
+
if attributes[attribute_key].is_a?(Array)
|
167
|
+
self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
|
168
|
+
end
|
169
|
+
elsif !attributes[attribute_key].nil?
|
170
|
+
self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
|
171
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
172
|
+
end
|
173
|
+
|
174
|
+
self
|
175
|
+
end
|
176
|
+
|
177
|
+
# Deserializes the data based on type
|
178
|
+
# @param string type Data type
|
179
|
+
# @param string value Value to be deserialized
|
180
|
+
# @return [Object] Deserialized data
|
181
|
+
def _deserialize(type, value)
|
182
|
+
case type.to_sym
|
183
|
+
when :DateTime
|
184
|
+
DateTime.parse(value)
|
185
|
+
when :Date
|
186
|
+
Date.parse(value)
|
187
|
+
when :String
|
188
|
+
value.to_s
|
189
|
+
when :Integer
|
190
|
+
value.to_i
|
191
|
+
when :Float
|
192
|
+
value.to_f
|
193
|
+
when :BOOLEAN
|
194
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
195
|
+
true
|
196
|
+
else
|
197
|
+
false
|
198
|
+
end
|
199
|
+
when :Object
|
200
|
+
# generic object (usually a Hash), return directly
|
201
|
+
value
|
202
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
203
|
+
inner_type = Regexp.last_match[:inner_type]
|
204
|
+
value.map { |v| _deserialize(inner_type, v) }
|
205
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
206
|
+
k_type = Regexp.last_match[:k_type]
|
207
|
+
v_type = Regexp.last_match[:v_type]
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each do |k, v|
|
210
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
else # model
|
214
|
+
type = value[:type] || type
|
215
|
+
temp_model = AsposeEmailCloud.const_get(type).new
|
216
|
+
temp_model.build_from_hash(value)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the string representation of the object
|
221
|
+
# @return [String] String presentation of the object
|
222
|
+
def to_s
|
223
|
+
to_hash.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_body
|
229
|
+
to_hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = self.send(attr)
|
238
|
+
next if value.nil?
|
239
|
+
hash[param] = _to_hash(value)
|
240
|
+
end
|
241
|
+
hash
|
242
|
+
end
|
243
|
+
|
244
|
+
# Outputs non-array value in the form of hash
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
246
|
+
# @param [Object] value Any valid value
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
248
|
+
def _to_hash(value)
|
249
|
+
if value.is_a?(Array)
|
250
|
+
value.compact.map { |v| _to_hash(v) }
|
251
|
+
elsif value.is_a?(Hash)
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
254
|
+
end
|
255
|
+
elsif value.respond_to? :to_hash
|
256
|
+
value.to_hash
|
257
|
+
else
|
258
|
+
value
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
end
|