sendmux-mailbox 1.0.0 → 1.1.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 +4 -4
- data/CHANGELOG.md +22 -0
- data/LICENSE +21 -0
- data/README.md +105 -0
- data/lib/sendmux/mailbox/version.rb +1 -1
- data/lib/sendmux_mailbox_generated/api/mailbox_api_api.rb +275 -14
- data/lib/sendmux_mailbox_generated/models/batch_delete_mailbox_messages_body.rb +1 -0
- data/lib/sendmux_mailbox_generated/models/batch_update_mailbox_messages_body.rb +3 -0
- data/lib/sendmux_mailbox_generated/models/{mailbox_message_summary_from.rb → granted_mailbox.rb} +28 -19
- data/lib/sendmux_mailbox_generated/models/granted_mailbox_list_response.rb +251 -0
- data/lib/sendmux_mailbox_generated/models/mailbox_attachment.rb +3 -1
- data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_body.rb +228 -0
- data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_result.rb +323 -0
- data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_result_headers.rb +191 -0
- data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_result_response.rb +223 -0
- data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_body.rb +10 -0
- data/lib/sendmux_mailbox_generated/models/mailbox_changes.rb +11 -1
- data/lib/sendmux_mailbox_generated/models/mailbox_message.rb +14 -45
- data/lib/sendmux_mailbox_generated/models/mailbox_message_content_participants.rb +2 -16
- data/lib/sendmux_mailbox_generated/models/mailbox_message_summary.rb +15 -17
- data/lib/sendmux_mailbox_generated/models/mailbox_realtime_event.rb +1 -15
- data/lib/sendmux_mailbox_generated/models/mailbox_realtime_message.rb +14 -45
- data/lib/sendmux_mailbox_generated/models/mailbox_thread.rb +2 -16
- data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary.rb +2 -16
- data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body.rb +10 -0
- data/lib/sendmux_mailbox_generated.rb +6 -2
- metadata +9 -4
- data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_last_message.rb +0 -463
|
@@ -0,0 +1,323 @@
|
|
|
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 MailboxAttachmentUploadIntentResult < ApiModelBase
|
|
18
|
+
# Upload URL expiry time.
|
|
19
|
+
attr_accessor :expires_at
|
|
20
|
+
|
|
21
|
+
attr_accessor :headers
|
|
22
|
+
|
|
23
|
+
# Maximum accepted attachment size in bytes.
|
|
24
|
+
attr_accessor :max_size_bytes
|
|
25
|
+
|
|
26
|
+
# HTTP method to use with `upload_url`.
|
|
27
|
+
attr_accessor :method
|
|
28
|
+
|
|
29
|
+
# Short-lived upload intent ID.
|
|
30
|
+
attr_accessor :upload_id
|
|
31
|
+
|
|
32
|
+
# Short-lived signed PUT URL for this exact attachment. Upload promptly; if it expires, create a new upload URL.
|
|
33
|
+
attr_accessor :upload_url
|
|
34
|
+
|
|
35
|
+
class EnumAttributeValidator
|
|
36
|
+
attr_reader :datatype
|
|
37
|
+
attr_reader :allowable_values
|
|
38
|
+
|
|
39
|
+
def initialize(datatype, allowable_values)
|
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
|
41
|
+
case datatype.to_s
|
|
42
|
+
when /Integer/i
|
|
43
|
+
value.to_i
|
|
44
|
+
when /Float/i
|
|
45
|
+
value.to_f
|
|
46
|
+
else
|
|
47
|
+
value
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def valid?(value)
|
|
53
|
+
!value || allowable_values.include?(value)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
58
|
+
def self.attribute_map
|
|
59
|
+
{
|
|
60
|
+
:'expires_at' => :'expires_at',
|
|
61
|
+
:'headers' => :'headers',
|
|
62
|
+
:'max_size_bytes' => :'max_size_bytes',
|
|
63
|
+
:'method' => :'method',
|
|
64
|
+
:'upload_id' => :'upload_id',
|
|
65
|
+
:'upload_url' => :'upload_url'
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Returns attribute mapping this model knows about
|
|
70
|
+
def self.acceptable_attribute_map
|
|
71
|
+
attribute_map
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Returns all the JSON keys this model knows about
|
|
75
|
+
def self.acceptable_attributes
|
|
76
|
+
acceptable_attribute_map.values
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Attribute type mapping.
|
|
80
|
+
def self.openapi_types
|
|
81
|
+
{
|
|
82
|
+
:'expires_at' => :'Time',
|
|
83
|
+
:'headers' => :'MailboxAttachmentUploadIntentResultHeaders',
|
|
84
|
+
:'max_size_bytes' => :'Integer',
|
|
85
|
+
:'method' => :'String',
|
|
86
|
+
:'upload_id' => :'String',
|
|
87
|
+
:'upload_url' => :'String'
|
|
88
|
+
}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# List of attributes with nullable: true
|
|
92
|
+
def self.openapi_nullable
|
|
93
|
+
Set.new([
|
|
94
|
+
])
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Initializes the object
|
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
99
|
+
def initialize(attributes = {})
|
|
100
|
+
if (!attributes.is_a?(Hash))
|
|
101
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxAttachmentUploadIntentResult` initialize method"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
105
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
106
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
107
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
108
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxAttachmentUploadIntentResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
109
|
+
end
|
|
110
|
+
h[k.to_sym] = v
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'expires_at')
|
|
114
|
+
self.expires_at = attributes[:'expires_at']
|
|
115
|
+
else
|
|
116
|
+
self.expires_at = nil
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'headers')
|
|
120
|
+
self.headers = attributes[:'headers']
|
|
121
|
+
else
|
|
122
|
+
self.headers = nil
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'max_size_bytes')
|
|
126
|
+
self.max_size_bytes = attributes[:'max_size_bytes']
|
|
127
|
+
else
|
|
128
|
+
self.max_size_bytes = nil
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'method')
|
|
132
|
+
self.method = attributes[:'method']
|
|
133
|
+
else
|
|
134
|
+
self.method = nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'upload_id')
|
|
138
|
+
self.upload_id = attributes[:'upload_id']
|
|
139
|
+
else
|
|
140
|
+
self.upload_id = nil
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'upload_url')
|
|
144
|
+
self.upload_url = attributes[:'upload_url']
|
|
145
|
+
else
|
|
146
|
+
self.upload_url = nil
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
151
|
+
# @return Array for valid properties with the reasons
|
|
152
|
+
def list_invalid_properties
|
|
153
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
154
|
+
invalid_properties = Array.new
|
|
155
|
+
if @expires_at.nil?
|
|
156
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if @headers.nil?
|
|
160
|
+
invalid_properties.push('invalid value for "headers", headers cannot be nil.')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if @max_size_bytes.nil?
|
|
164
|
+
invalid_properties.push('invalid value for "max_size_bytes", max_size_bytes cannot be nil.')
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if @method.nil?
|
|
168
|
+
invalid_properties.push('invalid value for "method", method cannot be nil.')
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if @upload_id.nil?
|
|
172
|
+
invalid_properties.push('invalid value for "upload_id", upload_id cannot be nil.')
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if @upload_url.nil?
|
|
176
|
+
invalid_properties.push('invalid value for "upload_url", upload_url cannot be nil.')
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
invalid_properties
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Check to see if the all the properties in the model are valid
|
|
183
|
+
# @return true if the model is valid
|
|
184
|
+
def valid?
|
|
185
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
186
|
+
return false if @expires_at.nil?
|
|
187
|
+
return false if @headers.nil?
|
|
188
|
+
return false if @max_size_bytes.nil?
|
|
189
|
+
return false if @method.nil?
|
|
190
|
+
method_validator = EnumAttributeValidator.new('String', ["PUT", "unknown_default_open_api"])
|
|
191
|
+
return false unless method_validator.valid?(@method)
|
|
192
|
+
return false if @upload_id.nil?
|
|
193
|
+
return false if @upload_url.nil?
|
|
194
|
+
true
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Custom attribute writer method with validation
|
|
198
|
+
# @param [Object] expires_at Value to be assigned
|
|
199
|
+
def expires_at=(expires_at)
|
|
200
|
+
if expires_at.nil?
|
|
201
|
+
fail ArgumentError, 'expires_at cannot be nil'
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
@expires_at = expires_at
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Custom attribute writer method with validation
|
|
208
|
+
# @param [Object] headers Value to be assigned
|
|
209
|
+
def headers=(headers)
|
|
210
|
+
if headers.nil?
|
|
211
|
+
fail ArgumentError, 'headers cannot be nil'
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
@headers = headers
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Custom attribute writer method with validation
|
|
218
|
+
# @param [Object] max_size_bytes Value to be assigned
|
|
219
|
+
def max_size_bytes=(max_size_bytes)
|
|
220
|
+
if max_size_bytes.nil?
|
|
221
|
+
fail ArgumentError, 'max_size_bytes cannot be nil'
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
@max_size_bytes = max_size_bytes
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
228
|
+
# @param [Object] method Object to be assigned
|
|
229
|
+
def method=(method)
|
|
230
|
+
validator = EnumAttributeValidator.new('String', ["PUT", "unknown_default_open_api"])
|
|
231
|
+
unless validator.valid?(method)
|
|
232
|
+
fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
|
|
233
|
+
end
|
|
234
|
+
@method = method
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Custom attribute writer method with validation
|
|
238
|
+
# @param [Object] upload_id Value to be assigned
|
|
239
|
+
def upload_id=(upload_id)
|
|
240
|
+
if upload_id.nil?
|
|
241
|
+
fail ArgumentError, 'upload_id cannot be nil'
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
@upload_id = upload_id
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Custom attribute writer method with validation
|
|
248
|
+
# @param [Object] upload_url Value to be assigned
|
|
249
|
+
def upload_url=(upload_url)
|
|
250
|
+
if upload_url.nil?
|
|
251
|
+
fail ArgumentError, 'upload_url cannot be nil'
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
@upload_url = upload_url
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Checks equality by comparing each attribute.
|
|
258
|
+
# @param [Object] Object to be compared
|
|
259
|
+
def ==(o)
|
|
260
|
+
return true if self.equal?(o)
|
|
261
|
+
self.class == o.class &&
|
|
262
|
+
expires_at == o.expires_at &&
|
|
263
|
+
headers == o.headers &&
|
|
264
|
+
max_size_bytes == o.max_size_bytes &&
|
|
265
|
+
method == o.method &&
|
|
266
|
+
upload_id == o.upload_id &&
|
|
267
|
+
upload_url == o.upload_url
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# @see the `==` method
|
|
271
|
+
# @param [Object] Object to be compared
|
|
272
|
+
def eql?(o)
|
|
273
|
+
self == o
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# Calculates hash code according to all attributes.
|
|
277
|
+
# @return [Integer] Hash code
|
|
278
|
+
def hash
|
|
279
|
+
[expires_at, headers, max_size_bytes, method, upload_id, upload_url].hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Builds the object from hash
|
|
283
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
284
|
+
# @return [Object] Returns the model itself
|
|
285
|
+
def self.build_from_hash(attributes)
|
|
286
|
+
return nil unless attributes.is_a?(Hash)
|
|
287
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
288
|
+
transformed_hash = {}
|
|
289
|
+
openapi_types.each_pair do |key, type|
|
|
290
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
291
|
+
transformed_hash["#{key}"] = nil
|
|
292
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
293
|
+
# check to ensure the input is an array given that the attribute
|
|
294
|
+
# is documented as an array but the input is not
|
|
295
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
296
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
297
|
+
end
|
|
298
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
299
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
new(transformed_hash)
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Returns the object in the form of hash
|
|
306
|
+
# @return [Hash] Returns the object in the form of hash
|
|
307
|
+
def to_hash
|
|
308
|
+
hash = {}
|
|
309
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
310
|
+
value = self.send(attr)
|
|
311
|
+
if value.nil?
|
|
312
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
313
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
hash[param] = _to_hash(value)
|
|
317
|
+
end
|
|
318
|
+
hash
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
end
|
|
@@ -0,0 +1,191 @@
|
|
|
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
|
+
# Headers that must be sent exactly with the PUT request.
|
|
18
|
+
class MailboxAttachmentUploadIntentResultHeaders < ApiModelBase
|
|
19
|
+
attr_accessor :content_length
|
|
20
|
+
|
|
21
|
+
attr_accessor :content_type
|
|
22
|
+
|
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
|
+
def self.attribute_map
|
|
25
|
+
{
|
|
26
|
+
:'content_length' => :'Content-Length',
|
|
27
|
+
:'content_type' => :'Content-Type'
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Returns attribute mapping this model knows about
|
|
32
|
+
def self.acceptable_attribute_map
|
|
33
|
+
attribute_map
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns all the JSON keys this model knows about
|
|
37
|
+
def self.acceptable_attributes
|
|
38
|
+
acceptable_attribute_map.values
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute type mapping.
|
|
42
|
+
def self.openapi_types
|
|
43
|
+
{
|
|
44
|
+
:'content_length' => :'String',
|
|
45
|
+
:'content_type' => :'String'
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# List of attributes with nullable: true
|
|
50
|
+
def self.openapi_nullable
|
|
51
|
+
Set.new([
|
|
52
|
+
])
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Initializes the object
|
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
57
|
+
def initialize(attributes = {})
|
|
58
|
+
if (!attributes.is_a?(Hash))
|
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxAttachmentUploadIntentResultHeaders` initialize method"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
63
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
65
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxAttachmentUploadIntentResultHeaders`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
67
|
+
end
|
|
68
|
+
h[k.to_sym] = v
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if attributes.key?(:'content_length')
|
|
72
|
+
self.content_length = attributes[:'content_length']
|
|
73
|
+
else
|
|
74
|
+
self.content_length = nil
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'content_type')
|
|
78
|
+
self.content_type = attributes[:'content_type']
|
|
79
|
+
else
|
|
80
|
+
self.content_type = nil
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
85
|
+
# @return Array for valid properties with the reasons
|
|
86
|
+
def list_invalid_properties
|
|
87
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
88
|
+
invalid_properties = Array.new
|
|
89
|
+
if @content_length.nil?
|
|
90
|
+
invalid_properties.push('invalid value for "content_length", content_length cannot be nil.')
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if @content_type.nil?
|
|
94
|
+
invalid_properties.push('invalid value for "content_type", content_type cannot be nil.')
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
invalid_properties
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Check to see if the all the properties in the model are valid
|
|
101
|
+
# @return true if the model is valid
|
|
102
|
+
def valid?
|
|
103
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
104
|
+
return false if @content_length.nil?
|
|
105
|
+
return false if @content_type.nil?
|
|
106
|
+
true
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Custom attribute writer method with validation
|
|
110
|
+
# @param [Object] content_length Value to be assigned
|
|
111
|
+
def content_length=(content_length)
|
|
112
|
+
if content_length.nil?
|
|
113
|
+
fail ArgumentError, 'content_length cannot be nil'
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
@content_length = content_length
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Custom attribute writer method with validation
|
|
120
|
+
# @param [Object] content_type Value to be assigned
|
|
121
|
+
def content_type=(content_type)
|
|
122
|
+
if content_type.nil?
|
|
123
|
+
fail ArgumentError, 'content_type cannot be nil'
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
@content_type = content_type
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Checks equality by comparing each attribute.
|
|
130
|
+
# @param [Object] Object to be compared
|
|
131
|
+
def ==(o)
|
|
132
|
+
return true if self.equal?(o)
|
|
133
|
+
self.class == o.class &&
|
|
134
|
+
content_length == o.content_length &&
|
|
135
|
+
content_type == o.content_type
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# @see the `==` method
|
|
139
|
+
# @param [Object] Object to be compared
|
|
140
|
+
def eql?(o)
|
|
141
|
+
self == o
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Calculates hash code according to all attributes.
|
|
145
|
+
# @return [Integer] Hash code
|
|
146
|
+
def hash
|
|
147
|
+
[content_length, content_type].hash
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Builds the object from hash
|
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
152
|
+
# @return [Object] Returns the model itself
|
|
153
|
+
def self.build_from_hash(attributes)
|
|
154
|
+
return nil unless attributes.is_a?(Hash)
|
|
155
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
156
|
+
transformed_hash = {}
|
|
157
|
+
openapi_types.each_pair do |key, type|
|
|
158
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
159
|
+
transformed_hash["#{key}"] = nil
|
|
160
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
161
|
+
# check to ensure the input is an array given that the attribute
|
|
162
|
+
# is documented as an array but the input is not
|
|
163
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
164
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
165
|
+
end
|
|
166
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
167
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
new(transformed_hash)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Returns the object in the form of hash
|
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
|
175
|
+
def to_hash
|
|
176
|
+
hash = {}
|
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
178
|
+
value = self.send(attr)
|
|
179
|
+
if value.nil?
|
|
180
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
181
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
hash[param] = _to_hash(value)
|
|
185
|
+
end
|
|
186
|
+
hash
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
end
|