mailslurp_client 16.2.4 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/inbox_controller_api.rb +15 -15
  3. data/lib/mailslurp_client/api/{inbox_ruleset_controller_api.rb → ruleset_controller_api.rb} +184 -175
  4. data/lib/mailslurp_client/api/tools_controller_api.rb +62 -0
  5. data/lib/mailslurp_client/api/webhook_controller_api.rb +82 -0
  6. data/lib/mailslurp_client/models/ai_transform_dto.rb +19 -5
  7. data/lib/mailslurp_client/models/alias_projection.rb +29 -29
  8. data/lib/mailslurp_client/models/alias_thread_projection.rb +26 -26
  9. data/lib/mailslurp_client/models/attachment_projection.rb +21 -21
  10. data/lib/mailslurp_client/models/connector_projection.rb +15 -15
  11. data/lib/mailslurp_client/models/{create_inbox_ruleset_options.rb → create_ruleset_options.rb} +5 -5
  12. data/lib/mailslurp_client/models/email.rb +13 -13
  13. data/lib/mailslurp_client/models/email_projection.rb +11 -11
  14. data/lib/mailslurp_client/models/email_thread_projection.rb +29 -29
  15. data/lib/mailslurp_client/models/entity_automation_item_projection.rb +10 -10
  16. data/lib/mailslurp_client/models/guest_portal_user_projection.rb +24 -24
  17. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +11 -11
  18. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +11 -11
  19. data/lib/mailslurp_client/models/lookup_mx_records_options.rb +211 -0
  20. data/lib/mailslurp_client/models/lookup_mx_records_results.rb +245 -0
  21. data/lib/mailslurp_client/models/opt_in_identity_projection.rb +21 -21
  22. data/lib/mailslurp_client/models/page_ai_transform_mapping_projection.rb +10 -10
  23. data/lib/mailslurp_client/models/page_ai_transform_projection.rb +10 -10
  24. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +10 -10
  25. data/lib/mailslurp_client/models/page_alias.rb +10 -10
  26. data/lib/mailslurp_client/models/page_alias_thread_projection.rb +10 -10
  27. data/lib/mailslurp_client/models/page_attachment_entity.rb +10 -10
  28. data/lib/mailslurp_client/models/page_bounced_email.rb +10 -10
  29. data/lib/mailslurp_client/models/page_bounced_recipients.rb +10 -10
  30. data/lib/mailslurp_client/models/page_complaint.rb +10 -10
  31. data/lib/mailslurp_client/models/page_connector.rb +10 -10
  32. data/lib/mailslurp_client/models/page_connector_events.rb +10 -10
  33. data/lib/mailslurp_client/models/page_contact_projection.rb +10 -10
  34. data/lib/mailslurp_client/models/page_delivery_status.rb +10 -10
  35. data/lib/mailslurp_client/models/page_email_preview.rb +10 -10
  36. data/lib/mailslurp_client/models/page_email_projection.rb +10 -10
  37. data/lib/mailslurp_client/models/page_email_thread_projection.rb +10 -10
  38. data/lib/mailslurp_client/models/page_email_validation_request.rb +10 -10
  39. data/lib/mailslurp_client/models/page_entity_automation_items.rb +10 -10
  40. data/lib/mailslurp_client/models/page_entity_event_items.rb +10 -10
  41. data/lib/mailslurp_client/models/page_entity_favourite_items.rb +10 -10
  42. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +10 -10
  43. data/lib/mailslurp_client/models/page_group_projection.rb +10 -10
  44. data/lib/mailslurp_client/models/page_guest_portal_users.rb +10 -10
  45. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +10 -10
  46. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +10 -10
  47. data/lib/mailslurp_client/models/page_inbox_projection.rb +10 -10
  48. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +10 -10
  49. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +10 -10
  50. data/lib/mailslurp_client/models/page_inbox_tags.rb +10 -10
  51. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +10 -10
  52. data/lib/mailslurp_client/models/page_missed_email_projection.rb +10 -10
  53. data/lib/mailslurp_client/models/page_opt_in_identity_projection.rb +10 -10
  54. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +10 -10
  55. data/lib/mailslurp_client/models/page_phone_message_thread_item_projection.rb +10 -10
  56. data/lib/mailslurp_client/models/page_phone_message_thread_projection.rb +10 -10
  57. data/lib/mailslurp_client/models/page_phone_number_projection.rb +10 -10
  58. data/lib/mailslurp_client/models/page_plus_address_projection.rb +10 -10
  59. data/lib/mailslurp_client/models/page_reputation_items.rb +10 -10
  60. data/lib/mailslurp_client/models/{page_inbox_ruleset_dto.rb → page_ruleset_dto.rb} +15 -15
  61. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +10 -10
  62. data/lib/mailslurp_client/models/page_sent_email_projection.rb +10 -10
  63. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +10 -10
  64. data/lib/mailslurp_client/models/page_sent_sms_projection.rb +10 -10
  65. data/lib/mailslurp_client/models/page_sms_projection.rb +10 -10
  66. data/lib/mailslurp_client/models/page_template_projection.rb +10 -10
  67. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +10 -10
  68. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +10 -10
  69. data/lib/mailslurp_client/models/page_webhook_endpoint_projection.rb +10 -10
  70. data/lib/mailslurp_client/models/page_webhook_projection.rb +10 -10
  71. data/lib/mailslurp_client/models/page_webhook_result.rb +10 -10
  72. data/lib/mailslurp_client/models/pageable_object.rb +13 -13
  73. data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +19 -19
  74. data/lib/mailslurp_client/models/phone_message_thread_projection.rb +27 -27
  75. data/lib/mailslurp_client/models/plus_address_projection.rb +24 -24
  76. data/lib/mailslurp_client/models/{inbox_ruleset_dto.rb → ruleset_dto.rb} +17 -7
  77. data/lib/mailslurp_client/models/{inbox_ruleset_test_options.rb → ruleset_test_options.rb} +3 -3
  78. data/lib/mailslurp_client/models/sent_email_projection.rb +52 -52
  79. data/lib/mailslurp_client/models/template_projection.rb +15 -15
  80. data/lib/mailslurp_client/models/test_inbox_ruleset_sending_options.rb +13 -7
  81. data/lib/mailslurp_client/models/test_new_inbox_ruleset_options.rb +11 -11
  82. data/lib/mailslurp_client/models/{test_inbox_ruleset_receiving_options.rb → test_ruleset_receiving_options.rb} +16 -10
  83. data/lib/mailslurp_client/models/{test_inbox_ruleset_receiving_result.rb → test_ruleset_receiving_result.rb} +3 -3
  84. data/lib/mailslurp_client/models/{test_inbox_ruleset_sending_result.rb → test_ruleset_sending_result.rb} +3 -3
  85. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  86. data/lib/mailslurp_client/models/webhook_projection.rb +39 -30
  87. data/lib/mailslurp_client/models/webhook_result_dto.rb +15 -5
  88. data/lib/mailslurp_client/version.rb +1 -1
  89. data/lib/mailslurp_client.rb +10 -8
  90. metadata +12 -10
@@ -17,16 +17,16 @@ module MailSlurpClient
17
17
  class GuestPortalUserProjection
18
18
  attr_accessor :username
19
19
 
20
- attr_accessor :inbox_id
21
-
22
20
  attr_accessor :user_id
23
21
 
24
- attr_accessor :email_address
22
+ attr_accessor :inbox_id
25
23
 
26
- attr_accessor :updated_at
24
+ attr_accessor :email_address
27
25
 
28
26
  attr_accessor :created_at
29
27
 
28
+ attr_accessor :updated_at
29
+
30
30
  attr_accessor :portal_id
31
31
 
32
32
  attr_accessor :name
@@ -37,11 +37,11 @@ module MailSlurpClient
37
37
  def self.attribute_map
38
38
  {
39
39
  :'username' => :'username',
40
- :'inbox_id' => :'inboxId',
41
40
  :'user_id' => :'userId',
41
+ :'inbox_id' => :'inboxId',
42
42
  :'email_address' => :'emailAddress',
43
- :'updated_at' => :'updatedAt',
44
43
  :'created_at' => :'createdAt',
44
+ :'updated_at' => :'updatedAt',
45
45
  :'portal_id' => :'portalId',
46
46
  :'name' => :'name',
47
47
  :'id' => :'id'
@@ -52,11 +52,11 @@ module MailSlurpClient
52
52
  def self.openapi_types
53
53
  {
54
54
  :'username' => :'String',
55
- :'inbox_id' => :'String',
56
55
  :'user_id' => :'String',
56
+ :'inbox_id' => :'String',
57
57
  :'email_address' => :'String',
58
- :'updated_at' => :'DateTime',
59
58
  :'created_at' => :'DateTime',
59
+ :'updated_at' => :'DateTime',
60
60
  :'portal_id' => :'String',
61
61
  :'name' => :'String',
62
62
  :'id' => :'String'
@@ -88,26 +88,26 @@ module MailSlurpClient
88
88
  self.username = attributes[:'username']
89
89
  end
90
90
 
91
- if attributes.key?(:'inbox_id')
92
- self.inbox_id = attributes[:'inbox_id']
93
- end
94
-
95
91
  if attributes.key?(:'user_id')
96
92
  self.user_id = attributes[:'user_id']
97
93
  end
98
94
 
99
- if attributes.key?(:'email_address')
100
- self.email_address = attributes[:'email_address']
95
+ if attributes.key?(:'inbox_id')
96
+ self.inbox_id = attributes[:'inbox_id']
101
97
  end
102
98
 
103
- if attributes.key?(:'updated_at')
104
- self.updated_at = attributes[:'updated_at']
99
+ if attributes.key?(:'email_address')
100
+ self.email_address = attributes[:'email_address']
105
101
  end
106
102
 
107
103
  if attributes.key?(:'created_at')
108
104
  self.created_at = attributes[:'created_at']
109
105
  end
110
106
 
107
+ if attributes.key?(:'updated_at')
108
+ self.updated_at = attributes[:'updated_at']
109
+ end
110
+
111
111
  if attributes.key?(:'portal_id')
112
112
  self.portal_id = attributes[:'portal_id']
113
113
  end
@@ -133,14 +133,14 @@ module MailSlurpClient
133
133
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
134
134
  end
135
135
 
136
- if @updated_at.nil?
137
- invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
138
- end
139
-
140
136
  if @created_at.nil?
141
137
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
142
138
  end
143
139
 
140
+ if @updated_at.nil?
141
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
142
+ end
143
+
144
144
  if @portal_id.nil?
145
145
  invalid_properties.push('invalid value for "portal_id", portal_id cannot be nil.')
146
146
  end
@@ -157,8 +157,8 @@ module MailSlurpClient
157
157
  def valid?
158
158
  return false if @username.nil?
159
159
  return false if @user_id.nil?
160
- return false if @updated_at.nil?
161
160
  return false if @created_at.nil?
161
+ return false if @updated_at.nil?
162
162
  return false if @portal_id.nil?
163
163
  return false if @id.nil?
164
164
  true
@@ -170,11 +170,11 @@ module MailSlurpClient
170
170
  return true if self.equal?(o)
171
171
  self.class == o.class &&
172
172
  username == o.username &&
173
- inbox_id == o.inbox_id &&
174
173
  user_id == o.user_id &&
174
+ inbox_id == o.inbox_id &&
175
175
  email_address == o.email_address &&
176
- updated_at == o.updated_at &&
177
176
  created_at == o.created_at &&
177
+ updated_at == o.updated_at &&
178
178
  portal_id == o.portal_id &&
179
179
  name == o.name &&
180
180
  id == o.id
@@ -189,7 +189,7 @@ module MailSlurpClient
189
189
  # Calculates hash code according to all attributes.
190
190
  # @return [Integer] Hash code
191
191
  def hash
192
- [username, inbox_id, user_id, email_address, updated_at, created_at, portal_id, name, id].hash
192
+ [username, user_id, inbox_id, email_address, created_at, updated_at, portal_id, name, id].hash
193
193
  end
194
194
 
195
195
  # Builds the object from hash
@@ -15,12 +15,12 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Inbox forwarder event
17
17
  class InboxForwarderEventProjection
18
+ attr_accessor :user_id
19
+
18
20
  attr_accessor :email_id
19
21
 
20
22
  attr_accessor :inbox_id
21
23
 
22
- attr_accessor :user_id
23
-
24
24
  attr_accessor :created_at
25
25
 
26
26
  attr_accessor :sent_id
@@ -58,9 +58,9 @@ module MailSlurpClient
58
58
  # Attribute mapping from ruby-style variable name to JSON key.
59
59
  def self.attribute_map
60
60
  {
61
+ :'user_id' => :'userId',
61
62
  :'email_id' => :'emailId',
62
63
  :'inbox_id' => :'inboxId',
63
- :'user_id' => :'userId',
64
64
  :'created_at' => :'createdAt',
65
65
  :'sent_id' => :'sentId',
66
66
  :'forwarder_id' => :'forwarderId',
@@ -73,9 +73,9 @@ module MailSlurpClient
73
73
  # Attribute type mapping.
74
74
  def self.openapi_types
75
75
  {
76
+ :'user_id' => :'String',
76
77
  :'email_id' => :'String',
77
78
  :'inbox_id' => :'String',
78
- :'user_id' => :'String',
79
79
  :'created_at' => :'DateTime',
80
80
  :'sent_id' => :'String',
81
81
  :'forwarder_id' => :'String',
@@ -88,9 +88,9 @@ module MailSlurpClient
88
88
  # List of attributes with nullable: true
89
89
  def self.openapi_nullable
90
90
  Set.new([
91
+ :'user_id',
91
92
  :'email_id',
92
93
  :'inbox_id',
93
- :'user_id',
94
94
  :'sent_id',
95
95
  :'forwarder_id',
96
96
  :'message',
@@ -114,6 +114,10 @@ module MailSlurpClient
114
114
  h[k.to_sym] = v
115
115
  }
116
116
 
117
+ if attributes.key?(:'user_id')
118
+ self.user_id = attributes[:'user_id']
119
+ end
120
+
117
121
  if attributes.key?(:'email_id')
118
122
  self.email_id = attributes[:'email_id']
119
123
  end
@@ -122,10 +126,6 @@ module MailSlurpClient
122
126
  self.inbox_id = attributes[:'inbox_id']
123
127
  end
124
128
 
125
- if attributes.key?(:'user_id')
126
- self.user_id = attributes[:'user_id']
127
- end
128
-
129
129
  if attributes.key?(:'created_at')
130
130
  self.created_at = attributes[:'created_at']
131
131
  end
@@ -186,9 +186,9 @@ module MailSlurpClient
186
186
  def ==(o)
187
187
  return true if self.equal?(o)
188
188
  self.class == o.class &&
189
+ user_id == o.user_id &&
189
190
  email_id == o.email_id &&
190
191
  inbox_id == o.inbox_id &&
191
- user_id == o.user_id &&
192
192
  created_at == o.created_at &&
193
193
  sent_id == o.sent_id &&
194
194
  forwarder_id == o.forwarder_id &&
@@ -206,7 +206,7 @@ module MailSlurpClient
206
206
  # Calculates hash code according to all attributes.
207
207
  # @return [Integer] Hash code
208
208
  def hash
209
- [email_id, inbox_id, user_id, created_at, sent_id, forwarder_id, message, id, status].hash
209
+ [user_id, email_id, inbox_id, created_at, sent_id, forwarder_id, message, id, status].hash
210
210
  end
211
211
 
212
212
  # Builds the object from hash
@@ -17,12 +17,12 @@ module MailSlurpClient
17
17
  class InboxReplierEventProjection
18
18
  attr_accessor :recipients
19
19
 
20
+ attr_accessor :user_id
21
+
20
22
  attr_accessor :email_id
21
23
 
22
24
  attr_accessor :inbox_id
23
25
 
24
- attr_accessor :user_id
25
-
26
26
  attr_accessor :created_at
27
27
 
28
28
  attr_accessor :sent_id
@@ -61,9 +61,9 @@ module MailSlurpClient
61
61
  def self.attribute_map
62
62
  {
63
63
  :'recipients' => :'recipients',
64
+ :'user_id' => :'userId',
64
65
  :'email_id' => :'emailId',
65
66
  :'inbox_id' => :'inboxId',
66
- :'user_id' => :'userId',
67
67
  :'created_at' => :'createdAt',
68
68
  :'sent_id' => :'sentId',
69
69
  :'replier_id' => :'replierId',
@@ -77,9 +77,9 @@ module MailSlurpClient
77
77
  def self.openapi_types
78
78
  {
79
79
  :'recipients' => :'Array<String>',
80
+ :'user_id' => :'String',
80
81
  :'email_id' => :'String',
81
82
  :'inbox_id' => :'String',
82
- :'user_id' => :'String',
83
83
  :'created_at' => :'DateTime',
84
84
  :'sent_id' => :'String',
85
85
  :'replier_id' => :'String',
@@ -93,9 +93,9 @@ module MailSlurpClient
93
93
  def self.openapi_nullable
94
94
  Set.new([
95
95
  :'recipients',
96
+ :'user_id',
96
97
  :'email_id',
97
98
  :'inbox_id',
98
- :'user_id',
99
99
  :'sent_id',
100
100
  :'replier_id',
101
101
  :'message',
@@ -125,6 +125,10 @@ module MailSlurpClient
125
125
  end
126
126
  end
127
127
 
128
+ if attributes.key?(:'user_id')
129
+ self.user_id = attributes[:'user_id']
130
+ end
131
+
128
132
  if attributes.key?(:'email_id')
129
133
  self.email_id = attributes[:'email_id']
130
134
  end
@@ -133,10 +137,6 @@ module MailSlurpClient
133
137
  self.inbox_id = attributes[:'inbox_id']
134
138
  end
135
139
 
136
- if attributes.key?(:'user_id')
137
- self.user_id = attributes[:'user_id']
138
- end
139
-
140
140
  if attributes.key?(:'created_at')
141
141
  self.created_at = attributes[:'created_at']
142
142
  end
@@ -198,9 +198,9 @@ module MailSlurpClient
198
198
  return true if self.equal?(o)
199
199
  self.class == o.class &&
200
200
  recipients == o.recipients &&
201
+ user_id == o.user_id &&
201
202
  email_id == o.email_id &&
202
203
  inbox_id == o.inbox_id &&
203
- user_id == o.user_id &&
204
204
  created_at == o.created_at &&
205
205
  sent_id == o.sent_id &&
206
206
  replier_id == o.replier_id &&
@@ -218,7 +218,7 @@ module MailSlurpClient
218
218
  # Calculates hash code according to all attributes.
219
219
  # @return [Integer] Hash code
220
220
  def hash
221
- [recipients, email_id, inbox_id, user_id, created_at, sent_id, replier_id, message, id, status].hash
221
+ [recipients, user_id, email_id, inbox_id, created_at, sent_id, replier_id, message, id, status].hash
222
222
  end
223
223
 
224
224
  # 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 and SMS from dynamically allocated email addresses and phone numbers. 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 LookupMxRecordsOptions
17
+ attr_accessor :host
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'host' => :'host'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'host' => :'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::LookupMxRecordsOptions` 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::LookupMxRecordsOptions`. 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?(:'host')
55
+ self.host = attributes[:'host']
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 @host.nil?
64
+ invalid_properties.push('invalid value for "host", host 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 @host.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
+ host == o.host
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
+ [host].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