mailslurp_client 15.17.33 → 15.17.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/attachment_controller_api.rb +3 -0
  3. data/lib/mailslurp_client/api/sms_controller_api.rb +56 -0
  4. data/lib/mailslurp_client/api/webhook_controller_api.rb +186 -0
  5. data/lib/mailslurp_client/models/alias_projection.rb +15 -15
  6. data/lib/mailslurp_client/models/attachment_entity.rb +10 -1
  7. data/lib/mailslurp_client/models/bounce_projection.rb +11 -11
  8. data/lib/mailslurp_client/models/email.rb +13 -13
  9. data/lib/mailslurp_client/models/email_projection.rb +19 -19
  10. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  11. data/lib/mailslurp_client/models/missed_email_projection.rb +11 -11
  12. data/lib/mailslurp_client/models/page_alias.rb +17 -16
  13. data/lib/mailslurp_client/models/page_attachment_entity.rb +17 -16
  14. data/lib/mailslurp_client/models/page_bounced_email.rb +17 -16
  15. data/lib/mailslurp_client/models/page_bounced_recipients.rb +17 -16
  16. data/lib/mailslurp_client/models/page_complaint.rb +17 -16
  17. data/lib/mailslurp_client/models/page_connector.rb +17 -16
  18. data/lib/mailslurp_client/models/page_connector_sync_events.rb +17 -16
  19. data/lib/mailslurp_client/models/page_contact_projection.rb +17 -16
  20. data/lib/mailslurp_client/models/page_delivery_status.rb +17 -16
  21. data/lib/mailslurp_client/models/page_email_preview.rb +17 -16
  22. data/lib/mailslurp_client/models/page_email_projection.rb +12 -21
  23. data/lib/mailslurp_client/models/page_email_validation_request.rb +17 -16
  24. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +17 -16
  25. data/lib/mailslurp_client/models/page_group_projection.rb +17 -16
  26. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +17 -16
  27. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +17 -16
  28. data/lib/mailslurp_client/models/page_inbox_projection.rb +17 -16
  29. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +17 -16
  30. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +17 -16
  31. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +17 -16
  32. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +17 -16
  33. data/lib/mailslurp_client/models/page_missed_email_projection.rb +17 -16
  34. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +17 -16
  35. data/lib/mailslurp_client/models/page_phone_number_projection.rb +17 -16
  36. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +17 -16
  37. data/lib/mailslurp_client/models/page_sent_email_projection.rb +34 -69
  38. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +34 -69
  39. data/lib/mailslurp_client/models/page_sms_projection.rb +17 -16
  40. data/lib/mailslurp_client/models/page_template_projection.rb +17 -16
  41. data/lib/mailslurp_client/models/page_thread_projection.rb +17 -16
  42. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +17 -16
  43. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +17 -16
  44. data/lib/mailslurp_client/models/page_webhook_projection.rb +17 -16
  45. data/lib/mailslurp_client/models/page_webhook_result.rb +17 -16
  46. data/lib/mailslurp_client/models/pageable_object.rb +10 -10
  47. data/lib/mailslurp_client/models/send_with_queue_result.rb +0 -1
  48. data/lib/mailslurp_client/models/sent_email_projection.rb +30 -31
  49. data/lib/mailslurp_client/models/thread_projection.rb +11 -11
  50. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +10 -10
  51. data/lib/mailslurp_client/models/user_info_dto.rb +2 -2
  52. data/lib/mailslurp_client/models/webhook_redrive_all_result.rb +222 -0
  53. data/lib/mailslurp_client/models/webhook_result_dto.rb +56 -16
  54. data/lib/mailslurp_client/version.rb +1 -1
  55. data/lib/mailslurp_client.rb +1 -0
  56. metadata +3 -2
@@ -13,19 +13,18 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Collection of items
17
16
  class SentEmailProjection
18
- attr_accessor :id
17
+ attr_accessor :subject
19
18
 
20
- attr_accessor :user_id
19
+ attr_accessor :id
21
20
 
22
21
  attr_accessor :from
23
22
 
24
- attr_accessor :subject
23
+ attr_accessor :inbox_id
25
24
 
26
- attr_accessor :attachments
25
+ attr_accessor :user_id
27
26
 
28
- attr_accessor :inbox_id
27
+ attr_accessor :attachments
29
28
 
30
29
  attr_accessor :to
31
30
 
@@ -42,12 +41,12 @@ module MailSlurpClient
42
41
  # Attribute mapping from ruby-style variable name to JSON key.
43
42
  def self.attribute_map
44
43
  {
44
+ :'subject' => :'subject',
45
45
  :'id' => :'id',
46
- :'user_id' => :'userId',
47
46
  :'from' => :'from',
48
- :'subject' => :'subject',
49
- :'attachments' => :'attachments',
50
47
  :'inbox_id' => :'inboxId',
48
+ :'user_id' => :'userId',
49
+ :'attachments' => :'attachments',
51
50
  :'to' => :'to',
52
51
  :'bcc' => :'bcc',
53
52
  :'cc' => :'cc',
@@ -60,12 +59,12 @@ module MailSlurpClient
60
59
  # Attribute type mapping.
61
60
  def self.openapi_types
62
61
  {
62
+ :'subject' => :'String',
63
63
  :'id' => :'String',
64
- :'user_id' => :'String',
65
64
  :'from' => :'String',
66
- :'subject' => :'String',
67
- :'attachments' => :'Array<String>',
68
65
  :'inbox_id' => :'String',
66
+ :'user_id' => :'String',
67
+ :'attachments' => :'Array<String>',
69
68
  :'to' => :'Array<String>',
70
69
  :'bcc' => :'Array<String>',
71
70
  :'cc' => :'Array<String>',
@@ -96,20 +95,24 @@ module MailSlurpClient
96
95
  h[k.to_sym] = v
97
96
  }
98
97
 
99
- if attributes.key?(:'id')
100
- self.id = attributes[:'id']
98
+ if attributes.key?(:'subject')
99
+ self.subject = attributes[:'subject']
101
100
  end
102
101
 
103
- if attributes.key?(:'user_id')
104
- self.user_id = attributes[:'user_id']
102
+ if attributes.key?(:'id')
103
+ self.id = attributes[:'id']
105
104
  end
106
105
 
107
106
  if attributes.key?(:'from')
108
107
  self.from = attributes[:'from']
109
108
  end
110
109
 
111
- if attributes.key?(:'subject')
112
- self.subject = attributes[:'subject']
110
+ if attributes.key?(:'inbox_id')
111
+ self.inbox_id = attributes[:'inbox_id']
112
+ end
113
+
114
+ if attributes.key?(:'user_id')
115
+ self.user_id = attributes[:'user_id']
113
116
  end
114
117
 
115
118
  if attributes.key?(:'attachments')
@@ -118,10 +121,6 @@ module MailSlurpClient
118
121
  end
119
122
  end
120
123
 
121
- if attributes.key?(:'inbox_id')
122
- self.inbox_id = attributes[:'inbox_id']
123
- end
124
-
125
124
  if attributes.key?(:'to')
126
125
  if (value = attributes[:'to']).is_a?(Array)
127
126
  self.to = value
@@ -161,6 +160,10 @@ module MailSlurpClient
161
160
  invalid_properties.push('invalid value for "id", id cannot be nil.')
162
161
  end
163
162
 
163
+ if @inbox_id.nil?
164
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
165
+ end
166
+
164
167
  if @user_id.nil?
165
168
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
166
169
  end
@@ -169,10 +172,6 @@ module MailSlurpClient
169
172
  invalid_properties.push('invalid value for "attachments", attachments cannot be nil.')
170
173
  end
171
174
 
172
- if @inbox_id.nil?
173
- invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
174
- end
175
-
176
175
  if @to.nil?
177
176
  invalid_properties.push('invalid value for "to", to cannot be nil.')
178
177
  end
@@ -200,9 +199,9 @@ module MailSlurpClient
200
199
  # @return true if the model is valid
201
200
  def valid?
202
201
  return false if @id.nil?
202
+ return false if @inbox_id.nil?
203
203
  return false if @user_id.nil?
204
204
  return false if @attachments.nil?
205
- return false if @inbox_id.nil?
206
205
  return false if @to.nil?
207
206
  return false if @bcc.nil?
208
207
  return false if @cc.nil?
@@ -216,12 +215,12 @@ module MailSlurpClient
216
215
  def ==(o)
217
216
  return true if self.equal?(o)
218
217
  self.class == o.class &&
218
+ subject == o.subject &&
219
219
  id == o.id &&
220
- user_id == o.user_id &&
221
220
  from == o.from &&
222
- subject == o.subject &&
223
- attachments == o.attachments &&
224
221
  inbox_id == o.inbox_id &&
222
+ user_id == o.user_id &&
223
+ attachments == o.attachments &&
225
224
  to == o.to &&
226
225
  bcc == o.bcc &&
227
226
  cc == o.cc &&
@@ -239,7 +238,7 @@ module MailSlurpClient
239
238
  # Calculates hash code according to all attributes.
240
239
  # @return [Integer] Hash code
241
240
  def hash
242
- [id, user_id, from, subject, attachments, inbox_id, to, bcc, cc, created_at, body_md5_hash, virtual_send].hash
241
+ [subject, id, from, inbox_id, user_id, attachments, to, bcc, cc, created_at, body_md5_hash, virtual_send].hash
243
242
  end
244
243
 
245
244
  # Builds the object from hash
@@ -15,6 +15,9 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # A thread is a message thread created for a message received by an alias
17
17
  class ThreadProjection
18
+ # Thread subject
19
+ attr_accessor :subject
20
+
18
21
  # Inbox ID
19
22
  attr_accessor :inbox_id
20
23
 
@@ -39,9 +42,6 @@ module MailSlurpClient
39
42
  # Updated at DateTime
40
43
  attr_accessor :updated_at
41
44
 
42
- # Thread subject
43
- attr_accessor :subject
44
-
45
45
  # Name of thread
46
46
  attr_accessor :name
47
47
 
@@ -51,6 +51,7 @@ module MailSlurpClient
51
51
  # Attribute mapping from ruby-style variable name to JSON key.
52
52
  def self.attribute_map
53
53
  {
54
+ :'subject' => :'subject',
54
55
  :'inbox_id' => :'inboxId',
55
56
  :'user_id' => :'userId',
56
57
  :'to' => :'to',
@@ -59,7 +60,6 @@ module MailSlurpClient
59
60
  :'alias_id' => :'aliasId',
60
61
  :'created_at' => :'createdAt',
61
62
  :'updated_at' => :'updatedAt',
62
- :'subject' => :'subject',
63
63
  :'name' => :'name',
64
64
  :'id' => :'id'
65
65
  }
@@ -68,6 +68,7 @@ module MailSlurpClient
68
68
  # Attribute type mapping.
69
69
  def self.openapi_types
70
70
  {
71
+ :'subject' => :'String',
71
72
  :'inbox_id' => :'String',
72
73
  :'user_id' => :'String',
73
74
  :'to' => :'Array<String>',
@@ -76,7 +77,6 @@ module MailSlurpClient
76
77
  :'alias_id' => :'String',
77
78
  :'created_at' => :'DateTime',
78
79
  :'updated_at' => :'DateTime',
79
- :'subject' => :'String',
80
80
  :'name' => :'String',
81
81
  :'id' => :'String'
82
82
  }
@@ -103,6 +103,10 @@ module MailSlurpClient
103
103
  h[k.to_sym] = v
104
104
  }
105
105
 
106
+ if attributes.key?(:'subject')
107
+ self.subject = attributes[:'subject']
108
+ end
109
+
106
110
  if attributes.key?(:'inbox_id')
107
111
  self.inbox_id = attributes[:'inbox_id']
108
112
  end
@@ -141,10 +145,6 @@ module MailSlurpClient
141
145
  self.updated_at = attributes[:'updated_at']
142
146
  end
143
147
 
144
- if attributes.key?(:'subject')
145
- self.subject = attributes[:'subject']
146
- end
147
-
148
148
  if attributes.key?(:'name')
149
149
  self.name = attributes[:'name']
150
150
  end
@@ -207,6 +207,7 @@ module MailSlurpClient
207
207
  def ==(o)
208
208
  return true if self.equal?(o)
209
209
  self.class == o.class &&
210
+ subject == o.subject &&
210
211
  inbox_id == o.inbox_id &&
211
212
  user_id == o.user_id &&
212
213
  to == o.to &&
@@ -215,7 +216,6 @@ module MailSlurpClient
215
216
  alias_id == o.alias_id &&
216
217
  created_at == o.created_at &&
217
218
  updated_at == o.updated_at &&
218
- subject == o.subject &&
219
219
  name == o.name &&
220
220
  id == o.id
221
221
  end
@@ -229,7 +229,7 @@ module MailSlurpClient
229
229
  # Calculates hash code according to all attributes.
230
230
  # @return [Integer] Hash code
231
231
  def hash
232
- [inbox_id, user_id, to, bcc, cc, alias_id, created_at, updated_at, subject, name, id].hash
232
+ [subject, inbox_id, user_id, to, bcc, cc, alias_id, created_at, updated_at, name, id].hash
233
233
  end
234
234
 
235
235
  # Builds the object from hash
@@ -15,12 +15,12 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Unknown missed email projection
17
17
  class UnknownMissedEmailProjection
18
+ attr_accessor :subject
19
+
18
20
  attr_accessor :to
19
21
 
20
22
  attr_accessor :created_at
21
23
 
22
- attr_accessor :subject
23
-
24
24
  attr_accessor :id
25
25
 
26
26
  attr_accessor :from
@@ -28,9 +28,9 @@ module MailSlurpClient
28
28
  # Attribute mapping from ruby-style variable name to JSON key.
29
29
  def self.attribute_map
30
30
  {
31
+ :'subject' => :'subject',
31
32
  :'to' => :'to',
32
33
  :'created_at' => :'createdAt',
33
- :'subject' => :'subject',
34
34
  :'id' => :'id',
35
35
  :'from' => :'from'
36
36
  }
@@ -39,9 +39,9 @@ module MailSlurpClient
39
39
  # Attribute type mapping.
40
40
  def self.openapi_types
41
41
  {
42
+ :'subject' => :'String',
42
43
  :'to' => :'Array<String>',
43
44
  :'created_at' => :'DateTime',
44
- :'subject' => :'String',
45
45
  :'id' => :'String',
46
46
  :'from' => :'String'
47
47
  }
@@ -68,6 +68,10 @@ module MailSlurpClient
68
68
  h[k.to_sym] = v
69
69
  }
70
70
 
71
+ if attributes.key?(:'subject')
72
+ self.subject = attributes[:'subject']
73
+ end
74
+
71
75
  if attributes.key?(:'to')
72
76
  if (value = attributes[:'to']).is_a?(Array)
73
77
  self.to = value
@@ -78,10 +82,6 @@ module MailSlurpClient
78
82
  self.created_at = attributes[:'created_at']
79
83
  end
80
84
 
81
- if attributes.key?(:'subject')
82
- self.subject = attributes[:'subject']
83
- end
84
-
85
85
  if attributes.key?(:'id')
86
86
  self.id = attributes[:'id']
87
87
  end
@@ -119,9 +119,9 @@ module MailSlurpClient
119
119
  def ==(o)
120
120
  return true if self.equal?(o)
121
121
  self.class == o.class &&
122
+ subject == o.subject &&
122
123
  to == o.to &&
123
124
  created_at == o.created_at &&
124
- subject == o.subject &&
125
125
  id == o.id &&
126
126
  from == o.from
127
127
  end
@@ -135,7 +135,7 @@ module MailSlurpClient
135
135
  # Calculates hash code according to all attributes.
136
136
  # @return [Integer] Hash code
137
137
  def hash
138
- [to, created_at, subject, id, from].hash
138
+ [subject, to, created_at, id, from].hash
139
139
  end
140
140
 
141
141
  # Builds the object from hash
@@ -153,7 +153,7 @@ module MailSlurpClient
153
153
  return false if @account_state.nil?
154
154
  account_state_validator = EnumAttributeValidator.new('String', ["FROZEN", "ACTIVE"])
155
155
  return false unless account_state_validator.valid?(@account_state)
156
- subscription_type_validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "TEAM", "ENTERPRISE"])
156
+ subscription_type_validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "PRO", "TEAM", "ENTERPRISE"])
157
157
  return false unless subscription_type_validator.valid?(@subscription_type)
158
158
  return false if @account_type.nil?
159
159
  account_type_validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM", "CHILD_ADMIN"])
@@ -175,7 +175,7 @@ module MailSlurpClient
175
175
  # Custom attribute writer method checking allowed values (enum).
176
176
  # @param [Object] subscription_type Object to be assigned
177
177
  def subscription_type=(subscription_type)
178
- validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "TEAM", "ENTERPRISE"])
178
+ validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "PRO", "TEAM", "ENTERPRISE"])
179
179
  unless validator.valid?(subscription_type)
180
180
  fail ArgumentError, "invalid value for \"subscription_type\", must be one of #{validator.allowable_values}."
181
181
  end
@@ -0,0 +1,222 @@
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
+ # Result of retrying all failed webhook
17
+ class WebhookRedriveAllResult
18
+ attr_accessor :success
19
+
20
+ attr_accessor :message
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'success' => :'success',
26
+ :'message' => :'message'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'success' => :'Boolean',
34
+ :'message' => :'String'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ :'message'
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookRedriveAllResult` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookRedriveAllResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'success')
61
+ self.success = attributes[:'success']
62
+ end
63
+
64
+ if attributes.key?(:'message')
65
+ self.message = attributes[:'message']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @success.nil?
74
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
75
+ end
76
+
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ return false if @success.nil?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ success == o.success &&
93
+ message == o.message
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [success, message].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ new.build_from_hash(attributes)
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :DateTime
142
+ DateTime.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :Boolean
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ MailSlurpClient.const_get(type).build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end