mailslurp_client 15.11.0 → 15.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/attachment_controller_api.rb +4 -4
  3. data/lib/mailslurp_client/api/email_controller_api.rb +68 -3
  4. data/lib/mailslurp_client/api/missed_email_controller_api.rb +56 -0
  5. data/lib/mailslurp_client/api/phone_controller_api.rb +487 -0
  6. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +73 -0
  7. data/lib/mailslurp_client/api/sms_controller_api.rb +286 -0
  8. data/lib/mailslurp_client/api/wait_for_controller_api.rb +64 -0
  9. data/lib/mailslurp_client/api/webhook_controller_api.rb +2 -2
  10. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +2 -2
  11. data/lib/mailslurp_client/models/alias_projection.rb +27 -27
  12. data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
  13. data/lib/mailslurp_client/models/contact_projection.rb +18 -18
  14. data/lib/mailslurp_client/models/create_emergency_address_options.rb +324 -0
  15. data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
  16. data/lib/mailslurp_client/models/email_html_dto.rb +215 -0
  17. data/lib/mailslurp_client/models/email_projection.rb +10 -10
  18. data/lib/mailslurp_client/models/emergency_address.rb +408 -0
  19. data/lib/mailslurp_client/models/emergency_address_dto.rb +273 -0
  20. data/lib/mailslurp_client/models/empty_response_dto.rb +206 -0
  21. data/lib/mailslurp_client/models/page_alias.rb +19 -19
  22. data/lib/mailslurp_client/models/page_attachment_entity.rb +19 -19
  23. data/lib/mailslurp_client/models/page_bounced_email.rb +19 -19
  24. data/lib/mailslurp_client/models/page_bounced_recipients.rb +19 -19
  25. data/lib/mailslurp_client/models/page_contact_projection.rb +19 -19
  26. data/lib/mailslurp_client/models/page_email_preview.rb +19 -19
  27. data/lib/mailslurp_client/models/page_email_projection.rb +19 -19
  28. data/lib/mailslurp_client/models/page_email_validation_request.rb +19 -19
  29. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +19 -19
  30. data/lib/mailslurp_client/models/page_group_projection.rb +19 -19
  31. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +19 -19
  32. data/lib/mailslurp_client/models/page_inbox_projection.rb +19 -19
  33. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +19 -19
  34. data/lib/mailslurp_client/models/page_missed_email_projection.rb +19 -19
  35. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +19 -19
  36. data/lib/mailslurp_client/models/page_phone_number_projection.rb +308 -0
  37. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +344 -0
  38. data/lib/mailslurp_client/models/page_sms_projection.rb +308 -0
  39. data/lib/mailslurp_client/models/page_template_projection.rb +19 -19
  40. data/lib/mailslurp_client/models/page_thread_projection.rb +19 -19
  41. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +19 -19
  42. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +19 -19
  43. data/lib/mailslurp_client/models/page_webhook_projection.rb +19 -19
  44. data/lib/mailslurp_client/models/page_webhook_result.rb +19 -19
  45. data/lib/mailslurp_client/models/phone_number_dto.rb +347 -0
  46. data/lib/mailslurp_client/models/phone_number_projection.rb +302 -0
  47. data/lib/mailslurp_client/models/phone_plan_dto.rb +287 -0
  48. data/lib/mailslurp_client/models/send_with_queue_result.rb +318 -0
  49. data/lib/mailslurp_client/models/sent_email_projection.rb +15 -15
  50. data/lib/mailslurp_client/models/sms_match_option.rb +289 -0
  51. data/lib/mailslurp_client/models/sms_message.rb +318 -0
  52. data/lib/mailslurp_client/models/sms_preview.rb +267 -0
  53. data/lib/mailslurp_client/models/sms_projection.rb +282 -0
  54. data/lib/mailslurp_client/models/template_projection.rb +18 -18
  55. data/lib/mailslurp_client/models/thread_projection.rb +36 -36
  56. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  57. data/lib/mailslurp_client/models/wait_for_sms_conditions.rb +371 -0
  58. data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
  59. data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
  60. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  61. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
  62. data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
  63. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  64. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
  65. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  66. data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
  67. data/lib/mailslurp_client/models/webhook_result_dto.rb +2 -2
  68. data/lib/mailslurp_client/version.rb +1 -1
  69. data/lib/mailslurp_client.rb +19 -0
  70. metadata +21 -2
@@ -19,6 +19,8 @@ module MailSlurpClient
19
19
 
20
20
  attr_accessor :group_id
21
21
 
22
+ attr_accessor :created_at
23
+
22
24
  attr_accessor :first_name
23
25
 
24
26
  attr_accessor :last_name
@@ -29,19 +31,17 @@ module MailSlurpClient
29
31
 
30
32
  attr_accessor :opt_out
31
33
 
32
- attr_accessor :created_at
33
-
34
34
  # Attribute mapping from ruby-style variable name to JSON key.
35
35
  def self.attribute_map
36
36
  {
37
37
  :'id' => :'id',
38
38
  :'group_id' => :'groupId',
39
+ :'created_at' => :'createdAt',
39
40
  :'first_name' => :'firstName',
40
41
  :'last_name' => :'lastName',
41
42
  :'company' => :'company',
42
43
  :'email_addresses' => :'emailAddresses',
43
- :'opt_out' => :'optOut',
44
- :'created_at' => :'createdAt'
44
+ :'opt_out' => :'optOut'
45
45
  }
46
46
  end
47
47
 
@@ -50,12 +50,12 @@ module MailSlurpClient
50
50
  {
51
51
  :'id' => :'String',
52
52
  :'group_id' => :'String',
53
+ :'created_at' => :'DateTime',
53
54
  :'first_name' => :'String',
54
55
  :'last_name' => :'String',
55
56
  :'company' => :'String',
56
57
  :'email_addresses' => :'Array<String>',
57
- :'opt_out' => :'Boolean',
58
- :'created_at' => :'DateTime'
58
+ :'opt_out' => :'Boolean'
59
59
  }
60
60
  end
61
61
 
@@ -88,6 +88,10 @@ module MailSlurpClient
88
88
  self.group_id = attributes[:'group_id']
89
89
  end
90
90
 
91
+ if attributes.key?(:'created_at')
92
+ self.created_at = attributes[:'created_at']
93
+ end
94
+
91
95
  if attributes.key?(:'first_name')
92
96
  self.first_name = attributes[:'first_name']
93
97
  end
@@ -109,10 +113,6 @@ module MailSlurpClient
109
113
  if attributes.key?(:'opt_out')
110
114
  self.opt_out = attributes[:'opt_out']
111
115
  end
112
-
113
- if attributes.key?(:'created_at')
114
- self.created_at = attributes[:'created_at']
115
- end
116
116
  end
117
117
 
118
118
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -123,14 +123,14 @@ module MailSlurpClient
123
123
  invalid_properties.push('invalid value for "id", id cannot be nil.')
124
124
  end
125
125
 
126
- if @opt_out.nil?
127
- invalid_properties.push('invalid value for "opt_out", opt_out cannot be nil.')
128
- end
129
-
130
126
  if @created_at.nil?
131
127
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
132
128
  end
133
129
 
130
+ if @opt_out.nil?
131
+ invalid_properties.push('invalid value for "opt_out", opt_out cannot be nil.')
132
+ end
133
+
134
134
  invalid_properties
135
135
  end
136
136
 
@@ -138,8 +138,8 @@ module MailSlurpClient
138
138
  # @return true if the model is valid
139
139
  def valid?
140
140
  return false if @id.nil?
141
- return false if @opt_out.nil?
142
141
  return false if @created_at.nil?
142
+ return false if @opt_out.nil?
143
143
  true
144
144
  end
145
145
 
@@ -150,12 +150,12 @@ module MailSlurpClient
150
150
  self.class == o.class &&
151
151
  id == o.id &&
152
152
  group_id == o.group_id &&
153
+ created_at == o.created_at &&
153
154
  first_name == o.first_name &&
154
155
  last_name == o.last_name &&
155
156
  company == o.company &&
156
157
  email_addresses == o.email_addresses &&
157
- opt_out == o.opt_out &&
158
- created_at == o.created_at
158
+ opt_out == o.opt_out
159
159
  end
160
160
 
161
161
  # @see the `==` method
@@ -167,7 +167,7 @@ module MailSlurpClient
167
167
  # Calculates hash code according to all attributes.
168
168
  # @return [Integer] Hash code
169
169
  def hash
170
- [id, group_id, first_name, last_name, company, email_addresses, opt_out, created_at].hash
170
+ [id, group_id, created_at, first_name, last_name, company, email_addresses, opt_out].hash
171
171
  end
172
172
 
173
173
  # Builds the object from hash
@@ -0,0 +1,324 @@
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
+ class CreateEmergencyAddressOptions
17
+ attr_accessor :customer_name
18
+
19
+ attr_accessor :address1
20
+
21
+ attr_accessor :city
22
+
23
+ attr_accessor :region
24
+
25
+ attr_accessor :postal_code
26
+
27
+ attr_accessor :iso_country_code
28
+
29
+ attr_accessor :display_name
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'customer_name' => :'customerName',
57
+ :'address1' => :'address1',
58
+ :'city' => :'city',
59
+ :'region' => :'region',
60
+ :'postal_code' => :'postalCode',
61
+ :'iso_country_code' => :'isoCountryCode',
62
+ :'display_name' => :'displayName'
63
+ }
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'customer_name' => :'String',
70
+ :'address1' => :'String',
71
+ :'city' => :'String',
72
+ :'region' => :'String',
73
+ :'postal_code' => :'String',
74
+ :'iso_country_code' => :'String',
75
+ :'display_name' => :'String'
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new([
82
+ ])
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateEmergencyAddressOptions` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!self.class.attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateEmergencyAddressOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'customer_name')
101
+ self.customer_name = attributes[:'customer_name']
102
+ end
103
+
104
+ if attributes.key?(:'address1')
105
+ self.address1 = attributes[:'address1']
106
+ end
107
+
108
+ if attributes.key?(:'city')
109
+ self.city = attributes[:'city']
110
+ end
111
+
112
+ if attributes.key?(:'region')
113
+ self.region = attributes[:'region']
114
+ end
115
+
116
+ if attributes.key?(:'postal_code')
117
+ self.postal_code = attributes[:'postal_code']
118
+ end
119
+
120
+ if attributes.key?(:'iso_country_code')
121
+ self.iso_country_code = attributes[:'iso_country_code']
122
+ end
123
+
124
+ if attributes.key?(:'display_name')
125
+ self.display_name = attributes[:'display_name']
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ if @customer_name.nil?
134
+ invalid_properties.push('invalid value for "customer_name", customer_name cannot be nil.')
135
+ end
136
+
137
+ if @address1.nil?
138
+ invalid_properties.push('invalid value for "address1", address1 cannot be nil.')
139
+ end
140
+
141
+ if @city.nil?
142
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
143
+ end
144
+
145
+ if @region.nil?
146
+ invalid_properties.push('invalid value for "region", region cannot be nil.')
147
+ end
148
+
149
+ if @postal_code.nil?
150
+ invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.')
151
+ end
152
+
153
+ if @iso_country_code.nil?
154
+ invalid_properties.push('invalid value for "iso_country_code", iso_country_code cannot be nil.')
155
+ end
156
+
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ return false if @customer_name.nil?
164
+ return false if @address1.nil?
165
+ return false if @city.nil?
166
+ return false if @region.nil?
167
+ return false if @postal_code.nil?
168
+ return false if @iso_country_code.nil?
169
+ iso_country_code_validator = EnumAttributeValidator.new('String', ["US", "GB"])
170
+ return false unless iso_country_code_validator.valid?(@iso_country_code)
171
+ true
172
+ end
173
+
174
+ # Custom attribute writer method checking allowed values (enum).
175
+ # @param [Object] iso_country_code Object to be assigned
176
+ def iso_country_code=(iso_country_code)
177
+ validator = EnumAttributeValidator.new('String', ["US", "GB"])
178
+ unless validator.valid?(iso_country_code)
179
+ fail ArgumentError, "invalid value for \"iso_country_code\", must be one of #{validator.allowable_values}."
180
+ end
181
+ @iso_country_code = iso_country_code
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ customer_name == o.customer_name &&
190
+ address1 == o.address1 &&
191
+ city == o.city &&
192
+ region == o.region &&
193
+ postal_code == o.postal_code &&
194
+ iso_country_code == o.iso_country_code &&
195
+ display_name == o.display_name
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [customer_name, address1, city, region, postal_code, iso_country_code, display_name].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ new.build_from_hash(attributes)
215
+ end
216
+
217
+ # Builds the object from hash
218
+ # @param [Hash] attributes Model attributes in the form of hash
219
+ # @return [Object] Returns the model itself
220
+ def build_from_hash(attributes)
221
+ return nil unless attributes.is_a?(Hash)
222
+ self.class.openapi_types.each_pair do |key, type|
223
+ if type =~ /\AArray<(.*)>/i
224
+ # check to ensure the input is an array given that the attribute
225
+ # is documented as an array but the input is not
226
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
227
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
228
+ end
229
+ elsif !attributes[self.class.attribute_map[key]].nil?
230
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
231
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
232
+ end
233
+
234
+ self
235
+ end
236
+
237
+ # Deserializes the data based on type
238
+ # @param string type Data type
239
+ # @param string value Value to be deserialized
240
+ # @return [Object] Deserialized data
241
+ def _deserialize(type, value)
242
+ case type.to_sym
243
+ when :DateTime
244
+ DateTime.parse(value)
245
+ when :Date
246
+ Date.parse(value)
247
+ when :String
248
+ value.to_s
249
+ when :Integer
250
+ value.to_i
251
+ when :Float
252
+ value.to_f
253
+ when :Boolean
254
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
255
+ true
256
+ else
257
+ false
258
+ end
259
+ when :Object
260
+ # generic object (usually a Hash), return directly
261
+ value
262
+ when /\AArray<(?<inner_type>.+)>\z/
263
+ inner_type = Regexp.last_match[:inner_type]
264
+ value.map { |v| _deserialize(inner_type, v) }
265
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
266
+ k_type = Regexp.last_match[:k_type]
267
+ v_type = Regexp.last_match[:v_type]
268
+ {}.tap do |hash|
269
+ value.each do |k, v|
270
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
+ end
272
+ end
273
+ else # model
274
+ MailSlurpClient.const_get(type).build_from_hash(value)
275
+ end
276
+ end
277
+
278
+ # Returns the string representation of the object
279
+ # @return [String] String presentation of the object
280
+ def to_s
281
+ to_hash.to_s
282
+ end
283
+
284
+ # to_body is an alias to to_hash (backward compatibility)
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_body
287
+ to_hash
288
+ end
289
+
290
+ # Returns the object in the form of hash
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_hash
293
+ hash = {}
294
+ self.class.attribute_map.each_pair do |attr, param|
295
+ value = self.send(attr)
296
+ if value.nil?
297
+ is_nullable = self.class.openapi_nullable.include?(attr)
298
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
299
+ end
300
+
301
+ hash[param] = _to_hash(value)
302
+ end
303
+ hash
304
+ end
305
+
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+ end
324
+ end
@@ -121,7 +121,7 @@ module MailSlurpClient
121
121
  # @return true if the model is valid
122
122
  def valid?
123
123
  return false if @url.nil?
124
- event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "BOUNCE", "BOUNCE_RECIPIENT"])
124
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "BOUNCE", "BOUNCE_RECIPIENT", "NEW_SMS"])
125
125
  return false unless event_name_validator.valid?(@event_name)
126
126
  true
127
127
  end
@@ -129,7 +129,7 @@ module MailSlurpClient
129
129
  # Custom attribute writer method checking allowed values (enum).
130
130
  # @param [Object] event_name Object to be assigned
131
131
  def event_name=(event_name)
132
- validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "BOUNCE", "BOUNCE_RECIPIENT"])
132
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "BOUNCE", "BOUNCE_RECIPIENT", "NEW_SMS"])
133
133
  unless validator.valid?(event_name)
134
134
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
135
135
  end
@@ -0,0 +1,215 @@
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
+ class EmailHtmlDto
17
+ attr_accessor :subject
18
+
19
+ attr_accessor :body
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'subject' => :'subject',
25
+ :'body' => :'body'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'subject' => :'String',
33
+ :'body' => :'String'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmailHtmlDto` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmailHtmlDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'subject')
59
+ self.subject = attributes[:'subject']
60
+ end
61
+
62
+ if attributes.key?(:'body')
63
+ self.body = attributes[:'body']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ subject == o.subject &&
86
+ body == o.body
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [subject, body].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ MailSlurpClient.const_get(type).build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+ end
215
+ end