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.
- checksums.yaml +4 -4
- data/lib/aspose-email-cloud.rb +65 -0
- data/lib/aspose-email-cloud/api/email_api.rb +158 -1
- data/lib/aspose-email-cloud/models/ai_bcr_parse_ocr_data_rq.rb +230 -0
- data/lib/aspose-email-cloud/models/alternate_view.rb +279 -0
- data/lib/aspose-email-cloud/models/append_email_model_rq.rb +333 -0
- data/lib/aspose-email-cloud/models/associated_person.rb +241 -0
- data/lib/aspose-email-cloud/models/attachment.rb +321 -0
- data/lib/aspose-email-cloud/models/attachment_base.rb +251 -0
- data/lib/aspose-email-cloud/models/base_object.rb +86 -86
- data/lib/aspose-email-cloud/models/calendar_dto.rb +554 -0
- data/lib/aspose-email-cloud/models/calendar_dto_alternate_rq.rb +265 -0
- data/lib/aspose-email-cloud/models/calendar_dto_list.rb +212 -0
- data/lib/aspose-email-cloud/models/calendar_reminder.rb +315 -0
- data/lib/aspose-email-cloud/models/contact_dto.rb +696 -0
- data/lib/aspose-email-cloud/models/contact_dto_list.rb +212 -0
- data/lib/aspose-email-cloud/models/contact_photo.rb +228 -0
- data/lib/aspose-email-cloud/models/content_type.rb +264 -0
- data/lib/aspose-email-cloud/models/content_type_parameter.rb +223 -0
- data/lib/aspose-email-cloud/models/customer_event.rb +228 -0
- data/lib/aspose-email-cloud/models/email_address.rb +267 -0
- data/lib/aspose-email-cloud/models/email_dto.rb +678 -0
- data/lib/aspose-email-cloud/models/email_dto_list.rb +212 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_associated_person_category.rb +227 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_email_address_category.rb +227 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_event_category.rb +227 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_instant_messenger_category.rb +227 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_phone_number_category.rb +227 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_postal_address_category.rb +227 -0
- data/lib/aspose-email-cloud/models/enum_with_custom_of_url_category.rb +227 -0
- data/lib/aspose-email-cloud/models/hierarchical_object.rb +101 -101
- data/lib/aspose-email-cloud/models/indexed_hierarchical_object.rb +119 -119
- data/lib/aspose-email-cloud/models/indexed_primitive_object.rb +117 -117
- data/lib/aspose-email-cloud/models/instant_messenger_address.rb +241 -0
- data/lib/aspose-email-cloud/models/linked_resource.rb +264 -0
- data/lib/aspose-email-cloud/models/list_response_of_contact_dto.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_email_dto.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_calendar_dto.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_contact_dto.rb +211 -0
- data/lib/aspose-email-cloud/models/list_response_of_storage_model_of_email_dto.rb +211 -0
- data/lib/aspose-email-cloud/models/mail_address.rb +241 -0
- data/lib/aspose-email-cloud/models/phone_number.rb +241 -0
- data/lib/aspose-email-cloud/models/postal_address.rb +350 -0
- data/lib/aspose-email-cloud/models/primitive_object.rb +99 -99
- data/lib/aspose-email-cloud/models/reminder_attendee.rb +210 -0
- data/lib/aspose-email-cloud/models/reminder_trigger.rb +246 -0
- data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_model_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/ai_bcr_parse_ocr_data_model_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/append_email_model_message_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/convert_calendar_model_to_alternate_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/requests/convert_email_request_data.rb +83 -0
- data/lib/aspose-email-cloud/models/requests/fetch_email_model_request_data.rb +93 -0
- data/lib/aspose-email-cloud/models/requests/get_calendar_model_as_alternate_request_data.rb +91 -0
- data/lib/aspose-email-cloud/models/requests/get_calendar_model_list_request_data.rb +85 -0
- data/lib/aspose-email-cloud/models/requests/get_calendar_model_request_data.rb +81 -0
- data/lib/aspose-email-cloud/models/requests/get_contact_model_list_request_data.rb +87 -0
- data/lib/aspose-email-cloud/models/requests/get_contact_model_request_data.rb +88 -0
- data/lib/aspose-email-cloud/models/requests/get_email_as_file_request_data.rb +88 -0
- data/lib/aspose-email-cloud/models/requests/get_email_model_list_request_data.rb +87 -0
- data/lib/aspose-email-cloud/models/requests/get_email_model_request_data.rb +88 -0
- data/lib/aspose-email-cloud/models/requests/list_email_messages_request_data.rb +1 -1
- data/lib/aspose-email-cloud/models/requests/list_email_models_request_data.rb +105 -0
- data/lib/aspose-email-cloud/models/requests/save_calendar_model_request_data.rb +82 -0
- data/lib/aspose-email-cloud/models/requests/save_contact_model_request_data.rb +89 -0
- data/lib/aspose-email-cloud/models/requests/save_email_model_request_data.rb +89 -0
- data/lib/aspose-email-cloud/models/requests/send_email_model_request_data.rb +75 -0
- data/lib/aspose-email-cloud/models/send_email_model_rq.rb +273 -0
- data/lib/aspose-email-cloud/models/storage_model_of_calendar_dto.rb +222 -0
- data/lib/aspose-email-cloud/models/storage_model_of_contact_dto.rb +222 -0
- data/lib/aspose-email-cloud/models/storage_model_of_email_dto.rb +222 -0
- data/lib/aspose-email-cloud/models/storage_model_rq_of_calendar_dto.rb +222 -0
- data/lib/aspose-email-cloud/models/storage_model_rq_of_contact_dto.rb +222 -0
- data/lib/aspose-email-cloud/models/storage_model_rq_of_email_dto.rb +222 -0
- data/lib/aspose-email-cloud/models/url.rb +241 -0
- data/lib/aspose-email-cloud/models/value_response.rb +1 -1
- data/lib/aspose-email-cloud/version.rb +1 -1
- metadata +67 -2
@@ -0,0 +1,212 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="ContactDtoList.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
|
+
# List of contact documents
|
31
|
+
class ContactDtoList
|
32
|
+
|
33
|
+
# @return [Array<StorageModelOfContactDto>]
|
34
|
+
attr_accessor :value
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'value' => :'value'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.swagger_types
|
45
|
+
{
|
46
|
+
:'value' => :'Array<StorageModelOfContactDto>'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
57
|
+
|
58
|
+
if attributes.has_key?(:'value')
|
59
|
+
if (value = attributes[:'value']).is_a?(Array)
|
60
|
+
self.value = value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Array<StorageModelOfContactDto>] value
|
67
|
+
def initialize(value=nil)
|
68
|
+
self.value = value if value
|
69
|
+
end
|
70
|
+
|
71
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
72
|
+
# @return Array for valid properties with the reasons
|
73
|
+
def list_invalid_properties
|
74
|
+
invalid_properties = Array.new
|
75
|
+
invalid_properties
|
76
|
+
end
|
77
|
+
|
78
|
+
# Check to see if the all the properties in the model are valid
|
79
|
+
# @return true if the model is valid
|
80
|
+
def valid?
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
# Checks equality by comparing each attribute.
|
85
|
+
# @param [Object] Object to be compared
|
86
|
+
def ==(o)
|
87
|
+
return true if self.equal?(o)
|
88
|
+
self.class == o.class &&
|
89
|
+
value == o.value
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Fixnum] Hash code
|
100
|
+
def hash
|
101
|
+
[value].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def build_from_hash(attributes)
|
108
|
+
return nil unless attributes.is_a?(Hash)
|
109
|
+
self.class.swagger_types.each_pair do |key, type|
|
110
|
+
attribute_key = self.class.attribute_map[key]
|
111
|
+
attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[attribute_key].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[attribute_key].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :BOOLEAN
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
type = value[:type] || type
|
164
|
+
temp_model = AsposeEmailCloud.const_get(type).new
|
165
|
+
temp_model.build_from_hash(value)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the string representation of the object
|
170
|
+
# @return [String] String presentation of the object
|
171
|
+
def to_s
|
172
|
+
to_hash.to_s
|
173
|
+
end
|
174
|
+
|
175
|
+
# to_body is an alias to to_hash (backward compatibility)
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_body
|
178
|
+
to_hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the object in the form of hash
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_hash
|
184
|
+
hash = {}
|
185
|
+
self.class.attribute_map.each_pair do |attr, param|
|
186
|
+
value = self.send(attr)
|
187
|
+
next if value.nil?
|
188
|
+
hash[param] = _to_hash(value)
|
189
|
+
end
|
190
|
+
hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Outputs non-array value in the form of hash
|
194
|
+
# For object, use to_hash. Otherwise, just return the value
|
195
|
+
# @param [Object] value Any valid value
|
196
|
+
# @return [Hash] Returns the value in the form of hash
|
197
|
+
def _to_hash(value)
|
198
|
+
if value.is_a?(Array)
|
199
|
+
value.compact.map { |v| _to_hash(v) }
|
200
|
+
elsif value.is_a?(Hash)
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
203
|
+
end
|
204
|
+
elsif value.respond_to? :to_hash
|
205
|
+
value.to_hash
|
206
|
+
else
|
207
|
+
value
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="ContactPhoto.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
|
+
# Person's photo.
|
31
|
+
class ContactPhoto
|
32
|
+
# MapiContact photo image format. Enum, available values: Undefined, Jpeg, Gif, Wmf, Bmp, Tiff
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :photo_image_format
|
35
|
+
|
36
|
+
# Photo serialized as base64 string.
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :base64_data
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'photo_image_format' => :'photoImageFormat',
|
44
|
+
:'base64_data' => :'base64Data'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'photo_image_format' => :'String',
|
52
|
+
:'base64_data' => :'String'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
|
+
|
64
|
+
if attributes.has_key?(:'photoImageFormat')
|
65
|
+
self.photo_image_format = attributes[:'photoImageFormat']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'base64Data')
|
69
|
+
self.base64_data = attributes[:'base64Data']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [String] photo_image_format MapiContact photo image format. Enum, available values: Undefined, Jpeg, Gif, Wmf, Bmp, Tiff
|
75
|
+
# @param [String] base64_data Photo serialized as base64 string.
|
76
|
+
def initialize(photo_image_format=nil, base64_data=nil)
|
77
|
+
self.photo_image_format = photo_image_format if photo_image_format
|
78
|
+
self.base64_data = base64_data if base64_data
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
if @photo_image_format.nil?
|
86
|
+
invalid_properties.push('invalid value for "photo_image_format", photo_image_format cannot be nil.')
|
87
|
+
end
|
88
|
+
|
89
|
+
invalid_properties
|
90
|
+
end
|
91
|
+
|
92
|
+
# Check to see if the all the properties in the model are valid
|
93
|
+
# @return true if the model is valid
|
94
|
+
def valid?
|
95
|
+
return false if @photo_image_format.nil?
|
96
|
+
true
|
97
|
+
end
|
98
|
+
|
99
|
+
# Checks equality by comparing each attribute.
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
photo_image_format == o.photo_image_format &&
|
105
|
+
base64_data == o.base64_data
|
106
|
+
end
|
107
|
+
|
108
|
+
# @see the `==` method
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def eql?(o)
|
111
|
+
self == o
|
112
|
+
end
|
113
|
+
|
114
|
+
# Calculates hash code according to all attributes.
|
115
|
+
# @return [Fixnum] Hash code
|
116
|
+
def hash
|
117
|
+
[photo_image_format, base64_data].hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
self.class.swagger_types.each_pair do |key, type|
|
126
|
+
attribute_key = self.class.attribute_map[key]
|
127
|
+
attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
|
128
|
+
if type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[attribute_key].is_a?(Array)
|
132
|
+
self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
|
133
|
+
end
|
134
|
+
elsif !attributes[attribute_key].nil?
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
|
136
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
137
|
+
end
|
138
|
+
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserializes the data based on type
|
143
|
+
# @param string type Data type
|
144
|
+
# @param string value Value to be deserialized
|
145
|
+
# @return [Object] Deserialized data
|
146
|
+
def _deserialize(type, value)
|
147
|
+
case type.to_sym
|
148
|
+
when :DateTime
|
149
|
+
DateTime.parse(value)
|
150
|
+
when :Date
|
151
|
+
Date.parse(value)
|
152
|
+
when :String
|
153
|
+
value.to_s
|
154
|
+
when :Integer
|
155
|
+
value.to_i
|
156
|
+
when :Float
|
157
|
+
value.to_f
|
158
|
+
when :BOOLEAN
|
159
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
when :Object
|
165
|
+
# generic object (usually a Hash), return directly
|
166
|
+
value
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each do |k, v|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
else # model
|
179
|
+
type = value[:type] || type
|
180
|
+
temp_model = AsposeEmailCloud.const_get(type).new
|
181
|
+
temp_model.build_from_hash(value)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the string representation of the object
|
186
|
+
# @return [String] String presentation of the object
|
187
|
+
def to_s
|
188
|
+
to_hash.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_body
|
194
|
+
to_hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the object in the form of hash
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_hash
|
200
|
+
hash = {}
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
202
|
+
value = self.send(attr)
|
203
|
+
next if value.nil?
|
204
|
+
hash[param] = _to_hash(value)
|
205
|
+
end
|
206
|
+
hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Outputs non-array value in the form of hash
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
211
|
+
# @param [Object] value Any valid value
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
213
|
+
def _to_hash(value)
|
214
|
+
if value.is_a?(Array)
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
216
|
+
elsif value.is_a?(Hash)
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
+
end
|
220
|
+
elsif value.respond_to? :to_hash
|
221
|
+
value.to_hash
|
222
|
+
else
|
223
|
+
value
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
228
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="ContentType.rb">
|
3
|
+
# Copyright (c) 2018-2019 Aspose Pty Ltd. All rights reserved.
|
4
|
+
# </copyright>
|
5
|
+
# <summary>
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a
|
7
|
+
# copy of this software and associated documentation files (the "Software"),
|
8
|
+
# to deal in the Software without restriction, including without limitation
|
9
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
10
|
+
# and/or sell copies of the Software, and to permit persons to whom the
|
11
|
+
# Software is furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
22
|
+
# DEALINGS IN THE SOFTWARE.
|
23
|
+
# </summary>
|
24
|
+
# ----------------------------------------------------------------------------
|
25
|
+
|
26
|
+
|
27
|
+
require 'date'
|
28
|
+
|
29
|
+
module AsposeEmailCloud
|
30
|
+
# Represents a Content-Type header.
|
31
|
+
class ContentType
|
32
|
+
# The boundary parameter included in the Content-Type header.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :boundary
|
35
|
+
|
36
|
+
# CharSet parameter.
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :char_set
|
39
|
+
|
40
|
+
# The internet media type.
|
41
|
+
# @return [String]
|
42
|
+
attr_accessor :media_type
|
43
|
+
|
44
|
+
# Name parameter.
|
45
|
+
# @return [String]
|
46
|
+
attr_accessor :name
|
47
|
+
|
48
|
+
# Full list of parameters
|
49
|
+
# @return [Array<ContentTypeParameter>]
|
50
|
+
attr_accessor :parameters
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'boundary' => :'boundary',
|
56
|
+
:'char_set' => :'charSet',
|
57
|
+
:'media_type' => :'mediaType',
|
58
|
+
:'name' => :'name',
|
59
|
+
:'parameters' => :'parameters'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Attribute type mapping.
|
64
|
+
def self.swagger_types
|
65
|
+
{
|
66
|
+
:'boundary' => :'String',
|
67
|
+
:'char_set' => :'String',
|
68
|
+
:'media_type' => :'String',
|
69
|
+
:'name' => :'String',
|
70
|
+
:'parameters' => :'Array<ContentTypeParameter>'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes the object
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
76
|
+
def initialize(attributes = {})
|
77
|
+
return unless attributes.is_a?(Hash)
|
78
|
+
|
79
|
+
# convert string to symbol for hash key
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
81
|
+
|
82
|
+
if attributes.has_key?(:'boundary')
|
83
|
+
self.boundary = attributes[:'boundary']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'charSet')
|
87
|
+
self.char_set = attributes[:'charSet']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'mediaType')
|
91
|
+
self.media_type = attributes[:'mediaType']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'name')
|
95
|
+
self.name = attributes[:'name']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'parameters')
|
99
|
+
if (value = attributes[:'parameters']).is_a?(Array)
|
100
|
+
self.parameters = value
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Initializes the object
|
106
|
+
# @param [String] boundary The boundary parameter included in the Content-Type header.
|
107
|
+
# @param [String] char_set CharSet parameter.
|
108
|
+
# @param [String] media_type The internet media type.
|
109
|
+
# @param [String] name Name parameter.
|
110
|
+
# @param [Array<ContentTypeParameter>] parameters Full list of parameters
|
111
|
+
def initialize(boundary=nil, char_set=nil, media_type=nil, name=nil, parameters=nil)
|
112
|
+
self.boundary = boundary if boundary
|
113
|
+
self.char_set = char_set if char_set
|
114
|
+
self.media_type = media_type if media_type
|
115
|
+
self.name = name if name
|
116
|
+
self.parameters = parameters if parameters
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properties with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = Array.new
|
123
|
+
invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
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
|
+
boundary == o.boundary &&
|
138
|
+
char_set == o.char_set &&
|
139
|
+
media_type == o.media_type &&
|
140
|
+
name == o.name &&
|
141
|
+
parameters == o.parameters
|
142
|
+
end
|
143
|
+
|
144
|
+
# @see the `==` method
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def eql?(o)
|
147
|
+
self == o
|
148
|
+
end
|
149
|
+
|
150
|
+
# Calculates hash code according to all attributes.
|
151
|
+
# @return [Fixnum] Hash code
|
152
|
+
def hash
|
153
|
+
[boundary, char_set, media_type, name, parameters].hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Builds the object from hash
|
157
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
+
# @return [Object] Returns the model itself
|
159
|
+
def build_from_hash(attributes)
|
160
|
+
return nil unless attributes.is_a?(Hash)
|
161
|
+
self.class.swagger_types.each_pair do |key, type|
|
162
|
+
attribute_key = self.class.attribute_map[key]
|
163
|
+
attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
|
164
|
+
if type =~ /\AArray<(.*)>/i
|
165
|
+
# check to ensure the input is an array given that the the attribute
|
166
|
+
# is documented as an array but the input is not
|
167
|
+
if attributes[attribute_key].is_a?(Array)
|
168
|
+
self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
|
169
|
+
end
|
170
|
+
elsif !attributes[attribute_key].nil?
|
171
|
+
self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
|
172
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
173
|
+
end
|
174
|
+
|
175
|
+
self
|
176
|
+
end
|
177
|
+
|
178
|
+
# Deserializes the data based on type
|
179
|
+
# @param string type Data type
|
180
|
+
# @param string value Value to be deserialized
|
181
|
+
# @return [Object] Deserialized data
|
182
|
+
def _deserialize(type, value)
|
183
|
+
case type.to_sym
|
184
|
+
when :DateTime
|
185
|
+
DateTime.parse(value)
|
186
|
+
when :Date
|
187
|
+
Date.parse(value)
|
188
|
+
when :String
|
189
|
+
value.to_s
|
190
|
+
when :Integer
|
191
|
+
value.to_i
|
192
|
+
when :Float
|
193
|
+
value.to_f
|
194
|
+
when :BOOLEAN
|
195
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
196
|
+
true
|
197
|
+
else
|
198
|
+
false
|
199
|
+
end
|
200
|
+
when :Object
|
201
|
+
# generic object (usually a Hash), return directly
|
202
|
+
value
|
203
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
204
|
+
inner_type = Regexp.last_match[:inner_type]
|
205
|
+
value.map { |v| _deserialize(inner_type, v) }
|
206
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
207
|
+
k_type = Regexp.last_match[:k_type]
|
208
|
+
v_type = Regexp.last_match[:v_type]
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each do |k, v|
|
211
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
else # model
|
215
|
+
type = value[:type] || type
|
216
|
+
temp_model = AsposeEmailCloud.const_get(type).new
|
217
|
+
temp_model.build_from_hash(value)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the string representation of the object
|
222
|
+
# @return [String] String presentation of the object
|
223
|
+
def to_s
|
224
|
+
to_hash.to_s
|
225
|
+
end
|
226
|
+
|
227
|
+
# to_body is an alias to to_hash (backward compatibility)
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_body
|
230
|
+
to_hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the object in the form of hash
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_hash
|
236
|
+
hash = {}
|
237
|
+
self.class.attribute_map.each_pair do |attr, param|
|
238
|
+
value = self.send(attr)
|
239
|
+
next if value.nil?
|
240
|
+
hash[param] = _to_hash(value)
|
241
|
+
end
|
242
|
+
hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Outputs non-array value in the form of hash
|
246
|
+
# For object, use to_hash. Otherwise, just return the value
|
247
|
+
# @param [Object] value Any valid value
|
248
|
+
# @return [Hash] Returns the value in the form of hash
|
249
|
+
def _to_hash(value)
|
250
|
+
if value.is_a?(Array)
|
251
|
+
value.compact.map { |v| _to_hash(v) }
|
252
|
+
elsif value.is_a?(Hash)
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
255
|
+
end
|
256
|
+
elsif value.respond_to? :to_hash
|
257
|
+
value.to_hash
|
258
|
+
else
|
259
|
+
value
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
end
|