mailslurp_client 15.17.16 → 15.17.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailslurp_client/api/inbox_controller_api.rb +183 -0
- data/lib/mailslurp_client/api/sms_controller_api.rb +132 -0
- data/lib/mailslurp_client/api/tools_controller_api.rb +518 -0
- data/lib/mailslurp_client/models/alias_projection.rb +15 -15
- data/lib/mailslurp_client/models/attachment_projection.rb +16 -16
- data/lib/mailslurp_client/models/bounce_projection.rb +10 -10
- data/lib/mailslurp_client/models/connector_projection.rb +15 -15
- data/lib/mailslurp_client/models/generate_bimi_record_options.rb +282 -0
- data/lib/mailslurp_client/models/generate_bimi_record_results.rb +288 -0
- data/lib/mailslurp_client/models/generate_dmarc_record_options.rb +454 -0
- data/lib/mailslurp_client/models/generate_dmarc_record_results.rb +288 -0
- data/lib/mailslurp_client/models/generate_mta_sts_record_options.rb +329 -0
- data/lib/mailslurp_client/models/generate_mta_sts_record_results.rb +316 -0
- data/lib/mailslurp_client/models/generate_tls_reporting_record_options.rb +298 -0
- data/lib/mailslurp_client/models/generate_tls_reporting_record_results.rb +288 -0
- data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +11 -11
- data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +11 -11
- data/lib/mailslurp_client/models/lookup_bimi_domain_options.rb +211 -0
- data/lib/mailslurp_client/models/lookup_bimi_domain_results.rb +273 -0
- data/lib/mailslurp_client/models/lookup_dmarc_domain_options.rb +211 -0
- data/lib/mailslurp_client/models/lookup_dmarc_domain_results.rb +273 -0
- data/lib/mailslurp_client/models/lookup_mta_sts_domain_options.rb +211 -0
- data/lib/mailslurp_client/models/lookup_mta_sts_domain_results.rb +315 -0
- data/lib/mailslurp_client/models/lookup_tls_reporting_domain_options.rb +211 -0
- data/lib/mailslurp_client/models/lookup_tls_reporting_domain_results.rb +273 -0
- data/lib/mailslurp_client/models/reply_for_sms.rb +206 -0
- data/lib/mailslurp_client/models/sent_email_projection.rb +15 -15
- data/lib/mailslurp_client/models/sent_sms_dto.rb +351 -0
- data/lib/mailslurp_client/models/sms_reply_options.rb +211 -0
- data/lib/mailslurp_client/models/thread_projection.rb +16 -16
- data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
- data/lib/mailslurp_client/version.rb +1 -1
- data/lib/mailslurp_client.rb +20 -0
- metadata +22 -2
@@ -22,13 +22,13 @@ module MailSlurpClient
|
|
22
22
|
|
23
23
|
attr_accessor :user_id
|
24
24
|
|
25
|
+
# Attachment ID
|
26
|
+
attr_accessor :attachment_id
|
27
|
+
|
25
28
|
attr_accessor :created_at
|
26
29
|
|
27
30
|
attr_accessor :updated_at
|
28
31
|
|
29
|
-
# Attachment ID
|
30
|
-
attr_accessor :attachment_id
|
31
|
-
|
32
32
|
# Content type of attachment.
|
33
33
|
attr_accessor :content_type
|
34
34
|
|
@@ -38,9 +38,9 @@ module MailSlurpClient
|
|
38
38
|
:'name' => :'name',
|
39
39
|
:'content_length' => :'contentLength',
|
40
40
|
:'user_id' => :'userId',
|
41
|
+
:'attachment_id' => :'attachmentId',
|
41
42
|
:'created_at' => :'createdAt',
|
42
43
|
:'updated_at' => :'updatedAt',
|
43
|
-
:'attachment_id' => :'attachmentId',
|
44
44
|
:'content_type' => :'contentType'
|
45
45
|
}
|
46
46
|
end
|
@@ -51,9 +51,9 @@ module MailSlurpClient
|
|
51
51
|
:'name' => :'String',
|
52
52
|
:'content_length' => :'Integer',
|
53
53
|
:'user_id' => :'String',
|
54
|
+
:'attachment_id' => :'String',
|
54
55
|
:'created_at' => :'DateTime',
|
55
56
|
:'updated_at' => :'DateTime',
|
56
|
-
:'attachment_id' => :'String',
|
57
57
|
:'content_type' => :'String'
|
58
58
|
}
|
59
59
|
end
|
@@ -94,6 +94,10 @@ module MailSlurpClient
|
|
94
94
|
self.user_id = attributes[:'user_id']
|
95
95
|
end
|
96
96
|
|
97
|
+
if attributes.key?(:'attachment_id')
|
98
|
+
self.attachment_id = attributes[:'attachment_id']
|
99
|
+
end
|
100
|
+
|
97
101
|
if attributes.key?(:'created_at')
|
98
102
|
self.created_at = attributes[:'created_at']
|
99
103
|
end
|
@@ -102,10 +106,6 @@ module MailSlurpClient
|
|
102
106
|
self.updated_at = attributes[:'updated_at']
|
103
107
|
end
|
104
108
|
|
105
|
-
if attributes.key?(:'attachment_id')
|
106
|
-
self.attachment_id = attributes[:'attachment_id']
|
107
|
-
end
|
108
|
-
|
109
109
|
if attributes.key?(:'content_type')
|
110
110
|
self.content_type = attributes[:'content_type']
|
111
111
|
end
|
@@ -119,6 +119,10 @@ module MailSlurpClient
|
|
119
119
|
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
120
120
|
end
|
121
121
|
|
122
|
+
if @attachment_id.nil?
|
123
|
+
invalid_properties.push('invalid value for "attachment_id", attachment_id cannot be nil.')
|
124
|
+
end
|
125
|
+
|
122
126
|
if @created_at.nil?
|
123
127
|
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
124
128
|
end
|
@@ -127,10 +131,6 @@ module MailSlurpClient
|
|
127
131
|
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
128
132
|
end
|
129
133
|
|
130
|
-
if @attachment_id.nil?
|
131
|
-
invalid_properties.push('invalid value for "attachment_id", attachment_id cannot be nil.')
|
132
|
-
end
|
133
|
-
|
134
134
|
invalid_properties
|
135
135
|
end
|
136
136
|
|
@@ -138,9 +138,9 @@ module MailSlurpClient
|
|
138
138
|
# @return true if the model is valid
|
139
139
|
def valid?
|
140
140
|
return false if @user_id.nil?
|
141
|
+
return false if @attachment_id.nil?
|
141
142
|
return false if @created_at.nil?
|
142
143
|
return false if @updated_at.nil?
|
143
|
-
return false if @attachment_id.nil?
|
144
144
|
true
|
145
145
|
end
|
146
146
|
|
@@ -152,9 +152,9 @@ module MailSlurpClient
|
|
152
152
|
name == o.name &&
|
153
153
|
content_length == o.content_length &&
|
154
154
|
user_id == o.user_id &&
|
155
|
+
attachment_id == o.attachment_id &&
|
155
156
|
created_at == o.created_at &&
|
156
157
|
updated_at == o.updated_at &&
|
157
|
-
attachment_id == o.attachment_id &&
|
158
158
|
content_type == o.content_type
|
159
159
|
end
|
160
160
|
|
@@ -167,7 +167,7 @@ module MailSlurpClient
|
|
167
167
|
# Calculates hash code according to all attributes.
|
168
168
|
# @return [Integer] Hash code
|
169
169
|
def hash
|
170
|
-
[name, content_length, user_id, created_at, updated_at,
|
170
|
+
[name, content_length, user_id, attachment_id, created_at, updated_at, content_type].hash
|
171
171
|
end
|
172
172
|
|
173
173
|
# Builds the object from hash
|
@@ -17,10 +17,10 @@ module MailSlurpClient
|
|
17
17
|
class BounceProjection
|
18
18
|
attr_accessor :id
|
19
19
|
|
20
|
-
attr_accessor :subject
|
21
|
-
|
22
20
|
attr_accessor :sender
|
23
21
|
|
22
|
+
attr_accessor :subject
|
23
|
+
|
24
24
|
attr_accessor :created_at
|
25
25
|
|
26
26
|
attr_accessor :bounce_type
|
@@ -31,8 +31,8 @@ module MailSlurpClient
|
|
31
31
|
def self.attribute_map
|
32
32
|
{
|
33
33
|
:'id' => :'id',
|
34
|
-
:'subject' => :'subject',
|
35
34
|
:'sender' => :'sender',
|
35
|
+
:'subject' => :'subject',
|
36
36
|
:'created_at' => :'createdAt',
|
37
37
|
:'bounce_type' => :'bounceType',
|
38
38
|
:'bounce_mta' => :'bounceMta'
|
@@ -43,8 +43,8 @@ module MailSlurpClient
|
|
43
43
|
def self.openapi_types
|
44
44
|
{
|
45
45
|
:'id' => :'String',
|
46
|
-
:'subject' => :'String',
|
47
46
|
:'sender' => :'String',
|
47
|
+
:'subject' => :'String',
|
48
48
|
:'created_at' => :'DateTime',
|
49
49
|
:'bounce_type' => :'String',
|
50
50
|
:'bounce_mta' => :'String'
|
@@ -79,14 +79,14 @@ module MailSlurpClient
|
|
79
79
|
self.id = attributes[:'id']
|
80
80
|
end
|
81
81
|
|
82
|
-
if attributes.key?(:'subject')
|
83
|
-
self.subject = attributes[:'subject']
|
84
|
-
end
|
85
|
-
|
86
82
|
if attributes.key?(:'sender')
|
87
83
|
self.sender = attributes[:'sender']
|
88
84
|
end
|
89
85
|
|
86
|
+
if attributes.key?(:'subject')
|
87
|
+
self.subject = attributes[:'subject']
|
88
|
+
end
|
89
|
+
|
90
90
|
if attributes.key?(:'created_at')
|
91
91
|
self.created_at = attributes[:'created_at']
|
92
92
|
end
|
@@ -129,8 +129,8 @@ module MailSlurpClient
|
|
129
129
|
return true if self.equal?(o)
|
130
130
|
self.class == o.class &&
|
131
131
|
id == o.id &&
|
132
|
-
subject == o.subject &&
|
133
132
|
sender == o.sender &&
|
133
|
+
subject == o.subject &&
|
134
134
|
created_at == o.created_at &&
|
135
135
|
bounce_type == o.bounce_type &&
|
136
136
|
bounce_mta == o.bounce_mta
|
@@ -145,7 +145,7 @@ module MailSlurpClient
|
|
145
145
|
# Calculates hash code according to all attributes.
|
146
146
|
# @return [Integer] Hash code
|
147
147
|
def hash
|
148
|
-
[id,
|
148
|
+
[id, sender, subject, created_at, bounce_type, bounce_mta].hash
|
149
149
|
end
|
150
150
|
|
151
151
|
# Builds the object from hash
|
@@ -17,10 +17,10 @@ module MailSlurpClient
|
|
17
17
|
class ConnectorProjection
|
18
18
|
attr_accessor :id
|
19
19
|
|
20
|
-
attr_accessor :inbox_id
|
21
|
-
|
22
20
|
attr_accessor :user_id
|
23
21
|
|
22
|
+
attr_accessor :inbox_id
|
23
|
+
|
24
24
|
attr_accessor :created_at
|
25
25
|
|
26
26
|
attr_accessor :connector_type
|
@@ -57,8 +57,8 @@ module MailSlurpClient
|
|
57
57
|
def self.attribute_map
|
58
58
|
{
|
59
59
|
:'id' => :'id',
|
60
|
-
:'inbox_id' => :'inboxId',
|
61
60
|
:'user_id' => :'userId',
|
61
|
+
:'inbox_id' => :'inboxId',
|
62
62
|
:'created_at' => :'createdAt',
|
63
63
|
:'connector_type' => :'connectorType',
|
64
64
|
:'sync_schedule_type' => :'syncScheduleType',
|
@@ -71,8 +71,8 @@ module MailSlurpClient
|
|
71
71
|
def self.openapi_types
|
72
72
|
{
|
73
73
|
:'id' => :'String',
|
74
|
-
:'inbox_id' => :'String',
|
75
74
|
:'user_id' => :'String',
|
75
|
+
:'inbox_id' => :'String',
|
76
76
|
:'created_at' => :'DateTime',
|
77
77
|
:'connector_type' => :'String',
|
78
78
|
:'sync_schedule_type' => :'String',
|
@@ -106,14 +106,14 @@ module MailSlurpClient
|
|
106
106
|
self.id = attributes[:'id']
|
107
107
|
end
|
108
108
|
|
109
|
-
if attributes.key?(:'inbox_id')
|
110
|
-
self.inbox_id = attributes[:'inbox_id']
|
111
|
-
end
|
112
|
-
|
113
109
|
if attributes.key?(:'user_id')
|
114
110
|
self.user_id = attributes[:'user_id']
|
115
111
|
end
|
116
112
|
|
113
|
+
if attributes.key?(:'inbox_id')
|
114
|
+
self.inbox_id = attributes[:'inbox_id']
|
115
|
+
end
|
116
|
+
|
117
117
|
if attributes.key?(:'created_at')
|
118
118
|
self.created_at = attributes[:'created_at']
|
119
119
|
end
|
@@ -139,14 +139,14 @@ module MailSlurpClient
|
|
139
139
|
# @return Array for valid properties with the reasons
|
140
140
|
def list_invalid_properties
|
141
141
|
invalid_properties = Array.new
|
142
|
-
if @inbox_id.nil?
|
143
|
-
invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
|
144
|
-
end
|
145
|
-
|
146
142
|
if @user_id.nil?
|
147
143
|
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
148
144
|
end
|
149
145
|
|
146
|
+
if @inbox_id.nil?
|
147
|
+
invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
150
|
if @created_at.nil?
|
151
151
|
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
152
152
|
end
|
@@ -169,8 +169,8 @@ module MailSlurpClient
|
|
169
169
|
# Check to see if the all the properties in the model are valid
|
170
170
|
# @return true if the model is valid
|
171
171
|
def valid?
|
172
|
-
return false if @inbox_id.nil?
|
173
172
|
return false if @user_id.nil?
|
173
|
+
return false if @inbox_id.nil?
|
174
174
|
return false if @created_at.nil?
|
175
175
|
return false if @connector_type.nil?
|
176
176
|
connector_type_validator = EnumAttributeValidator.new('String', ["IMAP"])
|
@@ -208,8 +208,8 @@ module MailSlurpClient
|
|
208
208
|
return true if self.equal?(o)
|
209
209
|
self.class == o.class &&
|
210
210
|
id == o.id &&
|
211
|
-
inbox_id == o.inbox_id &&
|
212
211
|
user_id == o.user_id &&
|
212
|
+
inbox_id == o.inbox_id &&
|
213
213
|
created_at == o.created_at &&
|
214
214
|
connector_type == o.connector_type &&
|
215
215
|
sync_schedule_type == o.sync_schedule_type &&
|
@@ -226,7 +226,7 @@ module MailSlurpClient
|
|
226
226
|
# Calculates hash code according to all attributes.
|
227
227
|
# @return [Integer] Hash code
|
228
228
|
def hash
|
229
|
-
[id,
|
229
|
+
[id, user_id, inbox_id, created_at, connector_type, sync_schedule_type, sync_interval, sync_enabled].hash
|
230
230
|
end
|
231
231
|
|
232
232
|
# Builds the object from hash
|
@@ -0,0 +1,282 @@
|
|
1
|
+
=begin
|
2
|
+
#MailSlurp API
|
3
|
+
|
4
|
+
#MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 6.5.2
|
7
|
+
Contact: contact@mailslurp.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module MailSlurpClient
|
16
|
+
class GenerateBimiRecordOptions
|
17
|
+
attr_accessor :domain
|
18
|
+
|
19
|
+
attr_accessor :version
|
20
|
+
|
21
|
+
attr_accessor :logo_url
|
22
|
+
|
23
|
+
attr_accessor :vmc_url
|
24
|
+
|
25
|
+
class EnumAttributeValidator
|
26
|
+
attr_reader :datatype
|
27
|
+
attr_reader :allowable_values
|
28
|
+
|
29
|
+
def initialize(datatype, allowable_values)
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
31
|
+
case datatype.to_s
|
32
|
+
when /Integer/i
|
33
|
+
value.to_i
|
34
|
+
when /Float/i
|
35
|
+
value.to_f
|
36
|
+
else
|
37
|
+
value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def valid?(value)
|
43
|
+
!value || allowable_values.include?(value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'domain' => :'domain',
|
51
|
+
:'version' => :'version',
|
52
|
+
:'logo_url' => :'logoUrl',
|
53
|
+
:'vmc_url' => :'vmcUrl'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.openapi_types
|
59
|
+
{
|
60
|
+
:'domain' => :'String',
|
61
|
+
:'version' => :'String',
|
62
|
+
:'logo_url' => :'String',
|
63
|
+
:'vmc_url' => :'String'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# List of attributes with nullable: true
|
68
|
+
def self.openapi_nullable
|
69
|
+
Set.new([
|
70
|
+
])
|
71
|
+
end
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
75
|
+
def initialize(attributes = {})
|
76
|
+
if (!attributes.is_a?(Hash))
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::GenerateBimiRecordOptions` initialize method"
|
78
|
+
end
|
79
|
+
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
82
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::GenerateBimiRecordOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
84
|
+
end
|
85
|
+
h[k.to_sym] = v
|
86
|
+
}
|
87
|
+
|
88
|
+
if attributes.key?(:'domain')
|
89
|
+
self.domain = attributes[:'domain']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'version')
|
93
|
+
self.version = attributes[:'version']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'logo_url')
|
97
|
+
self.logo_url = attributes[:'logo_url']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'vmc_url')
|
101
|
+
self.vmc_url = attributes[:'vmc_url']
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
106
|
+
# @return Array for valid properties with the reasons
|
107
|
+
def list_invalid_properties
|
108
|
+
invalid_properties = Array.new
|
109
|
+
if @domain.nil?
|
110
|
+
invalid_properties.push('invalid value for "domain", domain cannot be nil.')
|
111
|
+
end
|
112
|
+
|
113
|
+
if @version.nil?
|
114
|
+
invalid_properties.push('invalid value for "version", version cannot be nil.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if @logo_url.nil?
|
118
|
+
invalid_properties.push('invalid value for "logo_url", logo_url 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 @domain.nil?
|
128
|
+
return false if @version.nil?
|
129
|
+
version_validator = EnumAttributeValidator.new('String', ["BIMI1"])
|
130
|
+
return false unless version_validator.valid?(@version)
|
131
|
+
return false if @logo_url.nil?
|
132
|
+
true
|
133
|
+
end
|
134
|
+
|
135
|
+
# Custom attribute writer method checking allowed values (enum).
|
136
|
+
# @param [Object] version Object to be assigned
|
137
|
+
def version=(version)
|
138
|
+
validator = EnumAttributeValidator.new('String', ["BIMI1"])
|
139
|
+
unless validator.valid?(version)
|
140
|
+
fail ArgumentError, "invalid value for \"version\", must be one of #{validator.allowable_values}."
|
141
|
+
end
|
142
|
+
@version = version
|
143
|
+
end
|
144
|
+
|
145
|
+
# Checks equality by comparing each attribute.
|
146
|
+
# @param [Object] Object to be compared
|
147
|
+
def ==(o)
|
148
|
+
return true if self.equal?(o)
|
149
|
+
self.class == o.class &&
|
150
|
+
domain == o.domain &&
|
151
|
+
version == o.version &&
|
152
|
+
logo_url == o.logo_url &&
|
153
|
+
vmc_url == o.vmc_url
|
154
|
+
end
|
155
|
+
|
156
|
+
# @see the `==` method
|
157
|
+
# @param [Object] Object to be compared
|
158
|
+
def eql?(o)
|
159
|
+
self == o
|
160
|
+
end
|
161
|
+
|
162
|
+
# Calculates hash code according to all attributes.
|
163
|
+
# @return [Integer] Hash code
|
164
|
+
def hash
|
165
|
+
[domain, version, logo_url, vmc_url].hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Builds the object from hash
|
169
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
170
|
+
# @return [Object] Returns the model itself
|
171
|
+
def self.build_from_hash(attributes)
|
172
|
+
new.build_from_hash(attributes)
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def build_from_hash(attributes)
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
180
|
+
self.class.openapi_types.each_pair do |key, type|
|
181
|
+
if type =~ /\AArray<(.*)>/i
|
182
|
+
# check to ensure the input is an array given that the attribute
|
183
|
+
# is documented as an array but the input is not
|
184
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
185
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
186
|
+
end
|
187
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
188
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
189
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
190
|
+
end
|
191
|
+
|
192
|
+
self
|
193
|
+
end
|
194
|
+
|
195
|
+
# Deserializes the data based on type
|
196
|
+
# @param string type Data type
|
197
|
+
# @param string value Value to be deserialized
|
198
|
+
# @return [Object] Deserialized data
|
199
|
+
def _deserialize(type, value)
|
200
|
+
case type.to_sym
|
201
|
+
when :DateTime
|
202
|
+
DateTime.parse(value)
|
203
|
+
when :Date
|
204
|
+
Date.parse(value)
|
205
|
+
when :String
|
206
|
+
value.to_s
|
207
|
+
when :Integer
|
208
|
+
value.to_i
|
209
|
+
when :Float
|
210
|
+
value.to_f
|
211
|
+
when :Boolean
|
212
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
213
|
+
true
|
214
|
+
else
|
215
|
+
false
|
216
|
+
end
|
217
|
+
when :Object
|
218
|
+
# generic object (usually a Hash), return directly
|
219
|
+
value
|
220
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
221
|
+
inner_type = Regexp.last_match[:inner_type]
|
222
|
+
value.map { |v| _deserialize(inner_type, v) }
|
223
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
224
|
+
k_type = Regexp.last_match[:k_type]
|
225
|
+
v_type = Regexp.last_match[:v_type]
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each do |k, v|
|
228
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
else # model
|
232
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns the string representation of the object
|
237
|
+
# @return [String] String presentation of the object
|
238
|
+
def to_s
|
239
|
+
to_hash.to_s
|
240
|
+
end
|
241
|
+
|
242
|
+
# to_body is an alias to to_hash (backward compatibility)
|
243
|
+
# @return [Hash] Returns the object in the form of hash
|
244
|
+
def to_body
|
245
|
+
to_hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Returns the object in the form of hash
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
250
|
+
def to_hash
|
251
|
+
hash = {}
|
252
|
+
self.class.attribute_map.each_pair do |attr, param|
|
253
|
+
value = self.send(attr)
|
254
|
+
if value.nil?
|
255
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
256
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
257
|
+
end
|
258
|
+
|
259
|
+
hash[param] = _to_hash(value)
|
260
|
+
end
|
261
|
+
hash
|
262
|
+
end
|
263
|
+
|
264
|
+
# Outputs non-array value in the form of hash
|
265
|
+
# For object, use to_hash. Otherwise, just return the value
|
266
|
+
# @param [Object] value Any valid value
|
267
|
+
# @return [Hash] Returns the value in the form of hash
|
268
|
+
def _to_hash(value)
|
269
|
+
if value.is_a?(Array)
|
270
|
+
value.compact.map { |v| _to_hash(v) }
|
271
|
+
elsif value.is_a?(Hash)
|
272
|
+
{}.tap do |hash|
|
273
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
274
|
+
end
|
275
|
+
elsif value.respond_to? :to_hash
|
276
|
+
value.to_hash
|
277
|
+
else
|
278
|
+
value
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|