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
@@ -27,128 +27,128 @@
|
|
27
27
|
require 'date'
|
28
28
|
|
29
29
|
module AsposeEmailCloud
|
30
|
-
# Simple indexed property
|
31
|
-
class IndexedPrimitiveObject
|
32
|
-
# Gets or sets the name of an object.
|
33
|
-
# @return [String]
|
34
|
-
attr_accessor :name
|
35
|
-
|
36
|
-
# Property type. Used for deserialization purposes
|
37
|
-
# @return [String]
|
30
|
+
# Simple indexed property
|
31
|
+
class IndexedPrimitiveObject
|
32
|
+
# Gets or sets the name of an object.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :name
|
35
|
+
|
36
|
+
# Property type. Used for deserialization purposes
|
37
|
+
# @return [String]
|
38
38
|
def type #getter method
|
39
39
|
self.class.name.split('::').last
|
40
40
|
end
|
41
41
|
|
42
42
|
def type=(type) #setter method, parameter ignored
|
43
43
|
@type = self.class.name.split('::').last
|
44
|
-
end
|
45
|
-
|
46
|
-
# Index of property in list
|
47
|
-
# @return [Integer]
|
48
|
-
attr_accessor :index
|
49
|
-
|
50
|
-
# Gets or sets the name of a property.
|
51
|
-
# @return [String]
|
52
|
-
attr_accessor :value
|
53
|
-
|
54
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
-
def self.attribute_map
|
56
|
-
{
|
57
|
-
:'name' => :'name',
|
58
|
-
:'type' => :'type',
|
59
|
-
:'index' => :'index',
|
60
|
-
:'value' => :'value'
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
# Attribute type mapping.
|
65
|
-
def self.swagger_types
|
66
|
-
{
|
67
|
-
:'name' => :'String',
|
68
|
-
:'type' => :'String',
|
69
|
-
:'index' => :'Integer',
|
70
|
-
:'value' => :'String'
|
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?(:'name')
|
83
|
-
self.name = attributes[:'name']
|
84
|
-
end
|
85
|
-
|
86
|
-
if attributes.has_key?(:'type')
|
87
|
-
@type = self.class.name.split('::').last
|
88
|
-
end
|
89
|
-
|
90
|
-
if attributes.has_key?(:'index')
|
91
|
-
self.index = attributes[:'index']
|
92
|
-
end
|
93
|
-
|
94
|
-
if attributes.has_key?(:'value')
|
95
|
-
self.value = attributes[:'value']
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
# Initializes the object
|
100
|
-
# @param [String] name Gets or sets the name of an object.
|
101
|
-
# @param [String] type Property type. Used for deserialization purposes
|
102
|
-
# @param [Integer] index Index of property in list
|
103
|
-
# @param [String] value Gets or sets the name of a property.
|
104
|
-
def initialize(name=nil, type=nil, index=nil, value=nil)
|
105
|
-
self.name = name if name
|
106
|
-
@type = self.class.name.split('::').last if type
|
107
|
-
self.index = index if index
|
108
|
-
self.value = value if value
|
109
|
-
end
|
110
|
-
|
111
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
112
|
-
# @return Array for valid properties with the reasons
|
113
|
-
def list_invalid_properties
|
114
|
-
invalid_properties = Array.new
|
115
|
-
if @index.nil?
|
116
|
-
invalid_properties.push('invalid value for "index", index cannot be nil.')
|
117
|
-
end
|
118
|
-
|
119
|
-
invalid_properties
|
120
|
-
end
|
121
|
-
|
122
|
-
# Check to see if the all the properties in the model are valid
|
123
|
-
# @return true if the model is valid
|
124
|
-
def valid?
|
125
|
-
return false if @index.nil?
|
126
|
-
true
|
127
|
-
end
|
128
|
-
|
129
|
-
# Checks equality by comparing each attribute.
|
130
|
-
# @param [Object] Object to be compared
|
131
|
-
def ==(o)
|
132
|
-
return true if self.equal?(o)
|
133
|
-
self.class == o.class &&
|
134
|
-
name == o.name &&
|
135
|
-
type == o.type &&
|
136
|
-
index == o.index &&
|
137
|
-
value == o.value
|
138
|
-
end
|
139
|
-
|
140
|
-
# @see the `==` method
|
141
|
-
# @param [Object] Object to be compared
|
142
|
-
def eql?(o)
|
143
|
-
self == o
|
144
|
-
end
|
145
|
-
|
146
|
-
# Calculates hash code according to all attributes.
|
147
|
-
# @return [Fixnum] Hash code
|
148
|
-
def hash
|
149
|
-
[name, type, index, value].hash
|
150
|
-
end
|
151
|
-
|
44
|
+
end
|
45
|
+
|
46
|
+
# Index of property in list
|
47
|
+
# @return [Integer]
|
48
|
+
attr_accessor :index
|
49
|
+
|
50
|
+
# Gets or sets the name of a property.
|
51
|
+
# @return [String]
|
52
|
+
attr_accessor :value
|
53
|
+
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
+
def self.attribute_map
|
56
|
+
{
|
57
|
+
:'name' => :'name',
|
58
|
+
:'type' => :'type',
|
59
|
+
:'index' => :'index',
|
60
|
+
:'value' => :'value'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.swagger_types
|
66
|
+
{
|
67
|
+
:'name' => :'String',
|
68
|
+
:'type' => :'String',
|
69
|
+
:'index' => :'Integer',
|
70
|
+
:'value' => :'String'
|
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?(:'name')
|
83
|
+
self.name = attributes[:'name']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'type')
|
87
|
+
@type = self.class.name.split('::').last
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'index')
|
91
|
+
self.index = attributes[:'index']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'value')
|
95
|
+
self.value = attributes[:'value']
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Initializes the object
|
100
|
+
# @param [String] name Gets or sets the name of an object.
|
101
|
+
# @param [String] type Property type. Used for deserialization purposes
|
102
|
+
# @param [Integer] index Index of property in list
|
103
|
+
# @param [String] value Gets or sets the name of a property.
|
104
|
+
def initialize(name=nil, type=nil, index=nil, value=nil)
|
105
|
+
self.name = name if name
|
106
|
+
@type = self.class.name.split('::').last if type
|
107
|
+
self.index = index if index
|
108
|
+
self.value = value if value
|
109
|
+
end
|
110
|
+
|
111
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
112
|
+
# @return Array for valid properties with the reasons
|
113
|
+
def list_invalid_properties
|
114
|
+
invalid_properties = Array.new
|
115
|
+
if @index.nil?
|
116
|
+
invalid_properties.push('invalid value for "index", index cannot be nil.')
|
117
|
+
end
|
118
|
+
|
119
|
+
invalid_properties
|
120
|
+
end
|
121
|
+
|
122
|
+
# Check to see if the all the properties in the model are valid
|
123
|
+
# @return true if the model is valid
|
124
|
+
def valid?
|
125
|
+
return false if @index.nil?
|
126
|
+
true
|
127
|
+
end
|
128
|
+
|
129
|
+
# Checks equality by comparing each attribute.
|
130
|
+
# @param [Object] Object to be compared
|
131
|
+
def ==(o)
|
132
|
+
return true if self.equal?(o)
|
133
|
+
self.class == o.class &&
|
134
|
+
name == o.name &&
|
135
|
+
type == o.type &&
|
136
|
+
index == o.index &&
|
137
|
+
value == o.value
|
138
|
+
end
|
139
|
+
|
140
|
+
# @see the `==` method
|
141
|
+
# @param [Object] Object to be compared
|
142
|
+
def eql?(o)
|
143
|
+
self == o
|
144
|
+
end
|
145
|
+
|
146
|
+
# Calculates hash code according to all attributes.
|
147
|
+
# @return [Fixnum] Hash code
|
148
|
+
def hash
|
149
|
+
[name, type, index, value].hash
|
150
|
+
end
|
151
|
+
|
152
152
|
# Builds the object from hash
|
153
153
|
# @param [Hash] attributes Model attributes in the form of hash
|
154
154
|
# @return [Object] Returns the model itself
|
@@ -255,6 +255,6 @@ module AsposeEmailCloud
|
|
255
255
|
value
|
256
256
|
end
|
257
257
|
end
|
258
|
-
|
258
|
+
|
259
259
|
end
|
260
260
|
end
|
@@ -0,0 +1,241 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="InstantMessengerAddress.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
|
+
# Instant messenger address.
|
31
|
+
class InstantMessengerAddress
|
32
|
+
# Address category.
|
33
|
+
# @return [EnumWithCustomOfInstantMessengerCategory]
|
34
|
+
attr_accessor :category
|
35
|
+
|
36
|
+
# Address.
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :address
|
39
|
+
|
40
|
+
# Determines whether this address 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
|
+
:'address' => :'address',
|
49
|
+
:'preferred' => :'preferred'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
:'category' => :'EnumWithCustomOfInstantMessengerCategory',
|
57
|
+
:'address' => :'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?(:'address')
|
75
|
+
self.address = attributes[:'address']
|
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 [EnumWithCustomOfInstantMessengerCategory] category Address category.
|
85
|
+
# @param [String] address Address.
|
86
|
+
# @param [BOOLEAN] preferred Determines whether this address is preferred.
|
87
|
+
def initialize(category=nil, address=nil, preferred=nil)
|
88
|
+
self.category = category if category
|
89
|
+
self.address = address if address
|
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
|
+
address == o.address &&
|
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, address, 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
|