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