sendmux-mailbox 1.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 (139) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +3 -0
  4. data/lib/sendmux/mailbox/client.rb +34 -0
  5. data/lib/sendmux/mailbox/version.rb +7 -0
  6. data/lib/sendmux/mailbox.rb +12 -0
  7. data/lib/sendmux_mailbox_generated/api/mailbox_api_api.rb +3226 -0
  8. data/lib/sendmux_mailbox_generated/api_client.rb +441 -0
  9. data/lib/sendmux_mailbox_generated/api_error.rb +58 -0
  10. data/lib/sendmux_mailbox_generated/api_model_base.rb +88 -0
  11. data/lib/sendmux_mailbox_generated/configuration.rb +393 -0
  12. data/lib/sendmux_mailbox_generated/models/api_error_detail.rb +219 -0
  13. data/lib/sendmux_mailbox_generated/models/api_error_error.rb +275 -0
  14. data/lib/sendmux_mailbox_generated/models/api_error_meta.rb +164 -0
  15. data/lib/sendmux_mailbox_generated/models/api_error_response.rb +216 -0
  16. data/lib/sendmux_mailbox_generated/models/batch_delete_mailbox_messages_body.rb +204 -0
  17. data/lib/sendmux_mailbox_generated/models/batch_update_mailbox_messages_body.rb +224 -0
  18. data/lib/sendmux_mailbox_generated/models/create_mailbox_folder_body.rb +183 -0
  19. data/lib/sendmux_mailbox_generated/models/cursor_pagination.rb +173 -0
  20. data/lib/sendmux_mailbox_generated/models/mailbox.rb +284 -0
  21. data/lib/sendmux_mailbox_generated/models/mailbox_address.rb +176 -0
  22. data/lib/sendmux_mailbox_generated/models/mailbox_attachment.rb +248 -0
  23. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_result.rb +243 -0
  24. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_result_response.rb +223 -0
  25. data/lib/sendmux_mailbox_generated/models/mailbox_batch_delete_messages_result.rb +248 -0
  26. data/lib/sendmux_mailbox_generated/models/mailbox_batch_delete_messages_result_response.rb +223 -0
  27. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_body.rb +363 -0
  28. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_item.rb +188 -0
  29. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_result.rb +220 -0
  30. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_result_response.rb +223 -0
  31. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_result_states.rb +150 -0
  32. data/lib/sendmux_mailbox_generated/models/mailbox_batch_message_failure.rb +216 -0
  33. data/lib/sendmux_mailbox_generated/models/mailbox_batch_message_states.rb +162 -0
  34. data/lib/sendmux_mailbox_generated/models/mailbox_batch_update_messages_result.rb +248 -0
  35. data/lib/sendmux_mailbox_generated/models/mailbox_batch_update_messages_result_response.rb +223 -0
  36. data/lib/sendmux_mailbox_generated/models/mailbox_changes.rb +297 -0
  37. data/lib/sendmux_mailbox_generated/models/mailbox_changes_response.rb +223 -0
  38. data/lib/sendmux_mailbox_generated/models/mailbox_content_headers.rb +214 -0
  39. data/lib/sendmux_mailbox_generated/models/mailbox_content_headers_full_inner.rb +190 -0
  40. data/lib/sendmux_mailbox_generated/models/mailbox_content_headers_selected.rb +234 -0
  41. data/lib/sendmux_mailbox_generated/models/mailbox_folder.rb +307 -0
  42. data/lib/sendmux_mailbox_generated/models/mailbox_folder_cursor_list_response.rb +251 -0
  43. data/lib/sendmux_mailbox_generated/models/mailbox_folder_deleted_response.rb +223 -0
  44. data/lib/sendmux_mailbox_generated/models/mailbox_folder_deleted_response_all_of_data.rb +190 -0
  45. data/lib/sendmux_mailbox_generated/models/mailbox_folder_query_changes.rb +270 -0
  46. data/lib/sendmux_mailbox_generated/models/mailbox_folder_query_changes_added_inner.rb +190 -0
  47. data/lib/sendmux_mailbox_generated/models/mailbox_folder_query_changes_response.rb +223 -0
  48. data/lib/sendmux_mailbox_generated/models/mailbox_folder_response.rb +223 -0
  49. data/lib/sendmux_mailbox_generated/models/mailbox_get_changes200_response.rb +103 -0
  50. data/lib/sendmux_mailbox_generated/models/mailbox_identity.rb +352 -0
  51. data/lib/sendmux_mailbox_generated/models/mailbox_identity_cursor_list_response.rb +251 -0
  52. data/lib/sendmux_mailbox_generated/models/mailbox_identity_response.rb +223 -0
  53. data/lib/sendmux_mailbox_generated/models/mailbox_me.rb +301 -0
  54. data/lib/sendmux_mailbox_generated/models/mailbox_me_item_response.rb +223 -0
  55. data/lib/sendmux_mailbox_generated/models/mailbox_message.rb +515 -0
  56. data/lib/sendmux_mailbox_generated/models/mailbox_message_content.rb +348 -0
  57. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_body.rb +327 -0
  58. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_dates.rb +162 -0
  59. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_participants.rb +276 -0
  60. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_response.rb +223 -0
  61. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_response_all_of_data.rb +355 -0
  62. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_states.rb +176 -0
  63. data/lib/sendmux_mailbox_generated/models/mailbox_message_count.rb +176 -0
  64. data/lib/sendmux_mailbox_generated/models/mailbox_message_count_response.rb +223 -0
  65. data/lib/sendmux_mailbox_generated/models/mailbox_message_deleted_response.rb +223 -0
  66. data/lib/sendmux_mailbox_generated/models/mailbox_message_detail_response.rb +223 -0
  67. data/lib/sendmux_mailbox_generated/models/mailbox_message_flags.rb +242 -0
  68. data/lib/sendmux_mailbox_generated/models/mailbox_message_query_changes.rb +270 -0
  69. data/lib/sendmux_mailbox_generated/models/mailbox_message_query_changes_response.rb +223 -0
  70. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary.rb +456 -0
  71. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary_cursor_list_response.rb +251 -0
  72. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary_from.rb +183 -0
  73. data/lib/sendmux_mailbox_generated/models/mailbox_quota.rb +359 -0
  74. data/lib/sendmux_mailbox_generated/models/mailbox_quota_cursor_list_response.rb +251 -0
  75. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body.rb +279 -0
  76. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body_body.rb +200 -0
  77. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body_response.rb +223 -0
  78. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body_response_all_of_data.rb +286 -0
  79. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_event.rb +380 -0
  80. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_message.rb +529 -0
  81. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_message_all_of_body.rb +214 -0
  82. data/lib/sendmux_mailbox_generated/models/mailbox_search_snippet.rb +190 -0
  83. data/lib/sendmux_mailbox_generated/models/mailbox_search_snippets_result.rb +206 -0
  84. data/lib/sendmux_mailbox_generated/models/mailbox_search_snippets_result_response.rb +223 -0
  85. data/lib/sendmux_mailbox_generated/models/mailbox_send_result_response.rb +223 -0
  86. data/lib/sendmux_mailbox_generated/models/mailbox_send_scope.rb +213 -0
  87. data/lib/sendmux_mailbox_generated/models/mailbox_session.rb +294 -0
  88. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities.rb +346 -0
  89. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_attachments.rb +294 -0
  90. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_folders.rb +320 -0
  91. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_identities.rb +268 -0
  92. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_messages.rb +516 -0
  93. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_quotas.rb +242 -0
  94. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_submissions.rb +242 -0
  95. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_sync.rb +222 -0
  96. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_threads.rb +268 -0
  97. data/lib/sendmux_mailbox_generated/models/mailbox_session_endpoints.rb +334 -0
  98. data/lib/sendmux_mailbox_generated/models/mailbox_session_gated.rb +451 -0
  99. data/lib/sendmux_mailbox_generated/models/mailbox_session_limits.rb +398 -0
  100. data/lib/sendmux_mailbox_generated/models/mailbox_session_mailbox.rb +203 -0
  101. data/lib/sendmux_mailbox_generated/models/mailbox_session_response.rb +223 -0
  102. data/lib/sendmux_mailbox_generated/models/mailbox_session_states.rb +294 -0
  103. data/lib/sendmux_mailbox_generated/models/mailbox_submission.rb +321 -0
  104. data/lib/sendmux_mailbox_generated/models/mailbox_submission_cursor_list_response.rb +251 -0
  105. data/lib/sendmux_mailbox_generated/models/mailbox_submission_delivery_status.rb +200 -0
  106. data/lib/sendmux_mailbox_generated/models/mailbox_submission_envelope.rb +178 -0
  107. data/lib/sendmux_mailbox_generated/models/mailbox_submission_envelope_address.rb +178 -0
  108. data/lib/sendmux_mailbox_generated/models/mailbox_submission_envelope_rcpt_to_inner.rb +185 -0
  109. data/lib/sendmux_mailbox_generated/models/mailbox_submission_response.rb +223 -0
  110. data/lib/sendmux_mailbox_generated/models/mailbox_thread.rb +398 -0
  111. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_meta.rb +244 -0
  112. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_meta_states.rb +188 -0
  113. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_response.rb +251 -0
  114. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_response_all_of_data.rb +355 -0
  115. data/lib/sendmux_mailbox_generated/models/mailbox_thread_detail_response.rb +223 -0
  116. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary.rb +363 -0
  117. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_cursor_list_response.rb +251 -0
  118. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_last_message.rb +463 -0
  119. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_states.rb +162 -0
  120. data/lib/sendmux_mailbox_generated/models/mailbox_typed_changes.rb +164 -0
  121. data/lib/sendmux_mailbox_generated/models/mailbox_typed_changes_response.rb +223 -0
  122. data/lib/sendmux_mailbox_generated/models/mailbox_typed_changes_types.rb +192 -0
  123. data/lib/sendmux_mailbox_generated/models/mailbox_usage.rb +192 -0
  124. data/lib/sendmux_mailbox_generated/models/mailbox_usage_resource.rb +408 -0
  125. data/lib/sendmux_mailbox_generated/models/mailbox_usage_response.rb +223 -0
  126. data/lib/sendmux_mailbox_generated/models/mailbox_usage_states.rb +150 -0
  127. data/lib/sendmux_mailbox_generated/models/patch_mailbox_folder_body.rb +166 -0
  128. data/lib/sendmux_mailbox_generated/models/patch_mailbox_message_body.rb +168 -0
  129. data/lib/sendmux_mailbox_generated/models/response_meta.rb +164 -0
  130. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body.rb +283 -0
  131. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body_attachments_inner.rb +103 -0
  132. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body_attachments_inner_any_of.rb +217 -0
  133. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body_attachments_inner_any_of1.rb +217 -0
  134. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_result.rb +214 -0
  135. data/lib/sendmux_mailbox_generated/models/success_envelope.rb +192 -0
  136. data/lib/sendmux_mailbox_generated/models/update_mailbox_identity_body.rb +216 -0
  137. data/lib/sendmux_mailbox_generated/version.rb +15 -0
  138. data/lib/sendmux_mailbox_generated.rb +166 -0
  139. metadata +255 -0
@@ -0,0 +1,348 @@
1
+ =begin
2
+ #Sendmux API
3
+
4
+ #Programmatic access to your Sendmux email infrastructure.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendmux::Mailbox::Generated
17
+ class MailboxMessageContent < ApiModelBase
18
+ # Attachment metadata only. Attachment contents are not parsed by this endpoint.
19
+ attr_accessor :attachments
20
+
21
+ attr_accessor :body
22
+
23
+ attr_accessor :dates
24
+
25
+ attr_accessor :headers
26
+
27
+ # Message ID
28
+ attr_accessor :id
29
+
30
+ attr_accessor :participants
31
+
32
+ attr_accessor :states
33
+
34
+ attr_accessor :subject
35
+
36
+ attr_accessor :thread_id
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'attachments' => :'attachments',
42
+ :'body' => :'body',
43
+ :'dates' => :'dates',
44
+ :'headers' => :'headers',
45
+ :'id' => :'id',
46
+ :'participants' => :'participants',
47
+ :'states' => :'states',
48
+ :'subject' => :'subject',
49
+ :'thread_id' => :'thread_id'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'attachments' => :'Array<MailboxAttachment>',
67
+ :'body' => :'MailboxMessageContentBody',
68
+ :'dates' => :'MailboxMessageContentDates',
69
+ :'headers' => :'MailboxContentHeaders',
70
+ :'id' => :'String',
71
+ :'participants' => :'MailboxMessageContentParticipants',
72
+ :'states' => :'MailboxMessageContentStates',
73
+ :'subject' => :'String',
74
+ :'thread_id' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ :'subject',
82
+ :'thread_id'
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxMessageContent` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ acceptable_attribute_map = self.class.acceptable_attribute_map
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!acceptable_attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'attachments')
103
+ if (value = attributes[:'attachments']).is_a?(Array)
104
+ self.attachments = value
105
+ end
106
+ else
107
+ self.attachments = nil
108
+ end
109
+
110
+ if attributes.key?(:'body')
111
+ self.body = attributes[:'body']
112
+ else
113
+ self.body = nil
114
+ end
115
+
116
+ if attributes.key?(:'dates')
117
+ self.dates = attributes[:'dates']
118
+ else
119
+ self.dates = nil
120
+ end
121
+
122
+ if attributes.key?(:'headers')
123
+ self.headers = attributes[:'headers']
124
+ else
125
+ self.headers = nil
126
+ end
127
+
128
+ if attributes.key?(:'id')
129
+ self.id = attributes[:'id']
130
+ else
131
+ self.id = nil
132
+ end
133
+
134
+ if attributes.key?(:'participants')
135
+ self.participants = attributes[:'participants']
136
+ else
137
+ self.participants = nil
138
+ end
139
+
140
+ if attributes.key?(:'states')
141
+ self.states = attributes[:'states']
142
+ else
143
+ self.states = nil
144
+ end
145
+
146
+ if attributes.key?(:'subject')
147
+ self.subject = attributes[:'subject']
148
+ else
149
+ self.subject = nil
150
+ end
151
+
152
+ if attributes.key?(:'thread_id')
153
+ self.thread_id = attributes[:'thread_id']
154
+ else
155
+ self.thread_id = nil
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
163
+ invalid_properties = Array.new
164
+ if @attachments.nil?
165
+ invalid_properties.push('invalid value for "attachments", attachments cannot be nil.')
166
+ end
167
+
168
+ if @body.nil?
169
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
170
+ end
171
+
172
+ if @dates.nil?
173
+ invalid_properties.push('invalid value for "dates", dates cannot be nil.')
174
+ end
175
+
176
+ if @headers.nil?
177
+ invalid_properties.push('invalid value for "headers", headers cannot be nil.')
178
+ end
179
+
180
+ if @id.nil?
181
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
182
+ end
183
+
184
+ if @participants.nil?
185
+ invalid_properties.push('invalid value for "participants", participants cannot be nil.')
186
+ end
187
+
188
+ if @states.nil?
189
+ invalid_properties.push('invalid value for "states", states cannot be nil.')
190
+ end
191
+
192
+ invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ warn '[DEPRECATED] the `valid?` method is obsolete'
199
+ return false if @attachments.nil?
200
+ return false if @body.nil?
201
+ return false if @dates.nil?
202
+ return false if @headers.nil?
203
+ return false if @id.nil?
204
+ return false if @participants.nil?
205
+ return false if @states.nil?
206
+ true
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] attachments Value to be assigned
211
+ def attachments=(attachments)
212
+ if attachments.nil?
213
+ fail ArgumentError, 'attachments cannot be nil'
214
+ end
215
+
216
+ @attachments = attachments
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] body Value to be assigned
221
+ def body=(body)
222
+ if body.nil?
223
+ fail ArgumentError, 'body cannot be nil'
224
+ end
225
+
226
+ @body = body
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] dates Value to be assigned
231
+ def dates=(dates)
232
+ if dates.nil?
233
+ fail ArgumentError, 'dates cannot be nil'
234
+ end
235
+
236
+ @dates = dates
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] headers Value to be assigned
241
+ def headers=(headers)
242
+ if headers.nil?
243
+ fail ArgumentError, 'headers cannot be nil'
244
+ end
245
+
246
+ @headers = headers
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] id Value to be assigned
251
+ def id=(id)
252
+ if id.nil?
253
+ fail ArgumentError, 'id cannot be nil'
254
+ end
255
+
256
+ @id = id
257
+ end
258
+
259
+ # Custom attribute writer method with validation
260
+ # @param [Object] participants Value to be assigned
261
+ def participants=(participants)
262
+ if participants.nil?
263
+ fail ArgumentError, 'participants cannot be nil'
264
+ end
265
+
266
+ @participants = participants
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] states Value to be assigned
271
+ def states=(states)
272
+ if states.nil?
273
+ fail ArgumentError, 'states cannot be nil'
274
+ end
275
+
276
+ @states = states
277
+ end
278
+
279
+ # Checks equality by comparing each attribute.
280
+ # @param [Object] Object to be compared
281
+ def ==(o)
282
+ return true if self.equal?(o)
283
+ self.class == o.class &&
284
+ attachments == o.attachments &&
285
+ body == o.body &&
286
+ dates == o.dates &&
287
+ headers == o.headers &&
288
+ id == o.id &&
289
+ participants == o.participants &&
290
+ states == o.states &&
291
+ subject == o.subject &&
292
+ thread_id == o.thread_id
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Integer] Hash code
303
+ def hash
304
+ [attachments, body, dates, headers, id, participants, states, subject, thread_id].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def self.build_from_hash(attributes)
311
+ return nil unless attributes.is_a?(Hash)
312
+ attributes = attributes.transform_keys(&:to_sym)
313
+ transformed_hash = {}
314
+ openapi_types.each_pair do |key, type|
315
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
316
+ transformed_hash["#{key}"] = nil
317
+ elsif type =~ /\AArray<(.*)>/i
318
+ # check to ensure the input is an array given that the attribute
319
+ # is documented as an array but the input is not
320
+ if attributes[attribute_map[key]].is_a?(Array)
321
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
322
+ end
323
+ elsif !attributes[attribute_map[key]].nil?
324
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
325
+ end
326
+ end
327
+ new(transformed_hash)
328
+ end
329
+
330
+ # Returns the object in the form of hash
331
+ # @return [Hash] Returns the object in the form of hash
332
+ def to_hash
333
+ hash = {}
334
+ self.class.attribute_map.each_pair do |attr, param|
335
+ value = self.send(attr)
336
+ if value.nil?
337
+ is_nullable = self.class.openapi_nullable.include?(attr)
338
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
339
+ end
340
+
341
+ hash[param] = _to_hash(value)
342
+ end
343
+ hash
344
+ end
345
+
346
+ end
347
+
348
+ end
@@ -0,0 +1,327 @@
1
+ =begin
2
+ #Sendmux API
3
+
4
+ #Programmatic access to your Sendmux email infrastructure.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendmux::Mailbox::Generated
17
+ class MailboxMessageContentBody < ApiModelBase
18
+ attr_accessor :extracted_links
19
+
20
+ attr_accessor :format
21
+
22
+ # HTML body when requested. Returned as a JSON string and not as rendered content.
23
+ attr_accessor :html
24
+
25
+ attr_accessor :is_truncated
26
+
27
+ attr_accessor :quotes_stripped
28
+
29
+ attr_accessor :signature_stripped
30
+
31
+ attr_accessor :text
32
+
33
+ attr_accessor :truncated_at_chars
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'extracted_links' => :'extracted_links',
61
+ :'format' => :'format',
62
+ :'html' => :'html',
63
+ :'is_truncated' => :'is_truncated',
64
+ :'quotes_stripped' => :'quotes_stripped',
65
+ :'signature_stripped' => :'signature_stripped',
66
+ :'text' => :'text',
67
+ :'truncated_at_chars' => :'truncated_at_chars'
68
+ }
69
+ end
70
+
71
+ # Returns attribute mapping this model knows about
72
+ def self.acceptable_attribute_map
73
+ attribute_map
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ acceptable_attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'extracted_links' => :'Array<String>',
85
+ :'format' => :'String',
86
+ :'html' => :'String',
87
+ :'is_truncated' => :'Boolean',
88
+ :'quotes_stripped' => :'Boolean',
89
+ :'signature_stripped' => :'Boolean',
90
+ :'text' => :'String',
91
+ :'truncated_at_chars' => :'Integer'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ :'format',
99
+ :'html',
100
+ :'text',
101
+ :'truncated_at_chars'
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxMessageContentBody` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ acceptable_attribute_map = self.class.acceptable_attribute_map
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!acceptable_attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxMessageContentBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'extracted_links')
122
+ if (value = attributes[:'extracted_links']).is_a?(Array)
123
+ self.extracted_links = value
124
+ end
125
+ else
126
+ self.extracted_links = nil
127
+ end
128
+
129
+ if attributes.key?(:'format')
130
+ self.format = attributes[:'format']
131
+ else
132
+ self.format = nil
133
+ end
134
+
135
+ if attributes.key?(:'html')
136
+ self.html = attributes[:'html']
137
+ else
138
+ self.html = nil
139
+ end
140
+
141
+ if attributes.key?(:'is_truncated')
142
+ self.is_truncated = attributes[:'is_truncated']
143
+ else
144
+ self.is_truncated = nil
145
+ end
146
+
147
+ if attributes.key?(:'quotes_stripped')
148
+ self.quotes_stripped = attributes[:'quotes_stripped']
149
+ else
150
+ self.quotes_stripped = nil
151
+ end
152
+
153
+ if attributes.key?(:'signature_stripped')
154
+ self.signature_stripped = attributes[:'signature_stripped']
155
+ else
156
+ self.signature_stripped = nil
157
+ end
158
+
159
+ if attributes.key?(:'text')
160
+ self.text = attributes[:'text']
161
+ else
162
+ self.text = nil
163
+ end
164
+
165
+ if attributes.key?(:'truncated_at_chars')
166
+ self.truncated_at_chars = attributes[:'truncated_at_chars']
167
+ else
168
+ self.truncated_at_chars = nil
169
+ end
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properties with the reasons
174
+ def list_invalid_properties
175
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
176
+ invalid_properties = Array.new
177
+ if @extracted_links.nil?
178
+ invalid_properties.push('invalid value for "extracted_links", extracted_links cannot be nil.')
179
+ end
180
+
181
+ if @is_truncated.nil?
182
+ invalid_properties.push('invalid value for "is_truncated", is_truncated cannot be nil.')
183
+ end
184
+
185
+ if @quotes_stripped.nil?
186
+ invalid_properties.push('invalid value for "quotes_stripped", quotes_stripped cannot be nil.')
187
+ end
188
+
189
+ if @signature_stripped.nil?
190
+ invalid_properties.push('invalid value for "signature_stripped", signature_stripped cannot be nil.')
191
+ end
192
+
193
+ invalid_properties
194
+ end
195
+
196
+ # Check to see if the all the properties in the model are valid
197
+ # @return true if the model is valid
198
+ def valid?
199
+ warn '[DEPRECATED] the `valid?` method is obsolete'
200
+ return false if @extracted_links.nil?
201
+ format_validator = EnumAttributeValidator.new('String', ["text", "html", "unknown_default_open_api"])
202
+ return false unless format_validator.valid?(@format)
203
+ return false if @is_truncated.nil?
204
+ return false if @quotes_stripped.nil?
205
+ return false if @signature_stripped.nil?
206
+ true
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] extracted_links Value to be assigned
211
+ def extracted_links=(extracted_links)
212
+ if extracted_links.nil?
213
+ fail ArgumentError, 'extracted_links cannot be nil'
214
+ end
215
+
216
+ @extracted_links = extracted_links
217
+ end
218
+
219
+ # Custom attribute writer method checking allowed values (enum).
220
+ # @param [Object] format Object to be assigned
221
+ def format=(format)
222
+ validator = EnumAttributeValidator.new('String', ["text", "html", "unknown_default_open_api"])
223
+ unless validator.valid?(format)
224
+ fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}."
225
+ end
226
+ @format = format
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] is_truncated Value to be assigned
231
+ def is_truncated=(is_truncated)
232
+ if is_truncated.nil?
233
+ fail ArgumentError, 'is_truncated cannot be nil'
234
+ end
235
+
236
+ @is_truncated = is_truncated
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] quotes_stripped Value to be assigned
241
+ def quotes_stripped=(quotes_stripped)
242
+ if quotes_stripped.nil?
243
+ fail ArgumentError, 'quotes_stripped cannot be nil'
244
+ end
245
+
246
+ @quotes_stripped = quotes_stripped
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] signature_stripped Value to be assigned
251
+ def signature_stripped=(signature_stripped)
252
+ if signature_stripped.nil?
253
+ fail ArgumentError, 'signature_stripped cannot be nil'
254
+ end
255
+
256
+ @signature_stripped = signature_stripped
257
+ end
258
+
259
+ # Checks equality by comparing each attribute.
260
+ # @param [Object] Object to be compared
261
+ def ==(o)
262
+ return true if self.equal?(o)
263
+ self.class == o.class &&
264
+ extracted_links == o.extracted_links &&
265
+ format == o.format &&
266
+ html == o.html &&
267
+ is_truncated == o.is_truncated &&
268
+ quotes_stripped == o.quotes_stripped &&
269
+ signature_stripped == o.signature_stripped &&
270
+ text == o.text &&
271
+ truncated_at_chars == o.truncated_at_chars
272
+ end
273
+
274
+ # @see the `==` method
275
+ # @param [Object] Object to be compared
276
+ def eql?(o)
277
+ self == o
278
+ end
279
+
280
+ # Calculates hash code according to all attributes.
281
+ # @return [Integer] Hash code
282
+ def hash
283
+ [extracted_links, format, html, is_truncated, quotes_stripped, signature_stripped, text, truncated_at_chars].hash
284
+ end
285
+
286
+ # Builds the object from hash
287
+ # @param [Hash] attributes Model attributes in the form of hash
288
+ # @return [Object] Returns the model itself
289
+ def self.build_from_hash(attributes)
290
+ return nil unless attributes.is_a?(Hash)
291
+ attributes = attributes.transform_keys(&:to_sym)
292
+ transformed_hash = {}
293
+ openapi_types.each_pair do |key, type|
294
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
295
+ transformed_hash["#{key}"] = nil
296
+ elsif type =~ /\AArray<(.*)>/i
297
+ # check to ensure the input is an array given that the attribute
298
+ # is documented as an array but the input is not
299
+ if attributes[attribute_map[key]].is_a?(Array)
300
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
301
+ end
302
+ elsif !attributes[attribute_map[key]].nil?
303
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
304
+ end
305
+ end
306
+ new(transformed_hash)
307
+ end
308
+
309
+ # Returns the object in the form of hash
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_hash
312
+ hash = {}
313
+ self.class.attribute_map.each_pair do |attr, param|
314
+ value = self.send(attr)
315
+ if value.nil?
316
+ is_nullable = self.class.openapi_nullable.include?(attr)
317
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
318
+ end
319
+
320
+ hash[param] = _to_hash(value)
321
+ end
322
+ hash
323
+ end
324
+
325
+ end
326
+
327
+ end