mailslurp_client 12.5.0 → 12.7.0
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.rb +17 -2
- data/lib/mailslurp_client/api/contact_controller_api.rb +4 -4
- data/lib/mailslurp_client/api/email_controller_api.rb +71 -5
- data/lib/mailslurp_client/api/group_controller_api.rb +4 -4
- data/lib/mailslurp_client/api/inbox_controller_api.rb +107 -22
- data/lib/mailslurp_client/api/inbox_forwarder_controller_api.rb +548 -0
- data/lib/mailslurp_client/api/inbox_ruleset_controller_api.rb +211 -3
- data/lib/mailslurp_client/api/missed_email_controller_api.rb +75 -7
- data/lib/mailslurp_client/api/sent_emails_controller_api.rb +150 -4
- data/lib/mailslurp_client/api/template_controller_api.rb +4 -4
- data/lib/mailslurp_client/api/tracking_controller_api.rb +218 -0
- data/lib/mailslurp_client/api/wait_for_controller_api.rb +2 -2
- data/lib/mailslurp_client/api/webhook_controller_api.rb +55 -1
- data/lib/mailslurp_client/models/abstract_webhook_payload.rb +3 -3
- data/lib/mailslurp_client/models/create_inbox_forwarder_options.rb +275 -0
- data/lib/mailslurp_client/models/create_inbox_ruleset_options.rb +4 -4
- data/lib/mailslurp_client/models/create_tracking_pixel_options.rb +215 -0
- data/lib/mailslurp_client/models/create_webhook_options.rb +3 -3
- data/lib/mailslurp_client/models/domain_preview.rb +66 -4
- data/lib/mailslurp_client/models/email.rb +11 -1
- data/lib/mailslurp_client/models/email_projection.rb +10 -1
- data/lib/mailslurp_client/models/{inbox_ruleset_projection.rb → inbox_forwarder_dto.rb} +55 -78
- data/lib/mailslurp_client/models/inbox_forwarder_test_options.rb +211 -0
- data/lib/mailslurp_client/models/inbox_forwarder_test_result.rb +227 -0
- data/lib/mailslurp_client/models/inbox_ruleset_dto.rb +17 -3
- data/lib/mailslurp_client/models/inbox_ruleset_test_options.rb +211 -0
- data/lib/mailslurp_client/models/inbox_ruleset_test_result.rb +223 -0
- data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +299 -0
- data/lib/mailslurp_client/models/{page_inbox_ruleset_projection.rb → page_inbox_ruleset_dto.rb} +4 -4
- data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +299 -0
- data/lib/mailslurp_client/models/send_email_options.rb +11 -1
- data/lib/mailslurp_client/models/sent_email_dto.rb +12 -1
- data/lib/mailslurp_client/models/test_new_inbox_forwarder_options.rb +225 -0
- data/lib/mailslurp_client/models/test_new_inbox_ruleset_options.rb +225 -0
- data/lib/mailslurp_client/models/tracking_pixel_dto.rb +303 -0
- data/lib/mailslurp_client/models/tracking_pixel_projection.rb +289 -0
- data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
- data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +322 -0
- data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_result_entity.rb +2 -2
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +19 -4
@@ -19,6 +19,8 @@ module MailSlurpClient
|
|
19
19
|
|
20
20
|
attr_accessor :bcc
|
21
21
|
|
22
|
+
attr_accessor :body_excerpt
|
23
|
+
|
22
24
|
attr_accessor :body_md5_hash
|
23
25
|
|
24
26
|
attr_accessor :cc
|
@@ -44,6 +46,7 @@ module MailSlurpClient
|
|
44
46
|
{
|
45
47
|
:'attachments' => :'attachments',
|
46
48
|
:'bcc' => :'bcc',
|
49
|
+
:'body_excerpt' => :'bodyExcerpt',
|
47
50
|
:'body_md5_hash' => :'bodyMD5Hash',
|
48
51
|
:'cc' => :'cc',
|
49
52
|
:'created_at' => :'createdAt',
|
@@ -62,6 +65,7 @@ module MailSlurpClient
|
|
62
65
|
{
|
63
66
|
:'attachments' => :'Array<String>',
|
64
67
|
:'bcc' => :'Array<String>',
|
68
|
+
:'body_excerpt' => :'String',
|
65
69
|
:'body_md5_hash' => :'String',
|
66
70
|
:'cc' => :'Array<String>',
|
67
71
|
:'created_at' => :'DateTime',
|
@@ -108,6 +112,10 @@ module MailSlurpClient
|
|
108
112
|
end
|
109
113
|
end
|
110
114
|
|
115
|
+
if attributes.key?(:'body_excerpt')
|
116
|
+
self.body_excerpt = attributes[:'body_excerpt']
|
117
|
+
end
|
118
|
+
|
111
119
|
if attributes.key?(:'body_md5_hash')
|
112
120
|
self.body_md5_hash = attributes[:'body_md5_hash']
|
113
121
|
end
|
@@ -193,6 +201,7 @@ module MailSlurpClient
|
|
193
201
|
self.class == o.class &&
|
194
202
|
attachments == o.attachments &&
|
195
203
|
bcc == o.bcc &&
|
204
|
+
body_excerpt == o.body_excerpt &&
|
196
205
|
body_md5_hash == o.body_md5_hash &&
|
197
206
|
cc == o.cc &&
|
198
207
|
created_at == o.created_at &&
|
@@ -214,7 +223,7 @@ module MailSlurpClient
|
|
214
223
|
# Calculates hash code according to all attributes.
|
215
224
|
# @return [Integer] Hash code
|
216
225
|
def hash
|
217
|
-
[attachments, bcc, body_md5_hash, cc, created_at, from, id, inbox_id, read, subject, team_access, to].hash
|
226
|
+
[attachments, bcc, body_excerpt, body_md5_hash, cc, created_at, from, id, inbox_id, read, subject, team_access, to].hash
|
218
227
|
end
|
219
228
|
|
220
229
|
# Builds the object from hash
|
@@ -13,19 +13,18 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
-
|
17
|
-
|
18
|
-
attr_accessor :action
|
16
|
+
class InboxForwarderDto
|
17
|
+
attr_accessor :created_at
|
19
18
|
|
20
|
-
attr_accessor :
|
19
|
+
attr_accessor :field
|
20
|
+
|
21
|
+
attr_accessor :forward_to_recipients
|
21
22
|
|
22
23
|
attr_accessor :id
|
23
24
|
|
24
25
|
attr_accessor :inbox_id
|
25
26
|
|
26
|
-
attr_accessor :
|
27
|
-
|
28
|
-
attr_accessor :target
|
27
|
+
attr_accessor :match
|
29
28
|
|
30
29
|
class EnumAttributeValidator
|
31
30
|
attr_reader :datatype
|
@@ -52,24 +51,24 @@ module MailSlurpClient
|
|
52
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
53
52
|
def self.attribute_map
|
54
53
|
{
|
55
|
-
:'
|
56
|
-
:'
|
54
|
+
:'created_at' => :'createdAt',
|
55
|
+
:'field' => :'field',
|
56
|
+
:'forward_to_recipients' => :'forwardToRecipients',
|
57
57
|
:'id' => :'id',
|
58
58
|
:'inbox_id' => :'inboxId',
|
59
|
-
:'
|
60
|
-
:'target' => :'target'
|
59
|
+
:'match' => :'match'
|
61
60
|
}
|
62
61
|
end
|
63
62
|
|
64
63
|
# Attribute type mapping.
|
65
64
|
def self.openapi_types
|
66
65
|
{
|
67
|
-
:'
|
68
|
-
:'
|
66
|
+
:'created_at' => :'DateTime',
|
67
|
+
:'field' => :'String',
|
68
|
+
:'forward_to_recipients' => :'Array<String>',
|
69
69
|
:'id' => :'String',
|
70
70
|
:'inbox_id' => :'String',
|
71
|
-
:'
|
72
|
-
:'target' => :'String'
|
71
|
+
:'match' => :'String'
|
73
72
|
}
|
74
73
|
end
|
75
74
|
|
@@ -83,23 +82,29 @@ module MailSlurpClient
|
|
83
82
|
# @param [Hash] attributes Model attributes in the form of hash
|
84
83
|
def initialize(attributes = {})
|
85
84
|
if (!attributes.is_a?(Hash))
|
86
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::
|
85
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InboxForwarderDto` initialize method"
|
87
86
|
end
|
88
87
|
|
89
88
|
# check to see if the attribute exists and convert string to symbol for hash key
|
90
89
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
91
90
|
if (!self.class.attribute_map.key?(k.to_sym))
|
92
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::
|
91
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InboxForwarderDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
93
92
|
end
|
94
93
|
h[k.to_sym] = v
|
95
94
|
}
|
96
95
|
|
97
|
-
if attributes.key?(:'
|
98
|
-
self.
|
96
|
+
if attributes.key?(:'created_at')
|
97
|
+
self.created_at = attributes[:'created_at']
|
99
98
|
end
|
100
99
|
|
101
|
-
if attributes.key?(:'
|
102
|
-
self.
|
100
|
+
if attributes.key?(:'field')
|
101
|
+
self.field = attributes[:'field']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'forward_to_recipients')
|
105
|
+
if (value = attributes[:'forward_to_recipients']).is_a?(Array)
|
106
|
+
self.forward_to_recipients = value
|
107
|
+
end
|
103
108
|
end
|
104
109
|
|
105
110
|
if attributes.key?(:'id')
|
@@ -110,12 +115,8 @@ module MailSlurpClient
|
|
110
115
|
self.inbox_id = attributes[:'inbox_id']
|
111
116
|
end
|
112
117
|
|
113
|
-
if attributes.key?(:'
|
114
|
-
self.
|
115
|
-
end
|
116
|
-
|
117
|
-
if attributes.key?(:'target')
|
118
|
-
self.target = attributes[:'target']
|
118
|
+
if attributes.key?(:'match')
|
119
|
+
self.match = attributes[:'match']
|
119
120
|
end
|
120
121
|
end
|
121
122
|
|
@@ -123,12 +124,16 @@ module MailSlurpClient
|
|
123
124
|
# @return Array for valid properties with the reasons
|
124
125
|
def list_invalid_properties
|
125
126
|
invalid_properties = Array.new
|
126
|
-
if @
|
127
|
-
invalid_properties.push('invalid value for "
|
127
|
+
if @created_at.nil?
|
128
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
128
129
|
end
|
129
130
|
|
130
|
-
if @
|
131
|
-
invalid_properties.push('invalid value for "
|
131
|
+
if @field.nil?
|
132
|
+
invalid_properties.push('invalid value for "field", field cannot be nil.')
|
133
|
+
end
|
134
|
+
|
135
|
+
if @forward_to_recipients.nil?
|
136
|
+
invalid_properties.push('invalid value for "forward_to_recipients", forward_to_recipients cannot be nil.')
|
132
137
|
end
|
133
138
|
|
134
139
|
if @id.nil?
|
@@ -139,12 +144,8 @@ module MailSlurpClient
|
|
139
144
|
invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
|
140
145
|
end
|
141
146
|
|
142
|
-
if @
|
143
|
-
invalid_properties.push('invalid value for "
|
144
|
-
end
|
145
|
-
|
146
|
-
if @target.nil?
|
147
|
-
invalid_properties.push('invalid value for "target", target cannot be nil.')
|
147
|
+
if @match.nil?
|
148
|
+
invalid_properties.push('invalid value for "match", match cannot be nil.')
|
148
149
|
end
|
149
150
|
|
150
151
|
invalid_properties
|
@@ -153,49 +154,25 @@ module MailSlurpClient
|
|
153
154
|
# Check to see if the all the properties in the model are valid
|
154
155
|
# @return true if the model is valid
|
155
156
|
def valid?
|
156
|
-
return false if @
|
157
|
-
|
158
|
-
|
159
|
-
return false
|
160
|
-
|
161
|
-
return false unless handler_validator.valid?(@handler)
|
157
|
+
return false if @created_at.nil?
|
158
|
+
return false if @field.nil?
|
159
|
+
field_validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS"])
|
160
|
+
return false unless field_validator.valid?(@field)
|
161
|
+
return false if @forward_to_recipients.nil?
|
162
162
|
return false if @id.nil?
|
163
163
|
return false if @inbox_id.nil?
|
164
|
-
return false if @
|
165
|
-
scope_validator = EnumAttributeValidator.new('String', ["RECEIVING_EMAILS", "SENDING_EMAILS"])
|
166
|
-
return false unless scope_validator.valid?(@scope)
|
167
|
-
return false if @target.nil?
|
164
|
+
return false if @match.nil?
|
168
165
|
true
|
169
166
|
end
|
170
167
|
|
171
168
|
# Custom attribute writer method checking allowed values (enum).
|
172
|
-
# @param [Object]
|
173
|
-
def
|
174
|
-
validator = EnumAttributeValidator.new('String', ["
|
175
|
-
unless validator.valid?(
|
176
|
-
fail ArgumentError, "invalid value for \"
|
177
|
-
end
|
178
|
-
@action = action
|
179
|
-
end
|
180
|
-
|
181
|
-
# Custom attribute writer method checking allowed values (enum).
|
182
|
-
# @param [Object] handler Object to be assigned
|
183
|
-
def handler=(handler)
|
184
|
-
validator = EnumAttributeValidator.new('String', ["EXCEPTION"])
|
185
|
-
unless validator.valid?(handler)
|
186
|
-
fail ArgumentError, "invalid value for \"handler\", must be one of #{validator.allowable_values}."
|
187
|
-
end
|
188
|
-
@handler = handler
|
189
|
-
end
|
190
|
-
|
191
|
-
# Custom attribute writer method checking allowed values (enum).
|
192
|
-
# @param [Object] scope Object to be assigned
|
193
|
-
def scope=(scope)
|
194
|
-
validator = EnumAttributeValidator.new('String', ["RECEIVING_EMAILS", "SENDING_EMAILS"])
|
195
|
-
unless validator.valid?(scope)
|
196
|
-
fail ArgumentError, "invalid value for \"scope\", must be one of #{validator.allowable_values}."
|
169
|
+
# @param [Object] field Object to be assigned
|
170
|
+
def field=(field)
|
171
|
+
validator = EnumAttributeValidator.new('String', ["RECIPIENTS", "SENDER", "SUBJECT", "ATTACHMENTS"])
|
172
|
+
unless validator.valid?(field)
|
173
|
+
fail ArgumentError, "invalid value for \"field\", must be one of #{validator.allowable_values}."
|
197
174
|
end
|
198
|
-
@
|
175
|
+
@field = field
|
199
176
|
end
|
200
177
|
|
201
178
|
# Checks equality by comparing each attribute.
|
@@ -203,12 +180,12 @@ module MailSlurpClient
|
|
203
180
|
def ==(o)
|
204
181
|
return true if self.equal?(o)
|
205
182
|
self.class == o.class &&
|
206
|
-
|
207
|
-
|
183
|
+
created_at == o.created_at &&
|
184
|
+
field == o.field &&
|
185
|
+
forward_to_recipients == o.forward_to_recipients &&
|
208
186
|
id == o.id &&
|
209
187
|
inbox_id == o.inbox_id &&
|
210
|
-
|
211
|
-
target == o.target
|
188
|
+
match == o.match
|
212
189
|
end
|
213
190
|
|
214
191
|
# @see the `==` method
|
@@ -220,7 +197,7 @@ module MailSlurpClient
|
|
220
197
|
# Calculates hash code according to all attributes.
|
221
198
|
# @return [Integer] Hash code
|
222
199
|
def hash
|
223
|
-
[
|
200
|
+
[created_at, field, forward_to_recipients, id, inbox_id, match].hash
|
224
201
|
end
|
225
202
|
|
226
203
|
# Builds the object from hash
|
@@ -0,0 +1,211 @@
|
|
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://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 6.5.2
|
7
|
+
|
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 InboxForwarderTestOptions
|
17
|
+
attr_accessor :test_value
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'test_value' => :'testValue'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'test_value' => :'String'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# List of attributes with nullable: true
|
34
|
+
def self.openapi_nullable
|
35
|
+
Set.new([
|
36
|
+
])
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InboxForwarderTestOptions` initialize method"
|
44
|
+
end
|
45
|
+
|
46
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
48
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
49
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InboxForwarderTestOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
50
|
+
end
|
51
|
+
h[k.to_sym] = v
|
52
|
+
}
|
53
|
+
|
54
|
+
if attributes.key?(:'test_value')
|
55
|
+
self.test_value = attributes[:'test_value']
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
60
|
+
# @return Array for valid properties with the reasons
|
61
|
+
def list_invalid_properties
|
62
|
+
invalid_properties = Array.new
|
63
|
+
if @test_value.nil?
|
64
|
+
invalid_properties.push('invalid value for "test_value", test_value cannot be nil.')
|
65
|
+
end
|
66
|
+
|
67
|
+
invalid_properties
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check to see if the all the properties in the model are valid
|
71
|
+
# @return true if the model is valid
|
72
|
+
def valid?
|
73
|
+
return false if @test_value.nil?
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Checks equality by comparing each attribute.
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def ==(o)
|
80
|
+
return true if self.equal?(o)
|
81
|
+
self.class == o.class &&
|
82
|
+
test_value == o.test_value
|
83
|
+
end
|
84
|
+
|
85
|
+
# @see the `==` method
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def eql?(o)
|
88
|
+
self == o
|
89
|
+
end
|
90
|
+
|
91
|
+
# Calculates hash code according to all attributes.
|
92
|
+
# @return [Integer] Hash code
|
93
|
+
def hash
|
94
|
+
[test_value].hash
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the object from hash
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
# @return [Object] Returns the model itself
|
100
|
+
def self.build_from_hash(attributes)
|
101
|
+
new.build_from_hash(attributes)
|
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.openapi_types.each_pair do |key, type|
|
110
|
+
if type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
114
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
115
|
+
end
|
116
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
117
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
118
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
119
|
+
end
|
120
|
+
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
128
|
+
def _deserialize(type, value)
|
129
|
+
case type.to_sym
|
130
|
+
when :DateTime
|
131
|
+
DateTime.parse(value)
|
132
|
+
when :Date
|
133
|
+
Date.parse(value)
|
134
|
+
when :String
|
135
|
+
value.to_s
|
136
|
+
when :Integer
|
137
|
+
value.to_i
|
138
|
+
when :Float
|
139
|
+
value.to_f
|
140
|
+
when :Boolean
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
142
|
+
true
|
143
|
+
else
|
144
|
+
false
|
145
|
+
end
|
146
|
+
when :Object
|
147
|
+
# generic object (usually a Hash), return directly
|
148
|
+
value
|
149
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
150
|
+
inner_type = Regexp.last_match[:inner_type]
|
151
|
+
value.map { |v| _deserialize(inner_type, v) }
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
153
|
+
k_type = Regexp.last_match[:k_type]
|
154
|
+
v_type = Regexp.last_match[:v_type]
|
155
|
+
{}.tap do |hash|
|
156
|
+
value.each do |k, v|
|
157
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else # model
|
161
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the string representation of the object
|
166
|
+
# @return [String] String presentation of the object
|
167
|
+
def to_s
|
168
|
+
to_hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
# to_body is an alias to to_hash (backward compatibility)
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_body
|
174
|
+
to_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the object in the form of hash
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_hash
|
180
|
+
hash = {}
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
182
|
+
value = self.send(attr)
|
183
|
+
if value.nil?
|
184
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
185
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
186
|
+
end
|
187
|
+
|
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
|
+
end
|
211
|
+
end
|