sendmux-sending 1.0.0 → 1.2.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 +14 -0
- data/LICENSE +21 -0
- data/README.md +95 -0
- data/lib/sendmux/sending/client.rb +9 -1
- data/lib/sendmux/sending/version.rb +1 -1
- data/lib/sendmux_sending_generated/api/attachments_api.rb +370 -0
- data/lib/sendmux_sending_generated/api/emails_api.rb +2 -20
- data/lib/sendmux_sending_generated/api/meta_api.rb +82 -0
- data/lib/sendmux_sending_generated/api_client.rb +9 -3
- data/lib/sendmux_sending_generated/api_error.rb +2 -2
- data/lib/sendmux_sending_generated/api_model_base.rb +2 -2
- data/lib/sendmux_sending_generated/configuration.rb +2 -2
- data/lib/sendmux_sending_generated/models/address.rb +2 -2
- data/lib/sendmux_sending_generated/models/attachment.rb +78 -249
- data/lib/sendmux_sending_generated/models/attachment_upload_data.rb +284 -0
- data/lib/sendmux_sending_generated/models/attachment_upload_intent_data.rb +337 -0
- data/lib/sendmux_sending_generated/models/attachment_upload_intent_request.rb +279 -0
- data/lib/sendmux_sending_generated/models/attachment_upload_intent_response.rb +223 -0
- data/lib/sendmux_sending_generated/models/attachment_upload_response.rb +223 -0
- data/lib/sendmux_sending_generated/models/batch_result_item.rb +2 -2
- data/lib/sendmux_sending_generated/models/batch_send_request.rb +2 -2
- data/lib/sendmux_sending_generated/models/batch_send_success_data.rb +2 -2
- data/lib/sendmux_sending_generated/models/batch_send_success_response.rb +2 -2
- data/lib/sendmux_sending_generated/models/batch_summary.rb +2 -2
- data/lib/sendmux_sending_generated/models/email_send_request.rb +3 -3
- data/lib/sendmux_sending_generated/models/error_detail.rb +2 -2
- data/lib/sendmux_sending_generated/models/error_issue.rb +2 -2
- data/lib/sendmux_sending_generated/models/error_response.rb +2 -2
- data/lib/sendmux_sending_generated/models/inline_attachment.rb +274 -0
- data/lib/sendmux_sending_generated/models/meta.rb +2 -2
- data/lib/sendmux_sending_generated/models/recipient.rb +2 -2
- data/lib/sendmux_sending_generated/models/send_success_data.rb +2 -2
- data/lib/sendmux_sending_generated/models/send_success_response.rb +2 -2
- data/lib/sendmux_sending_generated/models/success_envelope.rb +2 -2
- data/lib/sendmux_sending_generated/models/uploaded_attachment_ref.rb +176 -0
- data/lib/sendmux_sending_generated/version.rb +2 -2
- data/lib/sendmux_sending_generated.rb +11 -2
- metadata +22 -6
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Sendmux Sending API
|
|
3
|
+
|
|
4
|
+
#Send emails programmatically via the Sendmux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
|
|
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::Sending::Generated
|
|
17
|
+
class AttachmentUploadData < ApiModelBase
|
|
18
|
+
# Temporary attachment ID to use in email attachments[].
|
|
19
|
+
attr_accessor :attachment_id
|
|
20
|
+
|
|
21
|
+
# Stored attachment MIME type
|
|
22
|
+
attr_accessor :content_type
|
|
23
|
+
|
|
24
|
+
# ISO timestamp when this temporary attachment reference expires.
|
|
25
|
+
attr_accessor :expires_at
|
|
26
|
+
|
|
27
|
+
# Stored attachment filename
|
|
28
|
+
attr_accessor :filename
|
|
29
|
+
|
|
30
|
+
# Stored attachment byte size
|
|
31
|
+
attr_accessor :size_bytes
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'attachment_id' => :'attachment_id',
|
|
37
|
+
:'content_type' => :'content_type',
|
|
38
|
+
:'expires_at' => :'expires_at',
|
|
39
|
+
:'filename' => :'filename',
|
|
40
|
+
:'size_bytes' => :'size_bytes'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Returns attribute mapping this model knows about
|
|
45
|
+
def self.acceptable_attribute_map
|
|
46
|
+
attribute_map
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Returns all the JSON keys this model knows about
|
|
50
|
+
def self.acceptable_attributes
|
|
51
|
+
acceptable_attribute_map.values
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Attribute type mapping.
|
|
55
|
+
def self.openapi_types
|
|
56
|
+
{
|
|
57
|
+
:'attachment_id' => :'String',
|
|
58
|
+
:'content_type' => :'String',
|
|
59
|
+
:'expires_at' => :'Time',
|
|
60
|
+
:'filename' => :'String',
|
|
61
|
+
:'size_bytes' => :'Integer'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# List of attributes with nullable: true
|
|
66
|
+
def self.openapi_nullable
|
|
67
|
+
Set.new([
|
|
68
|
+
])
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Initializes the object
|
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
73
|
+
def initialize(attributes = {})
|
|
74
|
+
if (!attributes.is_a?(Hash))
|
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Sending::Generated::AttachmentUploadData` initialize method"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
79
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
81
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Sending::Generated::AttachmentUploadData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
83
|
+
end
|
|
84
|
+
h[k.to_sym] = v
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if attributes.key?(:'attachment_id')
|
|
88
|
+
self.attachment_id = attributes[:'attachment_id']
|
|
89
|
+
else
|
|
90
|
+
self.attachment_id = nil
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'content_type')
|
|
94
|
+
self.content_type = attributes[:'content_type']
|
|
95
|
+
else
|
|
96
|
+
self.content_type = nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'expires_at')
|
|
100
|
+
self.expires_at = attributes[:'expires_at']
|
|
101
|
+
else
|
|
102
|
+
self.expires_at = nil
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'filename')
|
|
106
|
+
self.filename = attributes[:'filename']
|
|
107
|
+
else
|
|
108
|
+
self.filename = nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'size_bytes')
|
|
112
|
+
self.size_bytes = attributes[:'size_bytes']
|
|
113
|
+
else
|
|
114
|
+
self.size_bytes = nil
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
119
|
+
# @return Array for valid properties with the reasons
|
|
120
|
+
def list_invalid_properties
|
|
121
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
122
|
+
invalid_properties = Array.new
|
|
123
|
+
if @attachment_id.nil?
|
|
124
|
+
invalid_properties.push('invalid value for "attachment_id", attachment_id cannot be nil.')
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
pattern = Regexp.new(/^att_[a-z0-9]{24}$/)
|
|
128
|
+
if @attachment_id !~ pattern
|
|
129
|
+
invalid_properties.push("invalid value for \"attachment_id\", must conform to the pattern #{pattern}.")
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if @content_type.nil?
|
|
133
|
+
invalid_properties.push('invalid value for "content_type", content_type cannot be nil.')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if @expires_at.nil?
|
|
137
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if @filename.nil?
|
|
141
|
+
invalid_properties.push('invalid value for "filename", filename cannot be nil.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if @size_bytes.nil?
|
|
145
|
+
invalid_properties.push('invalid value for "size_bytes", size_bytes cannot be nil.')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
invalid_properties
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Check to see if the all the properties in the model are valid
|
|
152
|
+
# @return true if the model is valid
|
|
153
|
+
def valid?
|
|
154
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
155
|
+
return false if @attachment_id.nil?
|
|
156
|
+
return false if @attachment_id !~ Regexp.new(/^att_[a-z0-9]{24}$/)
|
|
157
|
+
return false if @content_type.nil?
|
|
158
|
+
return false if @expires_at.nil?
|
|
159
|
+
return false if @filename.nil?
|
|
160
|
+
return false if @size_bytes.nil?
|
|
161
|
+
true
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Custom attribute writer method with validation
|
|
165
|
+
# @param [Object] attachment_id Value to be assigned
|
|
166
|
+
def attachment_id=(attachment_id)
|
|
167
|
+
if attachment_id.nil?
|
|
168
|
+
fail ArgumentError, 'attachment_id cannot be nil'
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
pattern = Regexp.new(/^att_[a-z0-9]{24}$/)
|
|
172
|
+
if attachment_id !~ pattern
|
|
173
|
+
fail ArgumentError, "invalid value for \"attachment_id\", must conform to the pattern #{pattern}."
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
@attachment_id = attachment_id
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Custom attribute writer method with validation
|
|
180
|
+
# @param [Object] content_type Value to be assigned
|
|
181
|
+
def content_type=(content_type)
|
|
182
|
+
if content_type.nil?
|
|
183
|
+
fail ArgumentError, 'content_type cannot be nil'
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
@content_type = content_type
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Custom attribute writer method with validation
|
|
190
|
+
# @param [Object] expires_at Value to be assigned
|
|
191
|
+
def expires_at=(expires_at)
|
|
192
|
+
if expires_at.nil?
|
|
193
|
+
fail ArgumentError, 'expires_at cannot be nil'
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
@expires_at = expires_at
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Custom attribute writer method with validation
|
|
200
|
+
# @param [Object] filename Value to be assigned
|
|
201
|
+
def filename=(filename)
|
|
202
|
+
if filename.nil?
|
|
203
|
+
fail ArgumentError, 'filename cannot be nil'
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
@filename = filename
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Custom attribute writer method with validation
|
|
210
|
+
# @param [Object] size_bytes Value to be assigned
|
|
211
|
+
def size_bytes=(size_bytes)
|
|
212
|
+
if size_bytes.nil?
|
|
213
|
+
fail ArgumentError, 'size_bytes cannot be nil'
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
@size_bytes = size_bytes
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Checks equality by comparing each attribute.
|
|
220
|
+
# @param [Object] Object to be compared
|
|
221
|
+
def ==(o)
|
|
222
|
+
return true if self.equal?(o)
|
|
223
|
+
self.class == o.class &&
|
|
224
|
+
attachment_id == o.attachment_id &&
|
|
225
|
+
content_type == o.content_type &&
|
|
226
|
+
expires_at == o.expires_at &&
|
|
227
|
+
filename == o.filename &&
|
|
228
|
+
size_bytes == o.size_bytes
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# @see the `==` method
|
|
232
|
+
# @param [Object] Object to be compared
|
|
233
|
+
def eql?(o)
|
|
234
|
+
self == o
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Calculates hash code according to all attributes.
|
|
238
|
+
# @return [Integer] Hash code
|
|
239
|
+
def hash
|
|
240
|
+
[attachment_id, content_type, expires_at, filename, size_bytes].hash
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Builds the object from hash
|
|
244
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
245
|
+
# @return [Object] Returns the model itself
|
|
246
|
+
def self.build_from_hash(attributes)
|
|
247
|
+
return nil unless attributes.is_a?(Hash)
|
|
248
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
249
|
+
transformed_hash = {}
|
|
250
|
+
openapi_types.each_pair do |key, type|
|
|
251
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
252
|
+
transformed_hash["#{key}"] = nil
|
|
253
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
254
|
+
# check to ensure the input is an array given that the attribute
|
|
255
|
+
# is documented as an array but the input is not
|
|
256
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
257
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
258
|
+
end
|
|
259
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
260
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
new(transformed_hash)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Returns the object in the form of hash
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_hash
|
|
269
|
+
hash = {}
|
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
271
|
+
value = self.send(attr)
|
|
272
|
+
if value.nil?
|
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
hash[param] = _to_hash(value)
|
|
278
|
+
end
|
|
279
|
+
hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
end
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Sendmux Sending API
|
|
3
|
+
|
|
4
|
+
#Send emails programmatically via the Sendmux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
|
|
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::Sending::Generated
|
|
17
|
+
class AttachmentUploadIntentData < ApiModelBase
|
|
18
|
+
# ISO timestamp when the upload URL expires.
|
|
19
|
+
attr_accessor :expires_at
|
|
20
|
+
|
|
21
|
+
# Headers that must be sent with the PUT upload request.
|
|
22
|
+
attr_accessor :headers
|
|
23
|
+
|
|
24
|
+
# Maximum upload size in bytes
|
|
25
|
+
attr_accessor :max_size_bytes
|
|
26
|
+
|
|
27
|
+
# HTTP method for upload_url
|
|
28
|
+
attr_accessor :method
|
|
29
|
+
|
|
30
|
+
# Temporary upload intent ID.
|
|
31
|
+
attr_accessor :upload_id
|
|
32
|
+
|
|
33
|
+
# Short-lived URL that accepts a binary PUT with the returned headers.
|
|
34
|
+
attr_accessor :upload_url
|
|
35
|
+
|
|
36
|
+
class EnumAttributeValidator
|
|
37
|
+
attr_reader :datatype
|
|
38
|
+
attr_reader :allowable_values
|
|
39
|
+
|
|
40
|
+
def initialize(datatype, allowable_values)
|
|
41
|
+
@allowable_values = allowable_values.map do |value|
|
|
42
|
+
case datatype.to_s
|
|
43
|
+
when /Integer/i
|
|
44
|
+
value.to_i
|
|
45
|
+
when /Float/i
|
|
46
|
+
value.to_f
|
|
47
|
+
else
|
|
48
|
+
value
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def valid?(value)
|
|
54
|
+
!value || allowable_values.include?(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
59
|
+
def self.attribute_map
|
|
60
|
+
{
|
|
61
|
+
:'expires_at' => :'expires_at',
|
|
62
|
+
:'headers' => :'headers',
|
|
63
|
+
:'max_size_bytes' => :'max_size_bytes',
|
|
64
|
+
:'method' => :'method',
|
|
65
|
+
:'upload_id' => :'upload_id',
|
|
66
|
+
:'upload_url' => :'upload_url'
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Returns attribute mapping this model knows about
|
|
71
|
+
def self.acceptable_attribute_map
|
|
72
|
+
attribute_map
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Returns all the JSON keys this model knows about
|
|
76
|
+
def self.acceptable_attributes
|
|
77
|
+
acceptable_attribute_map.values
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Attribute type mapping.
|
|
81
|
+
def self.openapi_types
|
|
82
|
+
{
|
|
83
|
+
:'expires_at' => :'Time',
|
|
84
|
+
:'headers' => :'Hash<String, String>',
|
|
85
|
+
:'max_size_bytes' => :'Integer',
|
|
86
|
+
:'method' => :'String',
|
|
87
|
+
:'upload_id' => :'String',
|
|
88
|
+
:'upload_url' => :'String'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# List of attributes with nullable: true
|
|
93
|
+
def self.openapi_nullable
|
|
94
|
+
Set.new([
|
|
95
|
+
])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Initializes the object
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
def initialize(attributes = {})
|
|
101
|
+
if (!attributes.is_a?(Hash))
|
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Sending::Generated::AttachmentUploadIntentData` initialize method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
106
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
108
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Sending::Generated::AttachmentUploadIntentData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
110
|
+
end
|
|
111
|
+
h[k.to_sym] = v
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'expires_at')
|
|
115
|
+
self.expires_at = attributes[:'expires_at']
|
|
116
|
+
else
|
|
117
|
+
self.expires_at = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'headers')
|
|
121
|
+
if (value = attributes[:'headers']).is_a?(Hash)
|
|
122
|
+
self.headers = value
|
|
123
|
+
end
|
|
124
|
+
else
|
|
125
|
+
self.headers = nil
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'max_size_bytes')
|
|
129
|
+
self.max_size_bytes = attributes[:'max_size_bytes']
|
|
130
|
+
else
|
|
131
|
+
self.max_size_bytes = nil
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'method')
|
|
135
|
+
self.method = attributes[:'method']
|
|
136
|
+
else
|
|
137
|
+
self.method = nil
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'upload_id')
|
|
141
|
+
self.upload_id = attributes[:'upload_id']
|
|
142
|
+
else
|
|
143
|
+
self.upload_id = nil
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'upload_url')
|
|
147
|
+
self.upload_url = attributes[:'upload_url']
|
|
148
|
+
else
|
|
149
|
+
self.upload_url = nil
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
154
|
+
# @return Array for valid properties with the reasons
|
|
155
|
+
def list_invalid_properties
|
|
156
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
157
|
+
invalid_properties = Array.new
|
|
158
|
+
if @expires_at.nil?
|
|
159
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if @headers.nil?
|
|
163
|
+
invalid_properties.push('invalid value for "headers", headers cannot be nil.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if @max_size_bytes.nil?
|
|
167
|
+
invalid_properties.push('invalid value for "max_size_bytes", max_size_bytes cannot be nil.')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if @method.nil?
|
|
171
|
+
invalid_properties.push('invalid value for "method", method cannot be nil.')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if @upload_id.nil?
|
|
175
|
+
invalid_properties.push('invalid value for "upload_id", upload_id cannot be nil.')
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
pattern = Regexp.new(/^upl_[a-z0-9]{24}$/)
|
|
179
|
+
if @upload_id !~ pattern
|
|
180
|
+
invalid_properties.push("invalid value for \"upload_id\", must conform to the pattern #{pattern}.")
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if @upload_url.nil?
|
|
184
|
+
invalid_properties.push('invalid value for "upload_url", upload_url cannot be nil.')
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
invalid_properties
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Check to see if the all the properties in the model are valid
|
|
191
|
+
# @return true if the model is valid
|
|
192
|
+
def valid?
|
|
193
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
194
|
+
return false if @expires_at.nil?
|
|
195
|
+
return false if @headers.nil?
|
|
196
|
+
return false if @max_size_bytes.nil?
|
|
197
|
+
return false if @method.nil?
|
|
198
|
+
method_validator = EnumAttributeValidator.new('String', ["PUT", "unknown_default_open_api"])
|
|
199
|
+
return false unless method_validator.valid?(@method)
|
|
200
|
+
return false if @upload_id.nil?
|
|
201
|
+
return false if @upload_id !~ Regexp.new(/^upl_[a-z0-9]{24}$/)
|
|
202
|
+
return false if @upload_url.nil?
|
|
203
|
+
true
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Custom attribute writer method with validation
|
|
207
|
+
# @param [Object] expires_at Value to be assigned
|
|
208
|
+
def expires_at=(expires_at)
|
|
209
|
+
if expires_at.nil?
|
|
210
|
+
fail ArgumentError, 'expires_at cannot be nil'
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
@expires_at = expires_at
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Custom attribute writer method with validation
|
|
217
|
+
# @param [Object] headers Value to be assigned
|
|
218
|
+
def headers=(headers)
|
|
219
|
+
if headers.nil?
|
|
220
|
+
fail ArgumentError, 'headers cannot be nil'
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
@headers = headers
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Custom attribute writer method with validation
|
|
227
|
+
# @param [Object] max_size_bytes Value to be assigned
|
|
228
|
+
def max_size_bytes=(max_size_bytes)
|
|
229
|
+
if max_size_bytes.nil?
|
|
230
|
+
fail ArgumentError, 'max_size_bytes cannot be nil'
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
@max_size_bytes = max_size_bytes
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
237
|
+
# @param [Object] method Object to be assigned
|
|
238
|
+
def method=(method)
|
|
239
|
+
validator = EnumAttributeValidator.new('String', ["PUT", "unknown_default_open_api"])
|
|
240
|
+
unless validator.valid?(method)
|
|
241
|
+
fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
|
|
242
|
+
end
|
|
243
|
+
@method = method
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Custom attribute writer method with validation
|
|
247
|
+
# @param [Object] upload_id Value to be assigned
|
|
248
|
+
def upload_id=(upload_id)
|
|
249
|
+
if upload_id.nil?
|
|
250
|
+
fail ArgumentError, 'upload_id cannot be nil'
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
pattern = Regexp.new(/^upl_[a-z0-9]{24}$/)
|
|
254
|
+
if upload_id !~ pattern
|
|
255
|
+
fail ArgumentError, "invalid value for \"upload_id\", must conform to the pattern #{pattern}."
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
@upload_id = upload_id
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Custom attribute writer method with validation
|
|
262
|
+
# @param [Object] upload_url Value to be assigned
|
|
263
|
+
def upload_url=(upload_url)
|
|
264
|
+
if upload_url.nil?
|
|
265
|
+
fail ArgumentError, 'upload_url cannot be nil'
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
@upload_url = upload_url
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Checks equality by comparing each attribute.
|
|
272
|
+
# @param [Object] Object to be compared
|
|
273
|
+
def ==(o)
|
|
274
|
+
return true if self.equal?(o)
|
|
275
|
+
self.class == o.class &&
|
|
276
|
+
expires_at == o.expires_at &&
|
|
277
|
+
headers == o.headers &&
|
|
278
|
+
max_size_bytes == o.max_size_bytes &&
|
|
279
|
+
method == o.method &&
|
|
280
|
+
upload_id == o.upload_id &&
|
|
281
|
+
upload_url == o.upload_url
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# @see the `==` method
|
|
285
|
+
# @param [Object] Object to be compared
|
|
286
|
+
def eql?(o)
|
|
287
|
+
self == o
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Calculates hash code according to all attributes.
|
|
291
|
+
# @return [Integer] Hash code
|
|
292
|
+
def hash
|
|
293
|
+
[expires_at, headers, max_size_bytes, method, upload_id, upload_url].hash
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Builds the object from hash
|
|
297
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
298
|
+
# @return [Object] Returns the model itself
|
|
299
|
+
def self.build_from_hash(attributes)
|
|
300
|
+
return nil unless attributes.is_a?(Hash)
|
|
301
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
302
|
+
transformed_hash = {}
|
|
303
|
+
openapi_types.each_pair do |key, type|
|
|
304
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
305
|
+
transformed_hash["#{key}"] = nil
|
|
306
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
307
|
+
# check to ensure the input is an array given that the attribute
|
|
308
|
+
# is documented as an array but the input is not
|
|
309
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
310
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
311
|
+
end
|
|
312
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
313
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
new(transformed_hash)
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Returns the object in the form of hash
|
|
320
|
+
# @return [Hash] Returns the object in the form of hash
|
|
321
|
+
def to_hash
|
|
322
|
+
hash = {}
|
|
323
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
324
|
+
value = self.send(attr)
|
|
325
|
+
if value.nil?
|
|
326
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
327
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
hash[param] = _to_hash(value)
|
|
331
|
+
end
|
|
332
|
+
hash
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
end
|