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,286 @@
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 MailboxRawBodyResponseAllOfData < ApiModelBase
18
+ attr_accessor :body
19
+
20
+ # Message ID
21
+ attr_accessor :id
22
+
23
+ attr_accessor :part
24
+
25
+ attr_accessor :states
26
+
27
+ attr_accessor :thread_id
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'body' => :'body',
55
+ :'id' => :'id',
56
+ :'part' => :'part',
57
+ :'states' => :'states',
58
+ :'thread_id' => :'thread_id'
59
+ }
60
+ end
61
+
62
+ # Returns attribute mapping this model knows about
63
+ def self.acceptable_attribute_map
64
+ attribute_map
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ acceptable_attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'body' => :'MailboxRawBodyBody',
76
+ :'id' => :'String',
77
+ :'part' => :'String',
78
+ :'states' => :'MailboxBatchGetResultStates',
79
+ :'thread_id' => :'String'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ :'thread_id'
87
+ ])
88
+ end
89
+
90
+ # List of class defined in allOf (OpenAPI v3)
91
+ def self.openapi_all_of
92
+ [
93
+ :'MailboxRawBody'
94
+ ]
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxRawBodyResponseAllOfData` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ acceptable_attribute_map = self.class.acceptable_attribute_map
106
+ attributes = attributes.each_with_object({}) { |(k, v), h|
107
+ if (!acceptable_attribute_map.key?(k.to_sym))
108
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxRawBodyResponseAllOfData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
109
+ end
110
+ h[k.to_sym] = v
111
+ }
112
+
113
+ if attributes.key?(:'body')
114
+ self.body = attributes[:'body']
115
+ else
116
+ self.body = nil
117
+ end
118
+
119
+ if attributes.key?(:'id')
120
+ self.id = attributes[:'id']
121
+ else
122
+ self.id = nil
123
+ end
124
+
125
+ if attributes.key?(:'part')
126
+ self.part = attributes[:'part']
127
+ else
128
+ self.part = nil
129
+ end
130
+
131
+ if attributes.key?(:'states')
132
+ self.states = attributes[:'states']
133
+ else
134
+ self.states = nil
135
+ end
136
+
137
+ if attributes.key?(:'thread_id')
138
+ self.thread_id = attributes[:'thread_id']
139
+ else
140
+ self.thread_id = nil
141
+ end
142
+ end
143
+
144
+ # Show invalid properties with the reasons. Usually used together with valid?
145
+ # @return Array for valid properties with the reasons
146
+ def list_invalid_properties
147
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
148
+ invalid_properties = Array.new
149
+ if @body.nil?
150
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
151
+ end
152
+
153
+ if @id.nil?
154
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
155
+ end
156
+
157
+ if @part.nil?
158
+ invalid_properties.push('invalid value for "part", part cannot be nil.')
159
+ end
160
+
161
+ if @states.nil?
162
+ invalid_properties.push('invalid value for "states", states cannot be nil.')
163
+ end
164
+
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ warn '[DEPRECATED] the `valid?` method is obsolete'
172
+ return false if @body.nil?
173
+ return false if @id.nil?
174
+ return false if @part.nil?
175
+ part_validator = EnumAttributeValidator.new('String', ["text", "html", "both", "unknown_default_open_api"])
176
+ return false unless part_validator.valid?(@part)
177
+ return false if @states.nil?
178
+ true
179
+ end
180
+
181
+ # Custom attribute writer method with validation
182
+ # @param [Object] body Value to be assigned
183
+ def body=(body)
184
+ if body.nil?
185
+ fail ArgumentError, 'body cannot be nil'
186
+ end
187
+
188
+ @body = body
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] id Value to be assigned
193
+ def id=(id)
194
+ if id.nil?
195
+ fail ArgumentError, 'id cannot be nil'
196
+ end
197
+
198
+ @id = id
199
+ end
200
+
201
+ # Custom attribute writer method checking allowed values (enum).
202
+ # @param [Object] part Object to be assigned
203
+ def part=(part)
204
+ validator = EnumAttributeValidator.new('String', ["text", "html", "both", "unknown_default_open_api"])
205
+ unless validator.valid?(part)
206
+ fail ArgumentError, "invalid value for \"part\", must be one of #{validator.allowable_values}."
207
+ end
208
+ @part = part
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] states Value to be assigned
213
+ def states=(states)
214
+ if states.nil?
215
+ fail ArgumentError, 'states cannot be nil'
216
+ end
217
+
218
+ @states = states
219
+ end
220
+
221
+ # Checks equality by comparing each attribute.
222
+ # @param [Object] Object to be compared
223
+ def ==(o)
224
+ return true if self.equal?(o)
225
+ self.class == o.class &&
226
+ body == o.body &&
227
+ id == o.id &&
228
+ part == o.part &&
229
+ states == o.states &&
230
+ thread_id == o.thread_id
231
+ end
232
+
233
+ # @see the `==` method
234
+ # @param [Object] Object to be compared
235
+ def eql?(o)
236
+ self == o
237
+ end
238
+
239
+ # Calculates hash code according to all attributes.
240
+ # @return [Integer] Hash code
241
+ def hash
242
+ [body, id, part, states, thread_id].hash
243
+ end
244
+
245
+ # Builds the object from hash
246
+ # @param [Hash] attributes Model attributes in the form of hash
247
+ # @return [Object] Returns the model itself
248
+ def self.build_from_hash(attributes)
249
+ return nil unless attributes.is_a?(Hash)
250
+ attributes = attributes.transform_keys(&:to_sym)
251
+ transformed_hash = {}
252
+ openapi_types.each_pair do |key, type|
253
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
254
+ transformed_hash["#{key}"] = nil
255
+ elsif type =~ /\AArray<(.*)>/i
256
+ # check to ensure the input is an array given that the attribute
257
+ # is documented as an array but the input is not
258
+ if attributes[attribute_map[key]].is_a?(Array)
259
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
260
+ end
261
+ elsif !attributes[attribute_map[key]].nil?
262
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
263
+ end
264
+ end
265
+ new(transformed_hash)
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ end
285
+
286
+ end
@@ -0,0 +1,380 @@
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 MailboxRealtimeEvent < ApiModelBase
18
+ attr_accessor :event_type
19
+
20
+ attr_accessor :is_spam
21
+
22
+ attr_accessor :mailbox_id
23
+
24
+ attr_accessor :message
25
+
26
+ attr_accessor :message_id
27
+
28
+ attr_accessor :message_id_kind
29
+
30
+ attr_accessor :occurred_at
31
+
32
+ attr_accessor :recipients
33
+
34
+ attr_accessor :sender
35
+
36
+ attr_accessor :team_public_id
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'event_type' => :'event_type',
64
+ :'is_spam' => :'is_spam',
65
+ :'mailbox_id' => :'mailbox_id',
66
+ :'message' => :'message',
67
+ :'message_id' => :'message_id',
68
+ :'message_id_kind' => :'message_id_kind',
69
+ :'occurred_at' => :'occurred_at',
70
+ :'recipients' => :'recipients',
71
+ :'sender' => :'sender',
72
+ :'team_public_id' => :'team_public_id'
73
+ }
74
+ end
75
+
76
+ # Returns attribute mapping this model knows about
77
+ def self.acceptable_attribute_map
78
+ attribute_map
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ acceptable_attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'event_type' => :'String',
90
+ :'is_spam' => :'Boolean',
91
+ :'mailbox_id' => :'String',
92
+ :'message' => :'MailboxRealtimeMessage',
93
+ :'message_id' => :'String',
94
+ :'message_id_kind' => :'String',
95
+ :'occurred_at' => :'String',
96
+ :'recipients' => :'Array<String>',
97
+ :'sender' => :'String',
98
+ :'team_public_id' => :'String'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ :'is_spam',
106
+ :'message_id',
107
+ :'message_id_kind',
108
+ :'sender',
109
+ ])
110
+ end
111
+
112
+ # Initializes the object
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ def initialize(attributes = {})
115
+ if (!attributes.is_a?(Hash))
116
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxRealtimeEvent` initialize method"
117
+ end
118
+
119
+ # check to see if the attribute exists and convert string to symbol for hash key
120
+ acceptable_attribute_map = self.class.acceptable_attribute_map
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!acceptable_attribute_map.key?(k.to_sym))
123
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxRealtimeEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:'event_type')
129
+ self.event_type = attributes[:'event_type']
130
+ else
131
+ self.event_type = nil
132
+ end
133
+
134
+ if attributes.key?(:'is_spam')
135
+ self.is_spam = attributes[:'is_spam']
136
+ else
137
+ self.is_spam = nil
138
+ end
139
+
140
+ if attributes.key?(:'mailbox_id')
141
+ self.mailbox_id = attributes[:'mailbox_id']
142
+ else
143
+ self.mailbox_id = nil
144
+ end
145
+
146
+ if attributes.key?(:'message')
147
+ self.message = attributes[:'message']
148
+ else
149
+ self.message = nil
150
+ end
151
+
152
+ if attributes.key?(:'message_id')
153
+ self.message_id = attributes[:'message_id']
154
+ else
155
+ self.message_id = nil
156
+ end
157
+
158
+ if attributes.key?(:'message_id_kind')
159
+ self.message_id_kind = attributes[:'message_id_kind']
160
+ else
161
+ self.message_id_kind = nil
162
+ end
163
+
164
+ if attributes.key?(:'occurred_at')
165
+ self.occurred_at = attributes[:'occurred_at']
166
+ else
167
+ self.occurred_at = nil
168
+ end
169
+
170
+ if attributes.key?(:'recipients')
171
+ if (value = attributes[:'recipients']).is_a?(Array)
172
+ self.recipients = value
173
+ end
174
+ else
175
+ self.recipients = nil
176
+ end
177
+
178
+ if attributes.key?(:'sender')
179
+ self.sender = attributes[:'sender']
180
+ else
181
+ self.sender = nil
182
+ end
183
+
184
+ if attributes.key?(:'team_public_id')
185
+ self.team_public_id = attributes[:'team_public_id']
186
+ else
187
+ self.team_public_id = nil
188
+ end
189
+ end
190
+
191
+ # Show invalid properties with the reasons. Usually used together with valid?
192
+ # @return Array for valid properties with the reasons
193
+ def list_invalid_properties
194
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
195
+ invalid_properties = Array.new
196
+ if @event_type.nil?
197
+ invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
198
+ end
199
+
200
+ if @mailbox_id.nil?
201
+ invalid_properties.push('invalid value for "mailbox_id", mailbox_id cannot be nil.')
202
+ end
203
+
204
+ if @message.nil?
205
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
206
+ end
207
+
208
+ if @occurred_at.nil?
209
+ invalid_properties.push('invalid value for "occurred_at", occurred_at cannot be nil.')
210
+ end
211
+
212
+ if @recipients.nil?
213
+ invalid_properties.push('invalid value for "recipients", recipients cannot be nil.')
214
+ end
215
+
216
+ if @team_public_id.nil?
217
+ invalid_properties.push('invalid value for "team_public_id", team_public_id cannot be nil.')
218
+ end
219
+
220
+ invalid_properties
221
+ end
222
+
223
+ # Check to see if the all the properties in the model are valid
224
+ # @return true if the model is valid
225
+ def valid?
226
+ warn '[DEPRECATED] the `valid?` method is obsolete'
227
+ return false if @event_type.nil?
228
+ event_type_validator = EnumAttributeValidator.new('String', ["message.received", "message.received.spam", "sync_required", "unknown_default_open_api"])
229
+ return false unless event_type_validator.valid?(@event_type)
230
+ return false if @mailbox_id.nil?
231
+ return false if @message.nil?
232
+ message_id_kind_validator = EnumAttributeValidator.new('String', ["provider", "rfc5322", "unknown_default_open_api"])
233
+ return false unless message_id_kind_validator.valid?(@message_id_kind)
234
+ return false if @occurred_at.nil?
235
+ return false if @recipients.nil?
236
+ return false if @team_public_id.nil?
237
+ true
238
+ end
239
+
240
+ # Custom attribute writer method checking allowed values (enum).
241
+ # @param [Object] event_type Object to be assigned
242
+ def event_type=(event_type)
243
+ validator = EnumAttributeValidator.new('String', ["message.received", "message.received.spam", "sync_required", "unknown_default_open_api"])
244
+ unless validator.valid?(event_type)
245
+ fail ArgumentError, "invalid value for \"event_type\", must be one of #{validator.allowable_values}."
246
+ end
247
+ @event_type = event_type
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] mailbox_id Value to be assigned
252
+ def mailbox_id=(mailbox_id)
253
+ if mailbox_id.nil?
254
+ fail ArgumentError, 'mailbox_id cannot be nil'
255
+ end
256
+
257
+ @mailbox_id = mailbox_id
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] message Value to be assigned
262
+ def message=(message)
263
+ if message.nil?
264
+ fail ArgumentError, 'message cannot be nil'
265
+ end
266
+
267
+ @message = message
268
+ end
269
+
270
+ # Custom attribute writer method checking allowed values (enum).
271
+ # @param [Object] message_id_kind Object to be assigned
272
+ def message_id_kind=(message_id_kind)
273
+ validator = EnumAttributeValidator.new('String', ["provider", "rfc5322", "unknown_default_open_api"])
274
+ unless validator.valid?(message_id_kind)
275
+ fail ArgumentError, "invalid value for \"message_id_kind\", must be one of #{validator.allowable_values}."
276
+ end
277
+ @message_id_kind = message_id_kind
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] occurred_at Value to be assigned
282
+ def occurred_at=(occurred_at)
283
+ if occurred_at.nil?
284
+ fail ArgumentError, 'occurred_at cannot be nil'
285
+ end
286
+
287
+ @occurred_at = occurred_at
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] recipients Value to be assigned
292
+ def recipients=(recipients)
293
+ if recipients.nil?
294
+ fail ArgumentError, 'recipients cannot be nil'
295
+ end
296
+
297
+ @recipients = recipients
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] team_public_id Value to be assigned
302
+ def team_public_id=(team_public_id)
303
+ if team_public_id.nil?
304
+ fail ArgumentError, 'team_public_id cannot be nil'
305
+ end
306
+
307
+ @team_public_id = team_public_id
308
+ end
309
+
310
+ # Checks equality by comparing each attribute.
311
+ # @param [Object] Object to be compared
312
+ def ==(o)
313
+ return true if self.equal?(o)
314
+ self.class == o.class &&
315
+ event_type == o.event_type &&
316
+ is_spam == o.is_spam &&
317
+ mailbox_id == o.mailbox_id &&
318
+ message == o.message &&
319
+ message_id == o.message_id &&
320
+ message_id_kind == o.message_id_kind &&
321
+ occurred_at == o.occurred_at &&
322
+ recipients == o.recipients &&
323
+ sender == o.sender &&
324
+ team_public_id == o.team_public_id
325
+ end
326
+
327
+ # @see the `==` method
328
+ # @param [Object] Object to be compared
329
+ def eql?(o)
330
+ self == o
331
+ end
332
+
333
+ # Calculates hash code according to all attributes.
334
+ # @return [Integer] Hash code
335
+ def hash
336
+ [event_type, is_spam, mailbox_id, message, message_id, message_id_kind, occurred_at, recipients, sender, team_public_id].hash
337
+ end
338
+
339
+ # Builds the object from hash
340
+ # @param [Hash] attributes Model attributes in the form of hash
341
+ # @return [Object] Returns the model itself
342
+ def self.build_from_hash(attributes)
343
+ return nil unless attributes.is_a?(Hash)
344
+ attributes = attributes.transform_keys(&:to_sym)
345
+ transformed_hash = {}
346
+ openapi_types.each_pair do |key, type|
347
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
348
+ transformed_hash["#{key}"] = nil
349
+ elsif type =~ /\AArray<(.*)>/i
350
+ # check to ensure the input is an array given that the attribute
351
+ # is documented as an array but the input is not
352
+ if attributes[attribute_map[key]].is_a?(Array)
353
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
354
+ end
355
+ elsif !attributes[attribute_map[key]].nil?
356
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
357
+ end
358
+ end
359
+ new(transformed_hash)
360
+ end
361
+
362
+ # Returns the object in the form of hash
363
+ # @return [Hash] Returns the object in the form of hash
364
+ def to_hash
365
+ hash = {}
366
+ self.class.attribute_map.each_pair do |attr, param|
367
+ value = self.send(attr)
368
+ if value.nil?
369
+ is_nullable = self.class.openapi_nullable.include?(attr)
370
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
371
+ end
372
+
373
+ hash[param] = _to_hash(value)
374
+ end
375
+ hash
376
+ end
377
+
378
+ end
379
+
380
+ end