mailslurp_client 15.7.15 → 15.7.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/attachment_controller_api.rb +9 -9
  3. data/lib/mailslurp_client/api/common_actions_controller_api.rb +6 -0
  4. data/lib/mailslurp_client/api/email_controller_api.rb +3 -0
  5. data/lib/mailslurp_client/api/inbox_controller_api.rb +3 -0
  6. data/lib/mailslurp_client/models/alias_projection.rb +15 -15
  7. data/lib/mailslurp_client/models/attachment_projection.rb +15 -15
  8. data/lib/mailslurp_client/models/contact_projection.rb +14 -13
  9. data/lib/mailslurp_client/models/create_inbox_dto.rb +14 -4
  10. data/lib/mailslurp_client/models/email.rb +13 -4
  11. data/lib/mailslurp_client/models/email_projection.rb +15 -15
  12. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +18 -18
  13. data/lib/mailslurp_client/models/group_dto.rb +1 -0
  14. data/lib/mailslurp_client/models/inbox_dto.rb +19 -4
  15. data/lib/mailslurp_client/models/inbox_forwarder_test_options.rb +1 -0
  16. data/lib/mailslurp_client/models/inbox_preview.rb +11 -1
  17. data/lib/mailslurp_client/models/inline_object1.rb +270 -0
  18. data/lib/mailslurp_client/models/missed_email_projection.rb +13 -13
  19. data/lib/mailslurp_client/models/organization_inbox_projection.rb +14 -4
  20. data/lib/mailslurp_client/models/reply_to_alias_email_options.rb +13 -4
  21. data/lib/mailslurp_client/models/reply_to_email_options.rb +13 -4
  22. data/lib/mailslurp_client/models/sent_email_dto.rb +22 -4
  23. data/lib/mailslurp_client/models/sent_email_projection.rb +27 -18
  24. data/lib/mailslurp_client/models/thread_projection.rb +15 -15
  25. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +15 -15
  26. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +13 -13
  27. data/lib/mailslurp_client/models/validate_email_address_list_options.rb +1 -0
  28. data/lib/mailslurp_client/models/webhook_projection.rb +11 -11
  29. data/lib/mailslurp_client/version.rb +1 -1
  30. data/lib/mailslurp_client.rb +1 -0
  31. metadata +3 -2
@@ -21,6 +21,8 @@ module MailSlurpClient
21
21
 
22
22
  attr_accessor :subject
23
23
 
24
+ attr_accessor :created_at
25
+
24
26
  attr_accessor :inbox_id
25
27
 
26
28
  attr_accessor :attachments
@@ -31,8 +33,6 @@ module MailSlurpClient
31
33
 
32
34
  attr_accessor :cc
33
35
 
34
- attr_accessor :created_at
35
-
36
36
  attr_accessor :team_access
37
37
 
38
38
  attr_accessor :read
@@ -47,12 +47,12 @@ module MailSlurpClient
47
47
  :'id' => :'id',
48
48
  :'from' => :'from',
49
49
  :'subject' => :'subject',
50
+ :'created_at' => :'createdAt',
50
51
  :'inbox_id' => :'inboxId',
51
52
  :'attachments' => :'attachments',
52
53
  :'to' => :'to',
53
54
  :'bcc' => :'bcc',
54
55
  :'cc' => :'cc',
55
- :'created_at' => :'createdAt',
56
56
  :'team_access' => :'teamAccess',
57
57
  :'read' => :'read',
58
58
  :'body_md5_hash' => :'bodyMD5Hash',
@@ -66,12 +66,12 @@ module MailSlurpClient
66
66
  :'id' => :'String',
67
67
  :'from' => :'String',
68
68
  :'subject' => :'String',
69
+ :'created_at' => :'DateTime',
69
70
  :'inbox_id' => :'String',
70
71
  :'attachments' => :'Array<String>',
71
72
  :'to' => :'Array<String>',
72
73
  :'bcc' => :'Array<String>',
73
74
  :'cc' => :'Array<String>',
74
- :'created_at' => :'DateTime',
75
75
  :'team_access' => :'Boolean',
76
76
  :'read' => :'Boolean',
77
77
  :'body_md5_hash' => :'String',
@@ -112,6 +112,10 @@ module MailSlurpClient
112
112
  self.subject = attributes[:'subject']
113
113
  end
114
114
 
115
+ if attributes.key?(:'created_at')
116
+ self.created_at = attributes[:'created_at']
117
+ end
118
+
115
119
  if attributes.key?(:'inbox_id')
116
120
  self.inbox_id = attributes[:'inbox_id']
117
121
  end
@@ -140,10 +144,6 @@ module MailSlurpClient
140
144
  end
141
145
  end
142
146
 
143
- if attributes.key?(:'created_at')
144
- self.created_at = attributes[:'created_at']
145
- end
146
-
147
147
  if attributes.key?(:'team_access')
148
148
  self.team_access = attributes[:'team_access']
149
149
  end
@@ -169,6 +169,10 @@ module MailSlurpClient
169
169
  invalid_properties.push('invalid value for "id", id cannot be nil.')
170
170
  end
171
171
 
172
+ if @created_at.nil?
173
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
174
+ end
175
+
172
176
  if @inbox_id.nil?
173
177
  invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
174
178
  end
@@ -177,10 +181,6 @@ module MailSlurpClient
177
181
  invalid_properties.push('invalid value for "to", to cannot be nil.')
178
182
  end
179
183
 
180
- if @created_at.nil?
181
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
182
- end
183
-
184
184
  invalid_properties
185
185
  end
186
186
 
@@ -188,9 +188,9 @@ module MailSlurpClient
188
188
  # @return true if the model is valid
189
189
  def valid?
190
190
  return false if @id.nil?
191
+ return false if @created_at.nil?
191
192
  return false if @inbox_id.nil?
192
193
  return false if @to.nil?
193
- return false if @created_at.nil?
194
194
  true
195
195
  end
196
196
 
@@ -202,12 +202,12 @@ module MailSlurpClient
202
202
  id == o.id &&
203
203
  from == o.from &&
204
204
  subject == o.subject &&
205
+ created_at == o.created_at &&
205
206
  inbox_id == o.inbox_id &&
206
207
  attachments == o.attachments &&
207
208
  to == o.to &&
208
209
  bcc == o.bcc &&
209
210
  cc == o.cc &&
210
- created_at == o.created_at &&
211
211
  team_access == o.team_access &&
212
212
  read == o.read &&
213
213
  body_md5_hash == o.body_md5_hash &&
@@ -223,7 +223,7 @@ module MailSlurpClient
223
223
  # Calculates hash code according to all attributes.
224
224
  # @return [Integer] Hash code
225
225
  def hash
226
- [id, from, subject, inbox_id, attachments, to, bcc, cc, created_at, team_access, read, body_md5_hash, body_excerpt].hash
226
+ [id, from, subject, created_at, inbox_id, attachments, to, bcc, cc, team_access, read, body_md5_hash, body_excerpt].hash
227
227
  end
228
228
 
229
229
  # Builds the object from hash
@@ -17,19 +17,19 @@ module MailSlurpClient
17
17
  class ExpiredInboxRecordProjection
18
18
  attr_accessor :id
19
19
 
20
+ attr_accessor :created_at
21
+
20
22
  attr_accessor :user_id
21
23
 
22
24
  attr_accessor :email_address
23
25
 
24
- attr_accessor :created_at
25
-
26
26
  # Attribute mapping from ruby-style variable name to JSON key.
27
27
  def self.attribute_map
28
28
  {
29
29
  :'id' => :'id',
30
+ :'created_at' => :'createdAt',
30
31
  :'user_id' => :'userId',
31
- :'email_address' => :'emailAddress',
32
- :'created_at' => :'createdAt'
32
+ :'email_address' => :'emailAddress'
33
33
  }
34
34
  end
35
35
 
@@ -37,9 +37,9 @@ module MailSlurpClient
37
37
  def self.openapi_types
38
38
  {
39
39
  :'id' => :'String',
40
+ :'created_at' => :'DateTime',
40
41
  :'user_id' => :'String',
41
- :'email_address' => :'String',
42
- :'created_at' => :'DateTime'
42
+ :'email_address' => :'String'
43
43
  }
44
44
  end
45
45
 
@@ -68,6 +68,10 @@ module MailSlurpClient
68
68
  self.id = attributes[:'id']
69
69
  end
70
70
 
71
+ if attributes.key?(:'created_at')
72
+ self.created_at = attributes[:'created_at']
73
+ end
74
+
71
75
  if attributes.key?(:'user_id')
72
76
  self.user_id = attributes[:'user_id']
73
77
  end
@@ -75,10 +79,6 @@ module MailSlurpClient
75
79
  if attributes.key?(:'email_address')
76
80
  self.email_address = attributes[:'email_address']
77
81
  end
78
-
79
- if attributes.key?(:'created_at')
80
- self.created_at = attributes[:'created_at']
81
- end
82
82
  end
83
83
 
84
84
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -89,6 +89,10 @@ module MailSlurpClient
89
89
  invalid_properties.push('invalid value for "id", id cannot be nil.')
90
90
  end
91
91
 
92
+ if @created_at.nil?
93
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
94
+ end
95
+
92
96
  if @user_id.nil?
93
97
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
94
98
  end
@@ -97,10 +101,6 @@ module MailSlurpClient
97
101
  invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
98
102
  end
99
103
 
100
- if @created_at.nil?
101
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
102
- end
103
-
104
104
  invalid_properties
105
105
  end
106
106
 
@@ -108,9 +108,9 @@ module MailSlurpClient
108
108
  # @return true if the model is valid
109
109
  def valid?
110
110
  return false if @id.nil?
111
+ return false if @created_at.nil?
111
112
  return false if @user_id.nil?
112
113
  return false if @email_address.nil?
113
- return false if @created_at.nil?
114
114
  true
115
115
  end
116
116
 
@@ -120,9 +120,9 @@ module MailSlurpClient
120
120
  return true if self.equal?(o)
121
121
  self.class == o.class &&
122
122
  id == o.id &&
123
+ created_at == o.created_at &&
123
124
  user_id == o.user_id &&
124
- email_address == o.email_address &&
125
- created_at == o.created_at
125
+ email_address == o.email_address
126
126
  end
127
127
 
128
128
  # @see the `==` method
@@ -134,7 +134,7 @@ module MailSlurpClient
134
134
  # Calculates hash code according to all attributes.
135
135
  # @return [Integer] Hash code
136
136
  def hash
137
- [id, user_id, email_address, created_at].hash
137
+ [id, created_at, user_id, email_address].hash
138
138
  end
139
139
 
140
140
  # Builds the object from hash
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
+ # Contact group data
16
17
  class GroupDto
17
18
  attr_accessor :id
18
19
 
@@ -48,6 +48,9 @@ module MailSlurpClient
48
48
  # Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes.
49
49
  attr_accessor :read_only
50
50
 
51
+ # Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions.
52
+ attr_accessor :virtual_inbox
53
+
51
54
  class EnumAttributeValidator
52
55
  attr_reader :datatype
53
56
  attr_reader :allowable_values
@@ -83,7 +86,8 @@ module MailSlurpClient
83
86
  :'favourite' => :'favourite',
84
87
  :'tags' => :'tags',
85
88
  :'inbox_type' => :'inboxType',
86
- :'read_only' => :'readOnly'
89
+ :'read_only' => :'readOnly',
90
+ :'virtual_inbox' => :'virtualInbox'
87
91
  }
88
92
  end
89
93
 
@@ -100,7 +104,8 @@ module MailSlurpClient
100
104
  :'favourite' => :'Boolean',
101
105
  :'tags' => :'Array<String>',
102
106
  :'inbox_type' => :'String',
103
- :'read_only' => :'Boolean'
107
+ :'read_only' => :'Boolean',
108
+ :'virtual_inbox' => :'Boolean'
104
109
  }
105
110
  end
106
111
 
@@ -170,6 +175,10 @@ module MailSlurpClient
170
175
  if attributes.key?(:'read_only')
171
176
  self.read_only = attributes[:'read_only']
172
177
  end
178
+
179
+ if attributes.key?(:'virtual_inbox')
180
+ self.virtual_inbox = attributes[:'virtual_inbox']
181
+ end
173
182
  end
174
183
 
175
184
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -196,6 +205,10 @@ module MailSlurpClient
196
205
  invalid_properties.push('invalid value for "read_only", read_only cannot be nil.')
197
206
  end
198
207
 
208
+ if @virtual_inbox.nil?
209
+ invalid_properties.push('invalid value for "virtual_inbox", virtual_inbox cannot be nil.')
210
+ end
211
+
199
212
  invalid_properties
200
213
  end
201
214
 
@@ -209,6 +222,7 @@ module MailSlurpClient
209
222
  inbox_type_validator = EnumAttributeValidator.new('String', ["HTTP_INBOX", "SMTP_INBOX"])
210
223
  return false unless inbox_type_validator.valid?(@inbox_type)
211
224
  return false if @read_only.nil?
225
+ return false if @virtual_inbox.nil?
212
226
  true
213
227
  end
214
228
 
@@ -237,7 +251,8 @@ module MailSlurpClient
237
251
  favourite == o.favourite &&
238
252
  tags == o.tags &&
239
253
  inbox_type == o.inbox_type &&
240
- read_only == o.read_only
254
+ read_only == o.read_only &&
255
+ virtual_inbox == o.virtual_inbox
241
256
  end
242
257
 
243
258
  # @see the `==` method
@@ -249,7 +264,7 @@ module MailSlurpClient
249
264
  # Calculates hash code according to all attributes.
250
265
  # @return [Integer] Hash code
251
266
  def hash
252
- [id, user_id, created_at, name, description, email_address, expires_at, favourite, tags, inbox_type, read_only].hash
267
+ [id, user_id, created_at, name, description, email_address, expires_at, favourite, tags, inbox_type, read_only, virtual_inbox].hash
253
268
  end
254
269
 
255
270
  # Builds the object from hash
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
+ # Options for testing an inbox forwarder against a value
16
17
  class InboxForwarderTestOptions
17
18
  attr_accessor :test_value
18
19
 
@@ -39,6 +39,9 @@ module MailSlurpClient
39
39
  # Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
40
40
  attr_accessor :inbox_type
41
41
 
42
+ # Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions.
43
+ attr_accessor :virtual_inbox
44
+
42
45
  # Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email.
43
46
  attr_accessor :expires_at
44
47
 
@@ -75,6 +78,7 @@ module MailSlurpClient
75
78
  :'tags' => :'tags',
76
79
  :'team_access' => :'teamAccess',
77
80
  :'inbox_type' => :'inboxType',
81
+ :'virtual_inbox' => :'virtualInbox',
78
82
  :'expires_at' => :'expiresAt'
79
83
  }
80
84
  end
@@ -90,6 +94,7 @@ module MailSlurpClient
90
94
  :'tags' => :'Array<String>',
91
95
  :'team_access' => :'Boolean',
92
96
  :'inbox_type' => :'String',
97
+ :'virtual_inbox' => :'Boolean',
93
98
  :'expires_at' => :'String'
94
99
  }
95
100
  end
@@ -149,6 +154,10 @@ module MailSlurpClient
149
154
  self.inbox_type = attributes[:'inbox_type']
150
155
  end
151
156
 
157
+ if attributes.key?(:'virtual_inbox')
158
+ self.virtual_inbox = attributes[:'virtual_inbox']
159
+ end
160
+
152
161
  if attributes.key?(:'expires_at')
153
162
  self.expires_at = attributes[:'expires_at']
154
163
  end
@@ -212,6 +221,7 @@ module MailSlurpClient
212
221
  tags == o.tags &&
213
222
  team_access == o.team_access &&
214
223
  inbox_type == o.inbox_type &&
224
+ virtual_inbox == o.virtual_inbox &&
215
225
  expires_at == o.expires_at
216
226
  end
217
227
 
@@ -224,7 +234,7 @@ module MailSlurpClient
224
234
  # Calculates hash code according to all attributes.
225
235
  # @return [Integer] Hash code
226
236
  def hash
227
- [id, email_address, created_at, favourite, name, tags, team_access, inbox_type, expires_at].hash
237
+ [id, email_address, created_at, favourite, name, tags, team_access, inbox_type, virtual_inbox, expires_at].hash
228
238
  end
229
239
 
230
240
  # Builds the object from hash
@@ -0,0 +1,270 @@
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
+ # Byte array request body
17
+ class InlineObject1
18
+ attr_accessor :short
19
+
20
+ attr_accessor :char
21
+
22
+ attr_accessor :int
23
+
24
+ attr_accessor :long
25
+
26
+ attr_accessor :float
27
+
28
+ attr_accessor :double
29
+
30
+ attr_accessor :direct
31
+
32
+ attr_accessor :read_only
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'short' => :'short',
38
+ :'char' => :'char',
39
+ :'int' => :'int',
40
+ :'long' => :'long',
41
+ :'float' => :'float',
42
+ :'double' => :'double',
43
+ :'direct' => :'direct',
44
+ :'read_only' => :'readOnly'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'short' => :'Integer',
52
+ :'char' => :'String',
53
+ :'int' => :'Integer',
54
+ :'long' => :'Integer',
55
+ :'float' => :'Float',
56
+ :'double' => :'Float',
57
+ :'direct' => :'Boolean',
58
+ :'read_only' => :'Boolean'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InlineObject1` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InlineObject1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'short')
84
+ self.short = attributes[:'short']
85
+ end
86
+
87
+ if attributes.key?(:'char')
88
+ self.char = attributes[:'char']
89
+ end
90
+
91
+ if attributes.key?(:'int')
92
+ self.int = attributes[:'int']
93
+ end
94
+
95
+ if attributes.key?(:'long')
96
+ self.long = attributes[:'long']
97
+ end
98
+
99
+ if attributes.key?(:'float')
100
+ self.float = attributes[:'float']
101
+ end
102
+
103
+ if attributes.key?(:'double')
104
+ self.double = attributes[:'double']
105
+ end
106
+
107
+ if attributes.key?(:'direct')
108
+ self.direct = attributes[:'direct']
109
+ end
110
+
111
+ if attributes.key?(:'read_only')
112
+ self.read_only = attributes[:'read_only']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
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
+ short == o.short &&
135
+ char == o.char &&
136
+ int == o.int &&
137
+ long == o.long &&
138
+ float == o.float &&
139
+ double == o.double &&
140
+ direct == o.direct &&
141
+ read_only == o.read_only
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 [Integer] Hash code
152
+ def hash
153
+ [short, char, int, long, float, double, direct, read_only].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 self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ self.class.openapi_types.each_pair do |key, type|
169
+ if type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :DateTime
190
+ DateTime.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ MailSlurpClient.const_get(type).build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+ end
270
+ end