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,293 @@
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 Balance < ApiModelBase
18
+ attr_accessor :auto_topup
19
+
20
+ # Current balance (purchased - consumed)
21
+ attr_accessor :balance
22
+
23
+ attr_accessor :balance_consumed
24
+
25
+ attr_accessor :balance_purchased
26
+
27
+ attr_accessor :currency
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
+ :'auto_topup' => :'auto_topup',
55
+ :'balance' => :'balance',
56
+ :'balance_consumed' => :'balance_consumed',
57
+ :'balance_purchased' => :'balance_purchased',
58
+ :'currency' => :'currency'
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
+ :'auto_topup' => :'BalanceAutoTopup',
76
+ :'balance' => :'String',
77
+ :'balance_consumed' => :'String',
78
+ :'balance_purchased' => :'String',
79
+ :'currency' => :'String'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::Balance` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ acceptable_attribute_map = self.class.acceptable_attribute_map
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!acceptable_attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Management::Generated::Balance`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'auto_topup')
106
+ self.auto_topup = attributes[:'auto_topup']
107
+ else
108
+ self.auto_topup = nil
109
+ end
110
+
111
+ if attributes.key?(:'balance')
112
+ self.balance = attributes[:'balance']
113
+ else
114
+ self.balance = nil
115
+ end
116
+
117
+ if attributes.key?(:'balance_consumed')
118
+ self.balance_consumed = attributes[:'balance_consumed']
119
+ else
120
+ self.balance_consumed = nil
121
+ end
122
+
123
+ if attributes.key?(:'balance_purchased')
124
+ self.balance_purchased = attributes[:'balance_purchased']
125
+ else
126
+ self.balance_purchased = nil
127
+ end
128
+
129
+ if attributes.key?(:'currency')
130
+ self.currency = attributes[:'currency']
131
+ else
132
+ self.currency = nil
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
140
+ invalid_properties = Array.new
141
+ if @auto_topup.nil?
142
+ invalid_properties.push('invalid value for "auto_topup", auto_topup cannot be nil.')
143
+ end
144
+
145
+ if @balance.nil?
146
+ invalid_properties.push('invalid value for "balance", balance cannot be nil.')
147
+ end
148
+
149
+ if @balance_consumed.nil?
150
+ invalid_properties.push('invalid value for "balance_consumed", balance_consumed cannot be nil.')
151
+ end
152
+
153
+ if @balance_purchased.nil?
154
+ invalid_properties.push('invalid value for "balance_purchased", balance_purchased cannot be nil.')
155
+ end
156
+
157
+ if @currency.nil?
158
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
159
+ end
160
+
161
+ invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ warn '[DEPRECATED] the `valid?` method is obsolete'
168
+ return false if @auto_topup.nil?
169
+ return false if @balance.nil?
170
+ return false if @balance_consumed.nil?
171
+ return false if @balance_purchased.nil?
172
+ return false if @currency.nil?
173
+ currency_validator = EnumAttributeValidator.new('String', ["USD", "unknown_default_open_api"])
174
+ return false unless currency_validator.valid?(@currency)
175
+ true
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] auto_topup Value to be assigned
180
+ def auto_topup=(auto_topup)
181
+ if auto_topup.nil?
182
+ fail ArgumentError, 'auto_topup cannot be nil'
183
+ end
184
+
185
+ @auto_topup = auto_topup
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] balance Value to be assigned
190
+ def balance=(balance)
191
+ if balance.nil?
192
+ fail ArgumentError, 'balance cannot be nil'
193
+ end
194
+
195
+ @balance = balance
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] balance_consumed Value to be assigned
200
+ def balance_consumed=(balance_consumed)
201
+ if balance_consumed.nil?
202
+ fail ArgumentError, 'balance_consumed cannot be nil'
203
+ end
204
+
205
+ @balance_consumed = balance_consumed
206
+ end
207
+
208
+ # Custom attribute writer method with validation
209
+ # @param [Object] balance_purchased Value to be assigned
210
+ def balance_purchased=(balance_purchased)
211
+ if balance_purchased.nil?
212
+ fail ArgumentError, 'balance_purchased cannot be nil'
213
+ end
214
+
215
+ @balance_purchased = balance_purchased
216
+ end
217
+
218
+ # Custom attribute writer method checking allowed values (enum).
219
+ # @param [Object] currency Object to be assigned
220
+ def currency=(currency)
221
+ validator = EnumAttributeValidator.new('String', ["USD", "unknown_default_open_api"])
222
+ unless validator.valid?(currency)
223
+ fail ArgumentError, "invalid value for \"currency\", must be one of #{validator.allowable_values}."
224
+ end
225
+ @currency = currency
226
+ end
227
+
228
+ # Checks equality by comparing each attribute.
229
+ # @param [Object] Object to be compared
230
+ def ==(o)
231
+ return true if self.equal?(o)
232
+ self.class == o.class &&
233
+ auto_topup == o.auto_topup &&
234
+ balance == o.balance &&
235
+ balance_consumed == o.balance_consumed &&
236
+ balance_purchased == o.balance_purchased &&
237
+ currency == o.currency
238
+ end
239
+
240
+ # @see the `==` method
241
+ # @param [Object] Object to be compared
242
+ def eql?(o)
243
+ self == o
244
+ end
245
+
246
+ # Calculates hash code according to all attributes.
247
+ # @return [Integer] Hash code
248
+ def hash
249
+ [auto_topup, balance, balance_consumed, balance_purchased, currency].hash
250
+ end
251
+
252
+ # Builds the object from hash
253
+ # @param [Hash] attributes Model attributes in the form of hash
254
+ # @return [Object] Returns the model itself
255
+ def self.build_from_hash(attributes)
256
+ return nil unless attributes.is_a?(Hash)
257
+ attributes = attributes.transform_keys(&:to_sym)
258
+ transformed_hash = {}
259
+ openapi_types.each_pair do |key, type|
260
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
261
+ transformed_hash["#{key}"] = nil
262
+ elsif type =~ /\AArray<(.*)>/i
263
+ # check to ensure the input is an array given that the attribute
264
+ # is documented as an array but the input is not
265
+ if attributes[attribute_map[key]].is_a?(Array)
266
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
267
+ end
268
+ elsif !attributes[attribute_map[key]].nil?
269
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
270
+ end
271
+ end
272
+ new(transformed_hash)
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ end
292
+
293
+ end
@@ -0,0 +1,226 @@
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 BalanceAutoTopup < ApiModelBase
18
+ attr_accessor :amount
19
+
20
+ attr_accessor :enabled
21
+
22
+ attr_accessor :monthly_limit
23
+
24
+ attr_accessor :monthly_used
25
+
26
+ attr_accessor :threshold
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'amount' => :'amount',
32
+ :'enabled' => :'enabled',
33
+ :'monthly_limit' => :'monthly_limit',
34
+ :'monthly_used' => :'monthly_used',
35
+ :'threshold' => :'threshold'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'amount' => :'String',
53
+ :'enabled' => :'Boolean',
54
+ :'monthly_limit' => :'String',
55
+ :'monthly_used' => :'String',
56
+ :'threshold' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'amount',
64
+ :'monthly_limit',
65
+ :'threshold'
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::BalanceAutoTopup` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ acceptable_attribute_map = self.class.acceptable_attribute_map
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!acceptable_attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Management::Generated::BalanceAutoTopup`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'amount')
86
+ self.amount = attributes[:'amount']
87
+ else
88
+ self.amount = nil
89
+ end
90
+
91
+ if attributes.key?(:'enabled')
92
+ self.enabled = attributes[:'enabled']
93
+ else
94
+ self.enabled = nil
95
+ end
96
+
97
+ if attributes.key?(:'monthly_limit')
98
+ self.monthly_limit = attributes[:'monthly_limit']
99
+ else
100
+ self.monthly_limit = nil
101
+ end
102
+
103
+ if attributes.key?(:'monthly_used')
104
+ self.monthly_used = attributes[:'monthly_used']
105
+ else
106
+ self.monthly_used = nil
107
+ end
108
+
109
+ if attributes.key?(:'threshold')
110
+ self.threshold = attributes[:'threshold']
111
+ else
112
+ self.threshold = nil
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if @enabled.nil?
122
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
123
+ end
124
+
125
+ if @monthly_used.nil?
126
+ invalid_properties.push('invalid value for "monthly_used", monthly_used cannot be nil.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if @enabled.nil?
137
+ return false if @monthly_used.nil?
138
+ true
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] enabled Value to be assigned
143
+ def enabled=(enabled)
144
+ if enabled.nil?
145
+ fail ArgumentError, 'enabled cannot be nil'
146
+ end
147
+
148
+ @enabled = enabled
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] monthly_used Value to be assigned
153
+ def monthly_used=(monthly_used)
154
+ if monthly_used.nil?
155
+ fail ArgumentError, 'monthly_used cannot be nil'
156
+ end
157
+
158
+ @monthly_used = monthly_used
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ amount == o.amount &&
167
+ enabled == o.enabled &&
168
+ monthly_limit == o.monthly_limit &&
169
+ monthly_used == o.monthly_used &&
170
+ threshold == o.threshold
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [amount, enabled, monthly_limit, monthly_used, threshold].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ return nil unless attributes.is_a?(Hash)
190
+ attributes = attributes.transform_keys(&:to_sym)
191
+ transformed_hash = {}
192
+ openapi_types.each_pair do |key, type|
193
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = nil
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[attribute_map[key]].is_a?(Array)
199
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
200
+ end
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ end
225
+
226
+ end