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