sendmux-mailbox 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +3 -0
  4. data/lib/sendmux/mailbox/client.rb +34 -0
  5. data/lib/sendmux/mailbox/version.rb +7 -0
  6. data/lib/sendmux/mailbox.rb +12 -0
  7. data/lib/sendmux_mailbox_generated/api/mailbox_api_api.rb +3226 -0
  8. data/lib/sendmux_mailbox_generated/api_client.rb +441 -0
  9. data/lib/sendmux_mailbox_generated/api_error.rb +58 -0
  10. data/lib/sendmux_mailbox_generated/api_model_base.rb +88 -0
  11. data/lib/sendmux_mailbox_generated/configuration.rb +393 -0
  12. data/lib/sendmux_mailbox_generated/models/api_error_detail.rb +219 -0
  13. data/lib/sendmux_mailbox_generated/models/api_error_error.rb +275 -0
  14. data/lib/sendmux_mailbox_generated/models/api_error_meta.rb +164 -0
  15. data/lib/sendmux_mailbox_generated/models/api_error_response.rb +216 -0
  16. data/lib/sendmux_mailbox_generated/models/batch_delete_mailbox_messages_body.rb +204 -0
  17. data/lib/sendmux_mailbox_generated/models/batch_update_mailbox_messages_body.rb +224 -0
  18. data/lib/sendmux_mailbox_generated/models/create_mailbox_folder_body.rb +183 -0
  19. data/lib/sendmux_mailbox_generated/models/cursor_pagination.rb +173 -0
  20. data/lib/sendmux_mailbox_generated/models/mailbox.rb +284 -0
  21. data/lib/sendmux_mailbox_generated/models/mailbox_address.rb +176 -0
  22. data/lib/sendmux_mailbox_generated/models/mailbox_attachment.rb +248 -0
  23. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_result.rb +243 -0
  24. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_result_response.rb +223 -0
  25. data/lib/sendmux_mailbox_generated/models/mailbox_batch_delete_messages_result.rb +248 -0
  26. data/lib/sendmux_mailbox_generated/models/mailbox_batch_delete_messages_result_response.rb +223 -0
  27. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_body.rb +363 -0
  28. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_item.rb +188 -0
  29. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_result.rb +220 -0
  30. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_result_response.rb +223 -0
  31. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_result_states.rb +150 -0
  32. data/lib/sendmux_mailbox_generated/models/mailbox_batch_message_failure.rb +216 -0
  33. data/lib/sendmux_mailbox_generated/models/mailbox_batch_message_states.rb +162 -0
  34. data/lib/sendmux_mailbox_generated/models/mailbox_batch_update_messages_result.rb +248 -0
  35. data/lib/sendmux_mailbox_generated/models/mailbox_batch_update_messages_result_response.rb +223 -0
  36. data/lib/sendmux_mailbox_generated/models/mailbox_changes.rb +297 -0
  37. data/lib/sendmux_mailbox_generated/models/mailbox_changes_response.rb +223 -0
  38. data/lib/sendmux_mailbox_generated/models/mailbox_content_headers.rb +214 -0
  39. data/lib/sendmux_mailbox_generated/models/mailbox_content_headers_full_inner.rb +190 -0
  40. data/lib/sendmux_mailbox_generated/models/mailbox_content_headers_selected.rb +234 -0
  41. data/lib/sendmux_mailbox_generated/models/mailbox_folder.rb +307 -0
  42. data/lib/sendmux_mailbox_generated/models/mailbox_folder_cursor_list_response.rb +251 -0
  43. data/lib/sendmux_mailbox_generated/models/mailbox_folder_deleted_response.rb +223 -0
  44. data/lib/sendmux_mailbox_generated/models/mailbox_folder_deleted_response_all_of_data.rb +190 -0
  45. data/lib/sendmux_mailbox_generated/models/mailbox_folder_query_changes.rb +270 -0
  46. data/lib/sendmux_mailbox_generated/models/mailbox_folder_query_changes_added_inner.rb +190 -0
  47. data/lib/sendmux_mailbox_generated/models/mailbox_folder_query_changes_response.rb +223 -0
  48. data/lib/sendmux_mailbox_generated/models/mailbox_folder_response.rb +223 -0
  49. data/lib/sendmux_mailbox_generated/models/mailbox_get_changes200_response.rb +103 -0
  50. data/lib/sendmux_mailbox_generated/models/mailbox_identity.rb +352 -0
  51. data/lib/sendmux_mailbox_generated/models/mailbox_identity_cursor_list_response.rb +251 -0
  52. data/lib/sendmux_mailbox_generated/models/mailbox_identity_response.rb +223 -0
  53. data/lib/sendmux_mailbox_generated/models/mailbox_me.rb +301 -0
  54. data/lib/sendmux_mailbox_generated/models/mailbox_me_item_response.rb +223 -0
  55. data/lib/sendmux_mailbox_generated/models/mailbox_message.rb +515 -0
  56. data/lib/sendmux_mailbox_generated/models/mailbox_message_content.rb +348 -0
  57. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_body.rb +327 -0
  58. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_dates.rb +162 -0
  59. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_participants.rb +276 -0
  60. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_response.rb +223 -0
  61. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_response_all_of_data.rb +355 -0
  62. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_states.rb +176 -0
  63. data/lib/sendmux_mailbox_generated/models/mailbox_message_count.rb +176 -0
  64. data/lib/sendmux_mailbox_generated/models/mailbox_message_count_response.rb +223 -0
  65. data/lib/sendmux_mailbox_generated/models/mailbox_message_deleted_response.rb +223 -0
  66. data/lib/sendmux_mailbox_generated/models/mailbox_message_detail_response.rb +223 -0
  67. data/lib/sendmux_mailbox_generated/models/mailbox_message_flags.rb +242 -0
  68. data/lib/sendmux_mailbox_generated/models/mailbox_message_query_changes.rb +270 -0
  69. data/lib/sendmux_mailbox_generated/models/mailbox_message_query_changes_response.rb +223 -0
  70. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary.rb +456 -0
  71. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary_cursor_list_response.rb +251 -0
  72. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary_from.rb +183 -0
  73. data/lib/sendmux_mailbox_generated/models/mailbox_quota.rb +359 -0
  74. data/lib/sendmux_mailbox_generated/models/mailbox_quota_cursor_list_response.rb +251 -0
  75. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body.rb +279 -0
  76. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body_body.rb +200 -0
  77. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body_response.rb +223 -0
  78. data/lib/sendmux_mailbox_generated/models/mailbox_raw_body_response_all_of_data.rb +286 -0
  79. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_event.rb +380 -0
  80. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_message.rb +529 -0
  81. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_message_all_of_body.rb +214 -0
  82. data/lib/sendmux_mailbox_generated/models/mailbox_search_snippet.rb +190 -0
  83. data/lib/sendmux_mailbox_generated/models/mailbox_search_snippets_result.rb +206 -0
  84. data/lib/sendmux_mailbox_generated/models/mailbox_search_snippets_result_response.rb +223 -0
  85. data/lib/sendmux_mailbox_generated/models/mailbox_send_result_response.rb +223 -0
  86. data/lib/sendmux_mailbox_generated/models/mailbox_send_scope.rb +213 -0
  87. data/lib/sendmux_mailbox_generated/models/mailbox_session.rb +294 -0
  88. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities.rb +346 -0
  89. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_attachments.rb +294 -0
  90. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_folders.rb +320 -0
  91. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_identities.rb +268 -0
  92. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_messages.rb +516 -0
  93. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_quotas.rb +242 -0
  94. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_submissions.rb +242 -0
  95. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_sync.rb +222 -0
  96. data/lib/sendmux_mailbox_generated/models/mailbox_session_capabilities_threads.rb +268 -0
  97. data/lib/sendmux_mailbox_generated/models/mailbox_session_endpoints.rb +334 -0
  98. data/lib/sendmux_mailbox_generated/models/mailbox_session_gated.rb +451 -0
  99. data/lib/sendmux_mailbox_generated/models/mailbox_session_limits.rb +398 -0
  100. data/lib/sendmux_mailbox_generated/models/mailbox_session_mailbox.rb +203 -0
  101. data/lib/sendmux_mailbox_generated/models/mailbox_session_response.rb +223 -0
  102. data/lib/sendmux_mailbox_generated/models/mailbox_session_states.rb +294 -0
  103. data/lib/sendmux_mailbox_generated/models/mailbox_submission.rb +321 -0
  104. data/lib/sendmux_mailbox_generated/models/mailbox_submission_cursor_list_response.rb +251 -0
  105. data/lib/sendmux_mailbox_generated/models/mailbox_submission_delivery_status.rb +200 -0
  106. data/lib/sendmux_mailbox_generated/models/mailbox_submission_envelope.rb +178 -0
  107. data/lib/sendmux_mailbox_generated/models/mailbox_submission_envelope_address.rb +178 -0
  108. data/lib/sendmux_mailbox_generated/models/mailbox_submission_envelope_rcpt_to_inner.rb +185 -0
  109. data/lib/sendmux_mailbox_generated/models/mailbox_submission_response.rb +223 -0
  110. data/lib/sendmux_mailbox_generated/models/mailbox_thread.rb +398 -0
  111. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_meta.rb +244 -0
  112. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_meta_states.rb +188 -0
  113. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_response.rb +251 -0
  114. data/lib/sendmux_mailbox_generated/models/mailbox_thread_content_response_all_of_data.rb +355 -0
  115. data/lib/sendmux_mailbox_generated/models/mailbox_thread_detail_response.rb +223 -0
  116. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary.rb +363 -0
  117. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_cursor_list_response.rb +251 -0
  118. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_last_message.rb +463 -0
  119. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_states.rb +162 -0
  120. data/lib/sendmux_mailbox_generated/models/mailbox_typed_changes.rb +164 -0
  121. data/lib/sendmux_mailbox_generated/models/mailbox_typed_changes_response.rb +223 -0
  122. data/lib/sendmux_mailbox_generated/models/mailbox_typed_changes_types.rb +192 -0
  123. data/lib/sendmux_mailbox_generated/models/mailbox_usage.rb +192 -0
  124. data/lib/sendmux_mailbox_generated/models/mailbox_usage_resource.rb +408 -0
  125. data/lib/sendmux_mailbox_generated/models/mailbox_usage_response.rb +223 -0
  126. data/lib/sendmux_mailbox_generated/models/mailbox_usage_states.rb +150 -0
  127. data/lib/sendmux_mailbox_generated/models/patch_mailbox_folder_body.rb +166 -0
  128. data/lib/sendmux_mailbox_generated/models/patch_mailbox_message_body.rb +168 -0
  129. data/lib/sendmux_mailbox_generated/models/response_meta.rb +164 -0
  130. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body.rb +283 -0
  131. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body_attachments_inner.rb +103 -0
  132. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body_attachments_inner_any_of.rb +217 -0
  133. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body_attachments_inner_any_of1.rb +217 -0
  134. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_result.rb +214 -0
  135. data/lib/sendmux_mailbox_generated/models/success_envelope.rb +192 -0
  136. data/lib/sendmux_mailbox_generated/models/update_mailbox_identity_body.rb +216 -0
  137. data/lib/sendmux_mailbox_generated/version.rb +15 -0
  138. data/lib/sendmux_mailbox_generated.rb +166 -0
  139. metadata +255 -0
@@ -0,0 +1,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::Mailbox::Generated
17
+ class MailboxFolderResponse < 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' => :'MailboxFolder'
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::Mailbox::Generated::MailboxFolderResponse` 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::Mailbox::Generated::MailboxFolderResponse`. 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,103 @@
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
+ module MailboxGetChanges200Response
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'MailboxChangesResponse',
23
+ :'MailboxTypedChangesResponse'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = Sendmux::Mailbox::Generated.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,352 @@
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 MailboxIdentity < ApiModelBase
18
+ attr_accessor :bcc
19
+
20
+ attr_accessor :email
21
+
22
+ attr_accessor :html_signature
23
+
24
+ # Identity ID
25
+ attr_accessor :id
26
+
27
+ # Whether the mailbox service allows this identity to be deleted.
28
+ attr_accessor :may_delete
29
+
30
+ attr_accessor :name
31
+
32
+ attr_accessor :reply_to
33
+
34
+ attr_accessor :text_signature
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'bcc' => :'bcc',
40
+ :'email' => :'email',
41
+ :'html_signature' => :'html_signature',
42
+ :'id' => :'id',
43
+ :'may_delete' => :'may_delete',
44
+ :'name' => :'name',
45
+ :'reply_to' => :'reply_to',
46
+ :'text_signature' => :'text_signature'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'bcc' => :'Array<MailboxAddress>',
64
+ :'email' => :'String',
65
+ :'html_signature' => :'String',
66
+ :'id' => :'String',
67
+ :'may_delete' => :'Boolean',
68
+ :'name' => :'String',
69
+ :'reply_to' => :'Array<MailboxAddress>',
70
+ :'text_signature' => :'String'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxIdentity` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ acceptable_attribute_map = self.class.acceptable_attribute_map
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!acceptable_attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxIdentity`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'bcc')
97
+ if (value = attributes[:'bcc']).is_a?(Array)
98
+ self.bcc = value
99
+ end
100
+ else
101
+ self.bcc = nil
102
+ end
103
+
104
+ if attributes.key?(:'email')
105
+ self.email = attributes[:'email']
106
+ else
107
+ self.email = nil
108
+ end
109
+
110
+ if attributes.key?(:'html_signature')
111
+ self.html_signature = attributes[:'html_signature']
112
+ else
113
+ self.html_signature = nil
114
+ end
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ else
119
+ self.id = nil
120
+ end
121
+
122
+ if attributes.key?(:'may_delete')
123
+ self.may_delete = attributes[:'may_delete']
124
+ else
125
+ self.may_delete = nil
126
+ end
127
+
128
+ if attributes.key?(:'name')
129
+ self.name = attributes[:'name']
130
+ else
131
+ self.name = nil
132
+ end
133
+
134
+ if attributes.key?(:'reply_to')
135
+ if (value = attributes[:'reply_to']).is_a?(Array)
136
+ self.reply_to = value
137
+ end
138
+ else
139
+ self.reply_to = nil
140
+ end
141
+
142
+ if attributes.key?(:'text_signature')
143
+ self.text_signature = attributes[:'text_signature']
144
+ else
145
+ self.text_signature = nil
146
+ end
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properties with the reasons
151
+ def list_invalid_properties
152
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
153
+ invalid_properties = Array.new
154
+ if @bcc.nil?
155
+ invalid_properties.push('invalid value for "bcc", bcc cannot be nil.')
156
+ end
157
+
158
+ if @email.nil?
159
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
160
+ end
161
+
162
+ if @html_signature.nil?
163
+ invalid_properties.push('invalid value for "html_signature", html_signature cannot be nil.')
164
+ end
165
+
166
+ if @id.nil?
167
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
168
+ end
169
+
170
+ if @may_delete.nil?
171
+ invalid_properties.push('invalid value for "may_delete", may_delete cannot be nil.')
172
+ end
173
+
174
+ if @name.nil?
175
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
176
+ end
177
+
178
+ if @reply_to.nil?
179
+ invalid_properties.push('invalid value for "reply_to", reply_to cannot be nil.')
180
+ end
181
+
182
+ if @text_signature.nil?
183
+ invalid_properties.push('invalid value for "text_signature", text_signature cannot be nil.')
184
+ end
185
+
186
+ invalid_properties
187
+ end
188
+
189
+ # Check to see if the all the properties in the model are valid
190
+ # @return true if the model is valid
191
+ def valid?
192
+ warn '[DEPRECATED] the `valid?` method is obsolete'
193
+ return false if @bcc.nil?
194
+ return false if @email.nil?
195
+ return false if @html_signature.nil?
196
+ return false if @id.nil?
197
+ return false if @may_delete.nil?
198
+ return false if @name.nil?
199
+ return false if @reply_to.nil?
200
+ return false if @text_signature.nil?
201
+ true
202
+ end
203
+
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] bcc Value to be assigned
206
+ def bcc=(bcc)
207
+ if bcc.nil?
208
+ fail ArgumentError, 'bcc cannot be nil'
209
+ end
210
+
211
+ @bcc = bcc
212
+ end
213
+
214
+ # Custom attribute writer method with validation
215
+ # @param [Object] email Value to be assigned
216
+ def email=(email)
217
+ if email.nil?
218
+ fail ArgumentError, 'email cannot be nil'
219
+ end
220
+
221
+ @email = email
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] html_signature Value to be assigned
226
+ def html_signature=(html_signature)
227
+ if html_signature.nil?
228
+ fail ArgumentError, 'html_signature cannot be nil'
229
+ end
230
+
231
+ @html_signature = html_signature
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] id Value to be assigned
236
+ def id=(id)
237
+ if id.nil?
238
+ fail ArgumentError, 'id cannot be nil'
239
+ end
240
+
241
+ @id = id
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] may_delete Value to be assigned
246
+ def may_delete=(may_delete)
247
+ if may_delete.nil?
248
+ fail ArgumentError, 'may_delete cannot be nil'
249
+ end
250
+
251
+ @may_delete = may_delete
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] name Value to be assigned
256
+ def name=(name)
257
+ if name.nil?
258
+ fail ArgumentError, 'name cannot be nil'
259
+ end
260
+
261
+ @name = name
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] reply_to Value to be assigned
266
+ def reply_to=(reply_to)
267
+ if reply_to.nil?
268
+ fail ArgumentError, 'reply_to cannot be nil'
269
+ end
270
+
271
+ @reply_to = reply_to
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] text_signature Value to be assigned
276
+ def text_signature=(text_signature)
277
+ if text_signature.nil?
278
+ fail ArgumentError, 'text_signature cannot be nil'
279
+ end
280
+
281
+ @text_signature = text_signature
282
+ end
283
+
284
+ # Checks equality by comparing each attribute.
285
+ # @param [Object] Object to be compared
286
+ def ==(o)
287
+ return true if self.equal?(o)
288
+ self.class == o.class &&
289
+ bcc == o.bcc &&
290
+ email == o.email &&
291
+ html_signature == o.html_signature &&
292
+ id == o.id &&
293
+ may_delete == o.may_delete &&
294
+ name == o.name &&
295
+ reply_to == o.reply_to &&
296
+ text_signature == o.text_signature
297
+ end
298
+
299
+ # @see the `==` method
300
+ # @param [Object] Object to be compared
301
+ def eql?(o)
302
+ self == o
303
+ end
304
+
305
+ # Calculates hash code according to all attributes.
306
+ # @return [Integer] Hash code
307
+ def hash
308
+ [bcc, email, html_signature, id, may_delete, name, reply_to, text_signature].hash
309
+ end
310
+
311
+ # Builds the object from hash
312
+ # @param [Hash] attributes Model attributes in the form of hash
313
+ # @return [Object] Returns the model itself
314
+ def self.build_from_hash(attributes)
315
+ return nil unless attributes.is_a?(Hash)
316
+ attributes = attributes.transform_keys(&:to_sym)
317
+ transformed_hash = {}
318
+ openapi_types.each_pair do |key, type|
319
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
320
+ transformed_hash["#{key}"] = nil
321
+ elsif type =~ /\AArray<(.*)>/i
322
+ # check to ensure the input is an array given that the attribute
323
+ # is documented as an array but the input is not
324
+ if attributes[attribute_map[key]].is_a?(Array)
325
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
326
+ end
327
+ elsif !attributes[attribute_map[key]].nil?
328
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
329
+ end
330
+ end
331
+ new(transformed_hash)
332
+ end
333
+
334
+ # Returns the object in the form of hash
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_hash
337
+ hash = {}
338
+ self.class.attribute_map.each_pair do |attr, param|
339
+ value = self.send(attr)
340
+ if value.nil?
341
+ is_nullable = self.class.openapi_nullable.include?(attr)
342
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
343
+ end
344
+
345
+ hash[param] = _to_hash(value)
346
+ end
347
+ hash
348
+ end
349
+
350
+ end
351
+
352
+ end