sendmux-management 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 (131) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +3 -0
  4. data/lib/sendmux/management/client.rb +66 -0
  5. data/lib/sendmux/management/version.rb +7 -0
  6. data/lib/sendmux/management.rb +12 -0
  7. data/lib/sendmux_management_generated/api/billing_api.rb +221 -0
  8. data/lib/sendmux_management_generated/api/domain_filters_api.rb +161 -0
  9. data/lib/sendmux_management_generated/api/domains_api.rb +419 -0
  10. data/lib/sendmux_management_generated/api/emails_api.rb +258 -0
  11. data/lib/sendmux_management_generated/api/inboxes_api.rb +175 -0
  12. data/lib/sendmux_management_generated/api/mailbox_filters_api.rb +161 -0
  13. data/lib/sendmux_management_generated/api/mailboxes_api.rb +659 -0
  14. data/lib/sendmux_management_generated/api/sending_accounts_api.rb +946 -0
  15. data/lib/sendmux_management_generated/api/webhooks_api.rb +666 -0
  16. data/lib/sendmux_management_generated/api_client.rb +441 -0
  17. data/lib/sendmux_management_generated/api_error.rb +58 -0
  18. data/lib/sendmux_management_generated/api_model_base.rb +88 -0
  19. data/lib/sendmux_management_generated/configuration.rb +393 -0
  20. data/lib/sendmux_management_generated/models/api_error_detail.rb +219 -0
  21. data/lib/sendmux_management_generated/models/api_error_error.rb +275 -0
  22. data/lib/sendmux_management_generated/models/api_error_meta.rb +164 -0
  23. data/lib/sendmux_management_generated/models/api_error_response.rb +216 -0
  24. data/lib/sendmux_management_generated/models/balance.rb +293 -0
  25. data/lib/sendmux_management_generated/models/balance_auto_topup.rb +226 -0
  26. data/lib/sendmux_management_generated/models/balance_response.rb +223 -0
  27. data/lib/sendmux_management_generated/models/cursor_pagination.rb +173 -0
  28. data/lib/sendmux_management_generated/models/delivery_log_item.rb +393 -0
  29. data/lib/sendmux_management_generated/models/delivery_log_item_cursor_list_response.rb +251 -0
  30. data/lib/sendmux_management_generated/models/delivery_log_item_response.rb +223 -0
  31. data/lib/sendmux_management_generated/models/domain_deleted_response.rb +223 -0
  32. data/lib/sendmux_management_generated/models/domain_deleted_response_all_of_data.rb +190 -0
  33. data/lib/sendmux_management_generated/models/domain_item_cursor_list_response.rb +251 -0
  34. data/lib/sendmux_management_generated/models/domain_item_response.rb +223 -0
  35. data/lib/sendmux_management_generated/models/domain_verify_response.rb +223 -0
  36. data/lib/sendmux_management_generated/models/email_metrics.rb +218 -0
  37. data/lib/sendmux_management_generated/models/email_metrics_comparison.rb +294 -0
  38. data/lib/sendmux_management_generated/models/email_metrics_comparison_change_pct.rb +268 -0
  39. data/lib/sendmux_management_generated/models/email_metrics_response.rb +223 -0
  40. data/lib/sendmux_management_generated/models/email_metrics_summary.rb +268 -0
  41. data/lib/sendmux_management_generated/models/email_metrics_timeseries_inner.rb +294 -0
  42. data/lib/sendmux_management_generated/models/filter_rule.rb +242 -0
  43. data/lib/sendmux_management_generated/models/filter_state.rb +218 -0
  44. data/lib/sendmux_management_generated/models/filter_state_response.rb +223 -0
  45. data/lib/sendmux_management_generated/models/incoming_log_item.rb +465 -0
  46. data/lib/sendmux_management_generated/models/incoming_log_item_cursor_list_response.rb +251 -0
  47. data/lib/sendmux_management_generated/models/incoming_log_item_response.rb +223 -0
  48. data/lib/sendmux_management_generated/models/mailbox.rb +284 -0
  49. data/lib/sendmux_management_generated/models/mailbox_app_password_result.rb +164 -0
  50. data/lib/sendmux_management_generated/models/mailbox_app_password_result_credential.rb +359 -0
  51. data/lib/sendmux_management_generated/models/mailbox_app_password_result_response.rb +223 -0
  52. data/lib/sendmux_management_generated/models/mailbox_create_result.rb +189 -0
  53. data/lib/sendmux_management_generated/models/mailbox_create_result_response.rb +223 -0
  54. data/lib/sendmux_management_generated/models/mailbox_credential.rb +353 -0
  55. data/lib/sendmux_management_generated/models/mailbox_deleted_response.rb +223 -0
  56. data/lib/sendmux_management_generated/models/mailbox_domain.rb +358 -0
  57. data/lib/sendmux_management_generated/models/mailbox_domain_dns_records.rb +276 -0
  58. data/lib/sendmux_management_generated/models/mailbox_domain_mx_record.rb +190 -0
  59. data/lib/sendmux_management_generated/models/mailbox_domain_name_value_record.rb +191 -0
  60. data/lib/sendmux_management_generated/models/mailbox_domain_verify_checks.rb +246 -0
  61. data/lib/sendmux_management_generated/models/mailbox_domain_verify_result.rb +242 -0
  62. data/lib/sendmux_management_generated/models/mailbox_item_cursor_list_response.rb +251 -0
  63. data/lib/sendmux_management_generated/models/mailbox_item_response.rb +223 -0
  64. data/lib/sendmux_management_generated/models/mailbox_key_deleted_response.rb +223 -0
  65. data/lib/sendmux_management_generated/models/mailbox_send_scope.rb +213 -0
  66. data/lib/sendmux_management_generated/models/management_create_domain_request.rb +165 -0
  67. data/lib/sendmux_management_generated/models/management_create_mailbox_key_request.rb +182 -0
  68. data/lib/sendmux_management_generated/models/management_create_mailbox_request.rb +257 -0
  69. data/lib/sendmux_management_generated/models/management_create_mailbox_request_send_scope.rb +210 -0
  70. data/lib/sendmux_management_generated/models/management_test_webhook200_response.rb +223 -0
  71. data/lib/sendmux_management_generated/models/provider_allowed_actions.rb +268 -0
  72. data/lib/sendmux_management_generated/models/provider_create_body.rb +579 -0
  73. data/lib/sendmux_management_generated/models/provider_create_body_quotas.rb +174 -0
  74. data/lib/sendmux_management_generated/models/provider_create_body_quotas_per_day.rb +104 -0
  75. data/lib/sendmux_management_generated/models/provider_create_body_quotas_per_day_any_of.rb +215 -0
  76. data/lib/sendmux_management_generated/models/provider_deleted.rb +190 -0
  77. data/lib/sendmux_management_generated/models/provider_deleted_response.rb +223 -0
  78. data/lib/sendmux_management_generated/models/provider_item.rb +695 -0
  79. data/lib/sendmux_management_generated/models/provider_item_cursor_list_response.rb +251 -0
  80. data/lib/sendmux_management_generated/models/provider_item_response.rb +223 -0
  81. data/lib/sendmux_management_generated/models/provider_limits.rb +190 -0
  82. data/lib/sendmux_management_generated/models/provider_limits_response.rb +223 -0
  83. data/lib/sendmux_management_generated/models/provider_quota_range.rb +208 -0
  84. data/lib/sendmux_management_generated/models/provider_quotas.rb +186 -0
  85. data/lib/sendmux_management_generated/models/provider_stats.rb +325 -0
  86. data/lib/sendmux_management_generated/models/provider_stats_response.rb +223 -0
  87. data/lib/sendmux_management_generated/models/provider_status_counts.rb +242 -0
  88. data/lib/sendmux_management_generated/models/provider_test_result.rb +251 -0
  89. data/lib/sendmux_management_generated/models/provider_test_result_response.rb +223 -0
  90. data/lib/sendmux_management_generated/models/provider_type_counts.rb +246 -0
  91. data/lib/sendmux_management_generated/models/provider_update_body.rb +537 -0
  92. data/lib/sendmux_management_generated/models/provider_usage.rb +216 -0
  93. data/lib/sendmux_management_generated/models/provider_usage_item.rb +374 -0
  94. data/lib/sendmux_management_generated/models/provider_usage_response.rb +223 -0
  95. data/lib/sendmux_management_generated/models/resource_limit_snapshot.rb +420 -0
  96. data/lib/sendmux_management_generated/models/response_meta.rb +164 -0
  97. data/lib/sendmux_management_generated/models/sending_account_limit_request.rb +190 -0
  98. data/lib/sendmux_management_generated/models/sending_account_limit_request_response.rb +223 -0
  99. data/lib/sendmux_management_generated/models/set_filter_state_body.rb +226 -0
  100. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit.rb +315 -0
  101. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit_request.rb +361 -0
  102. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit_request_create.rb +190 -0
  103. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit_request_create_request.rb +368 -0
  104. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit_request_create_response.rb +223 -0
  105. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit_request_page.rb +176 -0
  106. data/lib/sendmux_management_generated/models/shared_amazon_ses_limit_request_page_response.rb +223 -0
  107. data/lib/sendmux_management_generated/models/spend_summary.rb +292 -0
  108. data/lib/sendmux_management_generated/models/spend_summary_response.rb +223 -0
  109. data/lib/sendmux_management_generated/models/success_envelope.rb +192 -0
  110. data/lib/sendmux_management_generated/models/transaction.rb +332 -0
  111. data/lib/sendmux_management_generated/models/transaction_cursor_list_response.rb +251 -0
  112. data/lib/sendmux_management_generated/models/update_mailbox_body.rb +210 -0
  113. data/lib/sendmux_management_generated/models/webhook_create_body.rb +269 -0
  114. data/lib/sendmux_management_generated/models/webhook_deleted_response.rb +223 -0
  115. data/lib/sendmux_management_generated/models/webhook_delivery_attempt.rb +562 -0
  116. data/lib/sendmux_management_generated/models/webhook_delivery_attempt_cursor_list_response.rb +251 -0
  117. data/lib/sendmux_management_generated/models/webhook_delivery_payload.rb +359 -0
  118. data/lib/sendmux_management_generated/models/webhook_delivery_payload_response.rb +223 -0
  119. data/lib/sendmux_management_generated/models/webhook_event_data.rb +395 -0
  120. data/lib/sendmux_management_generated/models/webhook_event_payload.rb +297 -0
  121. data/lib/sendmux_management_generated/models/webhook_filters.rb +168 -0
  122. data/lib/sendmux_management_generated/models/webhook_subscription.rb +380 -0
  123. data/lib/sendmux_management_generated/models/webhook_subscription_cursor_list_response.rb +251 -0
  124. data/lib/sendmux_management_generated/models/webhook_subscription_response.rb +223 -0
  125. data/lib/sendmux_management_generated/models/webhook_subscription_with_secret.rb +414 -0
  126. data/lib/sendmux_management_generated/models/webhook_subscription_with_secret_response.rb +223 -0
  127. data/lib/sendmux_management_generated/models/webhook_test_response.rb +165 -0
  128. data/lib/sendmux_management_generated/models/webhook_update_body.rb +233 -0
  129. data/lib/sendmux_management_generated/version.rb +15 -0
  130. data/lib/sendmux_management_generated.rb +158 -0
  131. metadata +247 -0
@@ -0,0 +1,358 @@
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::Management::Generated
17
+ class MailboxDomain < ApiModelBase
18
+ # ISO 8601 creation timestamp
19
+ attr_accessor :created_at
20
+
21
+ attr_accessor :dns_records
22
+
23
+ # Fully qualified domain name
24
+ attr_accessor :domain
25
+
26
+ # Public ID
27
+ attr_accessor :id
28
+
29
+ # Active mailboxes currently using this domain
30
+ attr_accessor :mailbox_count
31
+
32
+ # SES DKIM status (pending/success/failed/temporary_failure/not_started)
33
+ attr_accessor :ses_dkim_status
34
+
35
+ # Current verification state
36
+ attr_accessor :verification_status
37
+
38
+ # ISO 8601 timestamp of last successful verification
39
+ attr_accessor :verified_at
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'created_at' => :'created_at',
67
+ :'dns_records' => :'dns_records',
68
+ :'domain' => :'domain',
69
+ :'id' => :'id',
70
+ :'mailbox_count' => :'mailbox_count',
71
+ :'ses_dkim_status' => :'ses_dkim_status',
72
+ :'verification_status' => :'verification_status',
73
+ :'verified_at' => :'verified_at'
74
+ }
75
+ end
76
+
77
+ # Returns attribute mapping this model knows about
78
+ def self.acceptable_attribute_map
79
+ attribute_map
80
+ end
81
+
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ acceptable_attribute_map.values
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'created_at' => :'String',
91
+ :'dns_records' => :'MailboxDomainDnsRecords',
92
+ :'domain' => :'String',
93
+ :'id' => :'String',
94
+ :'mailbox_count' => :'Integer',
95
+ :'ses_dkim_status' => :'String',
96
+ :'verification_status' => :'String',
97
+ :'verified_at' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ :'ses_dkim_status',
105
+ :'verified_at'
106
+ ])
107
+ end
108
+
109
+ # Initializes the object
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ def initialize(attributes = {})
112
+ if (!attributes.is_a?(Hash))
113
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::MailboxDomain` initialize method"
114
+ end
115
+
116
+ # check to see if the attribute exists and convert string to symbol for hash key
117
+ acceptable_attribute_map = self.class.acceptable_attribute_map
118
+ attributes = attributes.each_with_object({}) { |(k, v), h|
119
+ if (!acceptable_attribute_map.key?(k.to_sym))
120
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Management::Generated::MailboxDomain`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
121
+ end
122
+ h[k.to_sym] = v
123
+ }
124
+
125
+ if attributes.key?(:'created_at')
126
+ self.created_at = attributes[:'created_at']
127
+ else
128
+ self.created_at = nil
129
+ end
130
+
131
+ if attributes.key?(:'dns_records')
132
+ self.dns_records = attributes[:'dns_records']
133
+ else
134
+ self.dns_records = nil
135
+ end
136
+
137
+ if attributes.key?(:'domain')
138
+ self.domain = attributes[:'domain']
139
+ else
140
+ self.domain = nil
141
+ end
142
+
143
+ if attributes.key?(:'id')
144
+ self.id = attributes[:'id']
145
+ else
146
+ self.id = nil
147
+ end
148
+
149
+ if attributes.key?(:'mailbox_count')
150
+ self.mailbox_count = attributes[:'mailbox_count']
151
+ else
152
+ self.mailbox_count = nil
153
+ end
154
+
155
+ if attributes.key?(:'ses_dkim_status')
156
+ self.ses_dkim_status = attributes[:'ses_dkim_status']
157
+ else
158
+ self.ses_dkim_status = nil
159
+ end
160
+
161
+ if attributes.key?(:'verification_status')
162
+ self.verification_status = attributes[:'verification_status']
163
+ else
164
+ self.verification_status = nil
165
+ end
166
+
167
+ if attributes.key?(:'verified_at')
168
+ self.verified_at = attributes[:'verified_at']
169
+ else
170
+ self.verified_at = nil
171
+ end
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properties with the reasons
176
+ def list_invalid_properties
177
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
178
+ invalid_properties = Array.new
179
+ if @created_at.nil?
180
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
181
+ end
182
+
183
+ if @dns_records.nil?
184
+ invalid_properties.push('invalid value for "dns_records", dns_records cannot be nil.')
185
+ end
186
+
187
+ if @domain.nil?
188
+ invalid_properties.push('invalid value for "domain", domain cannot be nil.')
189
+ end
190
+
191
+ if @id.nil?
192
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
193
+ end
194
+
195
+ if @mailbox_count.nil?
196
+ invalid_properties.push('invalid value for "mailbox_count", mailbox_count cannot be nil.')
197
+ end
198
+
199
+ if @mailbox_count < 0
200
+ invalid_properties.push('invalid value for "mailbox_count", must be greater than or equal to 0.')
201
+ end
202
+
203
+ if @verification_status.nil?
204
+ invalid_properties.push('invalid value for "verification_status", verification_status cannot be nil.')
205
+ end
206
+
207
+ invalid_properties
208
+ end
209
+
210
+ # Check to see if the all the properties in the model are valid
211
+ # @return true if the model is valid
212
+ def valid?
213
+ warn '[DEPRECATED] the `valid?` method is obsolete'
214
+ return false if @created_at.nil?
215
+ return false if @dns_records.nil?
216
+ return false if @domain.nil?
217
+ return false if @id.nil?
218
+ return false if @mailbox_count.nil?
219
+ return false if @mailbox_count < 0
220
+ return false if @verification_status.nil?
221
+ verification_status_validator = EnumAttributeValidator.new('String', ["pending", "verified", "failed", "unknown_default_open_api"])
222
+ return false unless verification_status_validator.valid?(@verification_status)
223
+ true
224
+ end
225
+
226
+ # Custom attribute writer method with validation
227
+ # @param [Object] created_at Value to be assigned
228
+ def created_at=(created_at)
229
+ if created_at.nil?
230
+ fail ArgumentError, 'created_at cannot be nil'
231
+ end
232
+
233
+ @created_at = created_at
234
+ end
235
+
236
+ # Custom attribute writer method with validation
237
+ # @param [Object] dns_records Value to be assigned
238
+ def dns_records=(dns_records)
239
+ if dns_records.nil?
240
+ fail ArgumentError, 'dns_records cannot be nil'
241
+ end
242
+
243
+ @dns_records = dns_records
244
+ end
245
+
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] domain Value to be assigned
248
+ def domain=(domain)
249
+ if domain.nil?
250
+ fail ArgumentError, 'domain cannot be nil'
251
+ end
252
+
253
+ @domain = domain
254
+ end
255
+
256
+ # Custom attribute writer method with validation
257
+ # @param [Object] id Value to be assigned
258
+ def id=(id)
259
+ if id.nil?
260
+ fail ArgumentError, 'id cannot be nil'
261
+ end
262
+
263
+ @id = id
264
+ end
265
+
266
+ # Custom attribute writer method with validation
267
+ # @param [Object] mailbox_count Value to be assigned
268
+ def mailbox_count=(mailbox_count)
269
+ if mailbox_count.nil?
270
+ fail ArgumentError, 'mailbox_count cannot be nil'
271
+ end
272
+
273
+ if mailbox_count < 0
274
+ fail ArgumentError, 'invalid value for "mailbox_count", must be greater than or equal to 0.'
275
+ end
276
+
277
+ @mailbox_count = mailbox_count
278
+ end
279
+
280
+ # Custom attribute writer method checking allowed values (enum).
281
+ # @param [Object] verification_status Object to be assigned
282
+ def verification_status=(verification_status)
283
+ validator = EnumAttributeValidator.new('String', ["pending", "verified", "failed", "unknown_default_open_api"])
284
+ unless validator.valid?(verification_status)
285
+ fail ArgumentError, "invalid value for \"verification_status\", must be one of #{validator.allowable_values}."
286
+ end
287
+ @verification_status = verification_status
288
+ end
289
+
290
+ # Checks equality by comparing each attribute.
291
+ # @param [Object] Object to be compared
292
+ def ==(o)
293
+ return true if self.equal?(o)
294
+ self.class == o.class &&
295
+ created_at == o.created_at &&
296
+ dns_records == o.dns_records &&
297
+ domain == o.domain &&
298
+ id == o.id &&
299
+ mailbox_count == o.mailbox_count &&
300
+ ses_dkim_status == o.ses_dkim_status &&
301
+ verification_status == o.verification_status &&
302
+ verified_at == o.verified_at
303
+ end
304
+
305
+ # @see the `==` method
306
+ # @param [Object] Object to be compared
307
+ def eql?(o)
308
+ self == o
309
+ end
310
+
311
+ # Calculates hash code according to all attributes.
312
+ # @return [Integer] Hash code
313
+ def hash
314
+ [created_at, dns_records, domain, id, mailbox_count, ses_dkim_status, verification_status, verified_at].hash
315
+ end
316
+
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def self.build_from_hash(attributes)
321
+ return nil unless attributes.is_a?(Hash)
322
+ attributes = attributes.transform_keys(&:to_sym)
323
+ transformed_hash = {}
324
+ openapi_types.each_pair do |key, type|
325
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
326
+ transformed_hash["#{key}"] = nil
327
+ elsif type =~ /\AArray<(.*)>/i
328
+ # check to ensure the input is an array given that the attribute
329
+ # is documented as an array but the input is not
330
+ if attributes[attribute_map[key]].is_a?(Array)
331
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
332
+ end
333
+ elsif !attributes[attribute_map[key]].nil?
334
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
335
+ end
336
+ end
337
+ new(transformed_hash)
338
+ end
339
+
340
+ # Returns the object in the form of hash
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_hash
343
+ hash = {}
344
+ self.class.attribute_map.each_pair do |attr, param|
345
+ value = self.send(attr)
346
+ if value.nil?
347
+ is_nullable = self.class.openapi_nullable.include?(attr)
348
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
349
+ end
350
+
351
+ hash[param] = _to_hash(value)
352
+ end
353
+ hash
354
+ end
355
+
356
+ end
357
+
358
+ end
@@ -0,0 +1,276 @@
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::Management::Generated
17
+ class MailboxDomainDnsRecords < ApiModelBase
18
+ # Three SES DKIM CNAME records
19
+ attr_accessor :dkim
20
+
21
+ # DMARC enforcement record (quarantine, no reporting)
22
+ attr_accessor :dmarc
23
+
24
+ # MX records the customer must place. All point at Sendmux's inbound mail servers.
25
+ attr_accessor :mx
26
+
27
+ attr_accessor :spf
28
+
29
+ # Ownership-proof TXT record (Sendmux-specific)
30
+ attr_accessor :verification
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'dkim' => :'dkim',
36
+ :'dmarc' => :'dmarc',
37
+ :'mx' => :'mx',
38
+ :'spf' => :'spf',
39
+ :'verification' => :'verification'
40
+ }
41
+ end
42
+
43
+ # Returns attribute mapping this model knows about
44
+ def self.acceptable_attribute_map
45
+ attribute_map
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ acceptable_attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'dkim' => :'Array<MailboxDomainNameValueRecord>',
57
+ :'dmarc' => :'MailboxDomainNameValueRecord',
58
+ :'mx' => :'Array<MailboxDomainMxRecord>',
59
+ :'spf' => :'MailboxDomainNameValueRecord',
60
+ :'verification' => :'MailboxDomainNameValueRecord'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::MailboxDomainDnsRecords` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!acceptable_attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Management::Generated::MailboxDomainDnsRecords`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'dkim')
87
+ if (value = attributes[:'dkim']).is_a?(Array)
88
+ self.dkim = value
89
+ end
90
+ else
91
+ self.dkim = nil
92
+ end
93
+
94
+ if attributes.key?(:'dmarc')
95
+ self.dmarc = attributes[:'dmarc']
96
+ else
97
+ self.dmarc = nil
98
+ end
99
+
100
+ if attributes.key?(:'mx')
101
+ if (value = attributes[:'mx']).is_a?(Array)
102
+ self.mx = value
103
+ end
104
+ else
105
+ self.mx = nil
106
+ end
107
+
108
+ if attributes.key?(:'spf')
109
+ self.spf = attributes[:'spf']
110
+ else
111
+ self.spf = nil
112
+ end
113
+
114
+ if attributes.key?(:'verification')
115
+ self.verification = attributes[:'verification']
116
+ else
117
+ self.verification = nil
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @dkim.nil?
127
+ invalid_properties.push('invalid value for "dkim", dkim cannot be nil.')
128
+ end
129
+
130
+ if @dmarc.nil?
131
+ invalid_properties.push('invalid value for "dmarc", dmarc cannot be nil.')
132
+ end
133
+
134
+ if @mx.nil?
135
+ invalid_properties.push('invalid value for "mx", mx cannot be nil.')
136
+ end
137
+
138
+ if @spf.nil?
139
+ invalid_properties.push('invalid value for "spf", spf cannot be nil.')
140
+ end
141
+
142
+ if @verification.nil?
143
+ invalid_properties.push('invalid value for "verification", verification cannot be nil.')
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ warn '[DEPRECATED] the `valid?` method is obsolete'
153
+ return false if @dkim.nil?
154
+ return false if @dmarc.nil?
155
+ return false if @mx.nil?
156
+ return false if @spf.nil?
157
+ return false if @verification.nil?
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] dkim Value to be assigned
163
+ def dkim=(dkim)
164
+ if dkim.nil?
165
+ fail ArgumentError, 'dkim cannot be nil'
166
+ end
167
+
168
+ @dkim = dkim
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] dmarc Value to be assigned
173
+ def dmarc=(dmarc)
174
+ if dmarc.nil?
175
+ fail ArgumentError, 'dmarc cannot be nil'
176
+ end
177
+
178
+ @dmarc = dmarc
179
+ end
180
+
181
+ # Custom attribute writer method with validation
182
+ # @param [Object] mx Value to be assigned
183
+ def mx=(mx)
184
+ if mx.nil?
185
+ fail ArgumentError, 'mx cannot be nil'
186
+ end
187
+
188
+ @mx = mx
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] spf Value to be assigned
193
+ def spf=(spf)
194
+ if spf.nil?
195
+ fail ArgumentError, 'spf cannot be nil'
196
+ end
197
+
198
+ @spf = spf
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] verification Value to be assigned
203
+ def verification=(verification)
204
+ if verification.nil?
205
+ fail ArgumentError, 'verification cannot be nil'
206
+ end
207
+
208
+ @verification = verification
209
+ end
210
+
211
+ # Checks equality by comparing each attribute.
212
+ # @param [Object] Object to be compared
213
+ def ==(o)
214
+ return true if self.equal?(o)
215
+ self.class == o.class &&
216
+ dkim == o.dkim &&
217
+ dmarc == o.dmarc &&
218
+ mx == o.mx &&
219
+ spf == o.spf &&
220
+ verification == o.verification
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Integer] Hash code
231
+ def hash
232
+ [dkim, dmarc, mx, spf, verification].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def self.build_from_hash(attributes)
239
+ return nil unless attributes.is_a?(Hash)
240
+ attributes = attributes.transform_keys(&:to_sym)
241
+ transformed_hash = {}
242
+ openapi_types.each_pair do |key, type|
243
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = nil
245
+ elsif type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the attribute
247
+ # is documented as an array but the input is not
248
+ if attributes[attribute_map[key]].is_a?(Array)
249
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
250
+ end
251
+ elsif !attributes[attribute_map[key]].nil?
252
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
253
+ end
254
+ end
255
+ new(transformed_hash)
256
+ end
257
+
258
+ # Returns the object in the form of hash
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_hash
261
+ hash = {}
262
+ self.class.attribute_map.each_pair do |attr, param|
263
+ value = self.send(attr)
264
+ if value.nil?
265
+ is_nullable = self.class.openapi_nullable.include?(attr)
266
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
267
+ end
268
+
269
+ hash[param] = _to_hash(value)
270
+ end
271
+ hash
272
+ end
273
+
274
+ end
275
+
276
+ end