mailslurp_client 16.2.5 → 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 (88) 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_thread_projection.rb +23 -23
  14. data/lib/mailslurp_client/models/entity_automation_item_projection.rb +10 -10
  15. data/lib/mailslurp_client/models/guest_portal_user_projection.rb +24 -24
  16. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +11 -11
  17. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +11 -11
  18. data/lib/mailslurp_client/models/lookup_mx_records_options.rb +211 -0
  19. data/lib/mailslurp_client/models/lookup_mx_records_results.rb +245 -0
  20. data/lib/mailslurp_client/models/opt_in_identity_projection.rb +21 -21
  21. data/lib/mailslurp_client/models/page_ai_transform_mapping_projection.rb +10 -10
  22. data/lib/mailslurp_client/models/page_ai_transform_projection.rb +10 -10
  23. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +10 -10
  24. data/lib/mailslurp_client/models/page_alias.rb +10 -10
  25. data/lib/mailslurp_client/models/page_alias_thread_projection.rb +10 -10
  26. data/lib/mailslurp_client/models/page_attachment_entity.rb +10 -10
  27. data/lib/mailslurp_client/models/page_bounced_email.rb +10 -10
  28. data/lib/mailslurp_client/models/page_bounced_recipients.rb +10 -10
  29. data/lib/mailslurp_client/models/page_complaint.rb +10 -10
  30. data/lib/mailslurp_client/models/page_connector.rb +10 -10
  31. data/lib/mailslurp_client/models/page_connector_events.rb +10 -10
  32. data/lib/mailslurp_client/models/page_contact_projection.rb +10 -10
  33. data/lib/mailslurp_client/models/page_delivery_status.rb +10 -10
  34. data/lib/mailslurp_client/models/page_email_preview.rb +10 -10
  35. data/lib/mailslurp_client/models/page_email_projection.rb +10 -10
  36. data/lib/mailslurp_client/models/page_email_thread_projection.rb +10 -10
  37. data/lib/mailslurp_client/models/page_email_validation_request.rb +10 -10
  38. data/lib/mailslurp_client/models/page_entity_automation_items.rb +10 -10
  39. data/lib/mailslurp_client/models/page_entity_event_items.rb +10 -10
  40. data/lib/mailslurp_client/models/page_entity_favourite_items.rb +10 -10
  41. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +10 -10
  42. data/lib/mailslurp_client/models/page_group_projection.rb +10 -10
  43. data/lib/mailslurp_client/models/page_guest_portal_users.rb +10 -10
  44. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +10 -10
  45. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +10 -10
  46. data/lib/mailslurp_client/models/page_inbox_projection.rb +10 -10
  47. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +10 -10
  48. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +10 -10
  49. data/lib/mailslurp_client/models/page_inbox_tags.rb +10 -10
  50. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +10 -10
  51. data/lib/mailslurp_client/models/page_missed_email_projection.rb +10 -10
  52. data/lib/mailslurp_client/models/page_opt_in_identity_projection.rb +10 -10
  53. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +10 -10
  54. data/lib/mailslurp_client/models/page_phone_message_thread_item_projection.rb +10 -10
  55. data/lib/mailslurp_client/models/page_phone_message_thread_projection.rb +10 -10
  56. data/lib/mailslurp_client/models/page_phone_number_projection.rb +10 -10
  57. data/lib/mailslurp_client/models/page_plus_address_projection.rb +10 -10
  58. data/lib/mailslurp_client/models/page_reputation_items.rb +10 -10
  59. data/lib/mailslurp_client/models/{page_inbox_ruleset_dto.rb → page_ruleset_dto.rb} +15 -15
  60. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +10 -10
  61. data/lib/mailslurp_client/models/page_sent_email_projection.rb +10 -10
  62. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +10 -10
  63. data/lib/mailslurp_client/models/page_sent_sms_projection.rb +10 -10
  64. data/lib/mailslurp_client/models/page_sms_projection.rb +10 -10
  65. data/lib/mailslurp_client/models/page_template_projection.rb +10 -10
  66. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +10 -10
  67. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +10 -10
  68. data/lib/mailslurp_client/models/page_webhook_endpoint_projection.rb +10 -10
  69. data/lib/mailslurp_client/models/page_webhook_projection.rb +10 -10
  70. data/lib/mailslurp_client/models/page_webhook_result.rb +10 -10
  71. data/lib/mailslurp_client/models/pageable_object.rb +13 -13
  72. data/lib/mailslurp_client/models/phone_message_thread_projection.rb +27 -27
  73. data/lib/mailslurp_client/models/plus_address_projection.rb +24 -24
  74. data/lib/mailslurp_client/models/{inbox_ruleset_dto.rb → ruleset_dto.rb} +17 -7
  75. data/lib/mailslurp_client/models/{inbox_ruleset_test_options.rb → ruleset_test_options.rb} +3 -3
  76. data/lib/mailslurp_client/models/sent_email_projection.rb +45 -45
  77. data/lib/mailslurp_client/models/template_projection.rb +15 -15
  78. data/lib/mailslurp_client/models/test_inbox_ruleset_sending_options.rb +13 -7
  79. data/lib/mailslurp_client/models/test_new_inbox_ruleset_options.rb +11 -11
  80. data/lib/mailslurp_client/models/{test_inbox_ruleset_receiving_options.rb → test_ruleset_receiving_options.rb} +16 -10
  81. data/lib/mailslurp_client/models/{test_inbox_ruleset_receiving_result.rb → test_ruleset_receiving_result.rb} +3 -3
  82. data/lib/mailslurp_client/models/{test_inbox_ruleset_sending_result.rb → test_ruleset_sending_result.rb} +3 -3
  83. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  84. data/lib/mailslurp_client/models/webhook_projection.rb +39 -30
  85. data/lib/mailslurp_client/models/webhook_result_dto.rb +15 -5
  86. data/lib/mailslurp_client/version.rb +1 -1
  87. data/lib/mailslurp_client.rb +10 -8
  88. metadata +12 -10
@@ -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
@@ -0,0 +1,245 @@
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 LookupMxRecordsResults
17
+ attr_accessor :records
18
+
19
+ attr_accessor :errors
20
+
21
+ attr_accessor :warnings
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'records' => :'records',
27
+ :'errors' => :'errors',
28
+ :'warnings' => :'warnings'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'records' => :'Array<DNSLookupResult>',
36
+ :'errors' => :'Array<String>',
37
+ :'warnings' => :'Array<String>'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::LookupMxRecordsResults` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::LookupMxRecordsResults`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'records')
63
+ if (value = attributes[:'records']).is_a?(Array)
64
+ self.records = value
65
+ end
66
+ end
67
+
68
+ if attributes.key?(:'errors')
69
+ if (value = attributes[:'errors']).is_a?(Array)
70
+ self.errors = value
71
+ end
72
+ end
73
+
74
+ if attributes.key?(:'warnings')
75
+ if (value = attributes[:'warnings']).is_a?(Array)
76
+ self.warnings = value
77
+ end
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ if @records.nil?
86
+ invalid_properties.push('invalid value for "records", records cannot be nil.')
87
+ end
88
+
89
+ if @errors.nil?
90
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
91
+ end
92
+
93
+ if @warnings.nil?
94
+ invalid_properties.push('invalid value for "warnings", warnings cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @records.nil?
104
+ return false if @errors.nil?
105
+ return false if @warnings.nil?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ records == o.records &&
115
+ errors == o.errors &&
116
+ warnings == o.warnings
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [records, errors, warnings].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :DateTime
165
+ DateTime.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ MailSlurpClient.const_get(type).build_from_hash(value)
196
+ end
197
+ end
198
+
199
+ # Returns the string representation of the object
200
+ # @return [String] String presentation of the object
201
+ def to_s
202
+ to_hash.to_s
203
+ end
204
+
205
+ # to_body is an alias to to_hash (backward compatibility)
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_body
208
+ to_hash
209
+ end
210
+
211
+ # Returns the object in the form of hash
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_hash
214
+ hash = {}
215
+ self.class.attribute_map.each_pair do |attr, param|
216
+ value = self.send(attr)
217
+ if value.nil?
218
+ is_nullable = self.class.openapi_nullable.include?(attr)
219
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
+ end
221
+
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+ end
245
+ end