qubrics-sending 2.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 (46) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +57 -0
  3. data/LICENSE +21 -0
  4. data/README.md +112 -0
  5. data/lib/qubrics/sending/client.rb +71 -0
  6. data/lib/qubrics/sending/version.rb +7 -0
  7. data/lib/qubrics/sending.rb +12 -0
  8. data/lib/qubrics_sending_generated/api/attachments_api.rb +373 -0
  9. data/lib/qubrics_sending_generated/api/emails_api.rb +172 -0
  10. data/lib/qubrics_sending_generated/api/meta_api.rb +142 -0
  11. data/lib/qubrics_sending_generated/api_client.rb +447 -0
  12. data/lib/qubrics_sending_generated/api_error.rb +58 -0
  13. data/lib/qubrics_sending_generated/api_model_base.rb +95 -0
  14. data/lib/qubrics_sending_generated/configuration.rb +413 -0
  15. data/lib/qubrics_sending_generated/models/address.rb +215 -0
  16. data/lib/qubrics_sending_generated/models/attachment.rb +103 -0
  17. data/lib/qubrics_sending_generated/models/attachment_upload_data.rb +284 -0
  18. data/lib/qubrics_sending_generated/models/attachment_upload_intent_data.rb +337 -0
  19. data/lib/qubrics_sending_generated/models/attachment_upload_intent_request.rb +279 -0
  20. data/lib/qubrics_sending_generated/models/attachment_upload_intent_response.rb +223 -0
  21. data/lib/qubrics_sending_generated/models/attachment_upload_response.rb +223 -0
  22. data/lib/qubrics_sending_generated/models/batch_result_item.rb +256 -0
  23. data/lib/qubrics_sending_generated/models/batch_send_request.rb +185 -0
  24. data/lib/qubrics_sending_generated/models/batch_send_success_data.rb +192 -0
  25. data/lib/qubrics_sending_generated/models/batch_send_success_response.rb +223 -0
  26. data/lib/qubrics_sending_generated/models/batch_summary.rb +219 -0
  27. data/lib/qubrics_sending_generated/models/connection.rb +273 -0
  28. data/lib/qubrics_sending_generated/models/connection_credential.rb +226 -0
  29. data/lib/qubrics_sending_generated/models/connection_mailboxes_inner.rb +190 -0
  30. data/lib/qubrics_sending_generated/models/connection_response.rb +223 -0
  31. data/lib/qubrics_sending_generated/models/connection_team.rb +190 -0
  32. data/lib/qubrics_sending_generated/models/email_send_request.rb +474 -0
  33. data/lib/qubrics_sending_generated/models/email_send_request_delivery_group.rb +105 -0
  34. data/lib/qubrics_sending_generated/models/error_detail.rb +251 -0
  35. data/lib/qubrics_sending_generated/models/error_issue.rb +219 -0
  36. data/lib/qubrics_sending_generated/models/error_response.rb +216 -0
  37. data/lib/qubrics_sending_generated/models/inline_attachment.rb +274 -0
  38. data/lib/qubrics_sending_generated/models/meta.rb +165 -0
  39. data/lib/qubrics_sending_generated/models/recipient.rb +214 -0
  40. data/lib/qubrics_sending_generated/models/send_success_data.rb +227 -0
  41. data/lib/qubrics_sending_generated/models/send_success_response.rb +223 -0
  42. data/lib/qubrics_sending_generated/models/success_envelope.rb +190 -0
  43. data/lib/qubrics_sending_generated/models/uploaded_attachment_ref.rb +176 -0
  44. data/lib/qubrics_sending_generated/version.rb +15 -0
  45. data/lib/qubrics_sending_generated.rb +72 -0
  46. metadata +168 -0
@@ -0,0 +1,474 @@
1
+ =begin
2
+ #Qubrics Sending API
3
+
4
+ #Send emails programmatically via the Qubrics 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 Qubrics::Sending::Generated
17
+ class EmailSendRequest < ApiModelBase
18
+ # File attachments (max 10). Use attachment_id refs for uploaded files.
19
+ attr_accessor :attachments
20
+
21
+ # BCC recipients (subject to 50 total To, CC, and BCC recipients)
22
+ attr_accessor :bcc
23
+
24
+ # CC recipients (subject to 50 total To, CC, and BCC recipients)
25
+ attr_accessor :cc
26
+
27
+ # Custom X-* headers to include in the email
28
+ attr_accessor :custom_headers
29
+
30
+ attr_accessor :delivery_group
31
+
32
+ attr_accessor :from
33
+
34
+ # HTML email content (max 25MB)
35
+ attr_accessor :html_body
36
+
37
+ # Reply-To address
38
+ attr_accessor :reply_to
39
+
40
+ # Envelope sender for VERP support
41
+ attr_accessor :return_path
42
+
43
+ # Email subject line (max 998 chars, RFC 5322)
44
+ attr_accessor :subject
45
+
46
+ # Plain text alternative (max 25MB)
47
+ attr_accessor :text_body
48
+
49
+ # Primary recipient
50
+ attr_accessor :to
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'attachments' => :'attachments',
56
+ :'bcc' => :'bcc',
57
+ :'cc' => :'cc',
58
+ :'custom_headers' => :'custom_headers',
59
+ :'delivery_group' => :'delivery_group',
60
+ :'from' => :'from',
61
+ :'html_body' => :'html_body',
62
+ :'reply_to' => :'reply_to',
63
+ :'return_path' => :'return_path',
64
+ :'subject' => :'subject',
65
+ :'text_body' => :'text_body',
66
+ :'to' => :'to'
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
+ :'attachments' => :'Array<Attachment>',
84
+ :'bcc' => :'Array<Recipient>',
85
+ :'cc' => :'Array<Recipient>',
86
+ :'custom_headers' => :'Hash<String, String>',
87
+ :'delivery_group' => :'EmailSendRequestDeliveryGroup',
88
+ :'from' => :'Address',
89
+ :'html_body' => :'String',
90
+ :'reply_to' => :'Address',
91
+ :'return_path' => :'String',
92
+ :'subject' => :'String',
93
+ :'text_body' => :'String',
94
+ :'to' => :'Address'
95
+ }
96
+ end
97
+
98
+ # List of attributes with nullable: true
99
+ def self.openapi_nullable
100
+ Set.new([
101
+ ])
102
+ end
103
+
104
+ # Initializes the object
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ def initialize(attributes = {})
107
+ if (!attributes.is_a?(Hash))
108
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Qubrics::Sending::Generated::EmailSendRequest` initialize method"
109
+ end
110
+
111
+ # check to see if the attribute exists and convert string to symbol for hash key
112
+ acceptable_attribute_map = self.class.acceptable_attribute_map
113
+ attributes = attributes.each_with_object({}) { |(k, v), h|
114
+ if (!acceptable_attribute_map.key?(k.to_sym))
115
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Qubrics::Sending::Generated::EmailSendRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
116
+ end
117
+ h[k.to_sym] = v
118
+ }
119
+
120
+ if attributes.key?(:'attachments')
121
+ if (value = attributes[:'attachments']).is_a?(Array)
122
+ self.attachments = value
123
+ end
124
+ end
125
+
126
+ if attributes.key?(:'bcc')
127
+ if (value = attributes[:'bcc']).is_a?(Array)
128
+ self.bcc = value
129
+ end
130
+ end
131
+
132
+ if attributes.key?(:'cc')
133
+ if (value = attributes[:'cc']).is_a?(Array)
134
+ self.cc = value
135
+ end
136
+ end
137
+
138
+ if attributes.key?(:'custom_headers')
139
+ if (value = attributes[:'custom_headers']).is_a?(Hash)
140
+ self.custom_headers = value
141
+ end
142
+ end
143
+
144
+ if attributes.key?(:'delivery_group')
145
+ self.delivery_group = attributes[:'delivery_group']
146
+ end
147
+
148
+ if attributes.key?(:'from')
149
+ self.from = attributes[:'from']
150
+ else
151
+ self.from = nil
152
+ end
153
+
154
+ if attributes.key?(:'html_body')
155
+ self.html_body = attributes[:'html_body']
156
+ else
157
+ self.html_body = nil
158
+ end
159
+
160
+ if attributes.key?(:'reply_to')
161
+ self.reply_to = attributes[:'reply_to']
162
+ end
163
+
164
+ if attributes.key?(:'return_path')
165
+ self.return_path = attributes[:'return_path']
166
+ end
167
+
168
+ if attributes.key?(:'subject')
169
+ self.subject = attributes[:'subject']
170
+ else
171
+ self.subject = nil
172
+ end
173
+
174
+ if attributes.key?(:'text_body')
175
+ self.text_body = attributes[:'text_body']
176
+ end
177
+
178
+ if attributes.key?(:'to')
179
+ self.to = attributes[:'to']
180
+ else
181
+ self.to = nil
182
+ end
183
+ end
184
+
185
+ # Show invalid properties with the reasons. Usually used together with valid?
186
+ # @return Array for valid properties with the reasons
187
+ def list_invalid_properties
188
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
189
+ invalid_properties = Array.new
190
+ if !@attachments.nil? && @attachments.length > 10
191
+ invalid_properties.push('invalid value for "attachments", number of items must be less than or equal to 10.')
192
+ end
193
+
194
+ if !@bcc.nil? && @bcc.length > 49
195
+ invalid_properties.push('invalid value for "bcc", number of items must be less than or equal to 49.')
196
+ end
197
+
198
+ if !@cc.nil? && @cc.length > 49
199
+ invalid_properties.push('invalid value for "cc", number of items must be less than or equal to 49.')
200
+ end
201
+
202
+ if @from.nil?
203
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
204
+ end
205
+
206
+ if @html_body.nil?
207
+ invalid_properties.push('invalid value for "html_body", html_body cannot be nil.')
208
+ end
209
+
210
+ if @html_body.to_s.length > 26214400
211
+ invalid_properties.push('invalid value for "html_body", the character length must be smaller than or equal to 26214400.')
212
+ end
213
+
214
+ if @html_body.to_s.length < 1
215
+ invalid_properties.push('invalid value for "html_body", the character length must be greater than or equal to 1.')
216
+ end
217
+
218
+ if !@return_path.nil? && @return_path.to_s.length > 254
219
+ invalid_properties.push('invalid value for "return_path", the character length must be smaller than or equal to 254.')
220
+ end
221
+
222
+ if @subject.nil?
223
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
224
+ end
225
+
226
+ if @subject.to_s.length > 998
227
+ invalid_properties.push('invalid value for "subject", the character length must be smaller than or equal to 998.')
228
+ end
229
+
230
+ if @subject.to_s.length < 1
231
+ invalid_properties.push('invalid value for "subject", the character length must be greater than or equal to 1.')
232
+ end
233
+
234
+ pattern = Regexp.new(/^[^\r\n]*$/)
235
+ if @subject !~ pattern
236
+ invalid_properties.push("invalid value for \"subject\", must conform to the pattern #{pattern}.")
237
+ end
238
+
239
+ if !@text_body.nil? && @text_body.to_s.length > 26214400
240
+ invalid_properties.push('invalid value for "text_body", the character length must be smaller than or equal to 26214400.')
241
+ end
242
+
243
+ if @to.nil?
244
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
245
+ end
246
+
247
+ invalid_properties
248
+ end
249
+
250
+ # Check to see if the all the properties in the model are valid
251
+ # @return true if the model is valid
252
+ def valid?
253
+ warn '[DEPRECATED] the `valid?` method is obsolete'
254
+ return false if !@attachments.nil? && @attachments.length > 10
255
+ return false if !@bcc.nil? && @bcc.length > 49
256
+ return false if !@cc.nil? && @cc.length > 49
257
+ return false if @from.nil?
258
+ return false if @html_body.nil?
259
+ return false if @html_body.to_s.length > 26214400
260
+ return false if @html_body.to_s.length < 1
261
+ return false if !@return_path.nil? && @return_path.to_s.length > 254
262
+ return false if @subject.nil?
263
+ return false if @subject.to_s.length > 998
264
+ return false if @subject.to_s.length < 1
265
+ return false if @subject !~ Regexp.new(/^[^\r\n]*$/)
266
+ return false if !@text_body.nil? && @text_body.to_s.length > 26214400
267
+ return false if @to.nil?
268
+ true
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] attachments Value to be assigned
273
+ def attachments=(attachments)
274
+ if attachments.nil?
275
+ fail ArgumentError, 'attachments cannot be nil'
276
+ end
277
+
278
+ if attachments.length > 10
279
+ fail ArgumentError, 'invalid value for "attachments", number of items must be less than or equal to 10.'
280
+ end
281
+
282
+ @attachments = attachments
283
+ end
284
+
285
+ # Custom attribute writer method with validation
286
+ # @param [Object] bcc Value to be assigned
287
+ def bcc=(bcc)
288
+ if bcc.nil?
289
+ fail ArgumentError, 'bcc cannot be nil'
290
+ end
291
+
292
+ if bcc.length > 49
293
+ fail ArgumentError, 'invalid value for "bcc", number of items must be less than or equal to 49.'
294
+ end
295
+
296
+ @bcc = bcc
297
+ end
298
+
299
+ # Custom attribute writer method with validation
300
+ # @param [Object] cc Value to be assigned
301
+ def cc=(cc)
302
+ if cc.nil?
303
+ fail ArgumentError, 'cc cannot be nil'
304
+ end
305
+
306
+ if cc.length > 49
307
+ fail ArgumentError, 'invalid value for "cc", number of items must be less than or equal to 49.'
308
+ end
309
+
310
+ @cc = cc
311
+ end
312
+
313
+ # Custom attribute writer method with validation
314
+ # @param [Object] from Value to be assigned
315
+ def from=(from)
316
+ if from.nil?
317
+ fail ArgumentError, 'from cannot be nil'
318
+ end
319
+
320
+ @from = from
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] html_body Value to be assigned
325
+ def html_body=(html_body)
326
+ if html_body.nil?
327
+ fail ArgumentError, 'html_body cannot be nil'
328
+ end
329
+
330
+ if html_body.to_s.length > 26214400
331
+ fail ArgumentError, 'invalid value for "html_body", the character length must be smaller than or equal to 26214400.'
332
+ end
333
+
334
+ if html_body.to_s.length < 1
335
+ fail ArgumentError, 'invalid value for "html_body", the character length must be greater than or equal to 1.'
336
+ end
337
+
338
+ @html_body = html_body
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] return_path Value to be assigned
343
+ def return_path=(return_path)
344
+ if return_path.nil?
345
+ fail ArgumentError, 'return_path cannot be nil'
346
+ end
347
+
348
+ if return_path.to_s.length > 254
349
+ fail ArgumentError, 'invalid value for "return_path", the character length must be smaller than or equal to 254.'
350
+ end
351
+
352
+ @return_path = return_path
353
+ end
354
+
355
+ # Custom attribute writer method with validation
356
+ # @param [Object] subject Value to be assigned
357
+ def subject=(subject)
358
+ if subject.nil?
359
+ fail ArgumentError, 'subject cannot be nil'
360
+ end
361
+
362
+ if subject.to_s.length > 998
363
+ fail ArgumentError, 'invalid value for "subject", the character length must be smaller than or equal to 998.'
364
+ end
365
+
366
+ if subject.to_s.length < 1
367
+ fail ArgumentError, 'invalid value for "subject", the character length must be greater than or equal to 1.'
368
+ end
369
+
370
+ pattern = Regexp.new(/^[^\r\n]*$/)
371
+ if subject !~ pattern
372
+ fail ArgumentError, "invalid value for \"subject\", must conform to the pattern #{pattern}."
373
+ end
374
+
375
+ @subject = subject
376
+ end
377
+
378
+ # Custom attribute writer method with validation
379
+ # @param [Object] text_body Value to be assigned
380
+ def text_body=(text_body)
381
+ if text_body.nil?
382
+ fail ArgumentError, 'text_body cannot be nil'
383
+ end
384
+
385
+ if text_body.to_s.length > 26214400
386
+ fail ArgumentError, 'invalid value for "text_body", the character length must be smaller than or equal to 26214400.'
387
+ end
388
+
389
+ @text_body = text_body
390
+ end
391
+
392
+ # Custom attribute writer method with validation
393
+ # @param [Object] to Value to be assigned
394
+ def to=(to)
395
+ if to.nil?
396
+ fail ArgumentError, 'to cannot be nil'
397
+ end
398
+
399
+ @to = to
400
+ end
401
+
402
+ # Checks equality by comparing each attribute.
403
+ # @param [Object] Object to be compared
404
+ def ==(o)
405
+ return true if self.equal?(o)
406
+ self.class == o.class &&
407
+ attachments == o.attachments &&
408
+ bcc == o.bcc &&
409
+ cc == o.cc &&
410
+ custom_headers == o.custom_headers &&
411
+ delivery_group == o.delivery_group &&
412
+ from == o.from &&
413
+ html_body == o.html_body &&
414
+ reply_to == o.reply_to &&
415
+ return_path == o.return_path &&
416
+ subject == o.subject &&
417
+ text_body == o.text_body &&
418
+ to == o.to
419
+ end
420
+
421
+ # @see the `==` method
422
+ # @param [Object] Object to be compared
423
+ def eql?(o)
424
+ self == o
425
+ end
426
+
427
+ # Calculates hash code according to all attributes.
428
+ # @return [Integer] Hash code
429
+ def hash
430
+ [attachments, bcc, cc, custom_headers, delivery_group, from, html_body, reply_to, return_path, subject, text_body, to].hash
431
+ end
432
+
433
+ # Builds the object from hash
434
+ # @param [Hash] attributes Model attributes in the form of hash
435
+ # @return [Object] Returns the model itself
436
+ def self.build_from_hash(attributes)
437
+ return nil unless attributes.is_a?(Hash)
438
+ attributes = attributes.transform_keys(&:to_sym)
439
+ transformed_hash = {}
440
+ openapi_types.each_pair do |key, type|
441
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
442
+ transformed_hash["#{key}"] = nil
443
+ elsif type =~ /\AArray<(.*)>/i
444
+ # check to ensure the input is an array given that the attribute
445
+ # is documented as an array but the input is not
446
+ if attributes[attribute_map[key]].is_a?(Array)
447
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
448
+ end
449
+ elsif !attributes[attribute_map[key]].nil?
450
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
451
+ end
452
+ end
453
+ new(transformed_hash)
454
+ end
455
+
456
+ # Returns the object in the form of hash
457
+ # @return [Hash] Returns the object in the form of hash
458
+ def to_hash
459
+ hash = {}
460
+ self.class.attribute_map.each_pair do |attr, param|
461
+ value = self.send(attr)
462
+ if value.nil?
463
+ is_nullable = self.class.openapi_nullable.include?(attr)
464
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
465
+ end
466
+
467
+ hash[param] = _to_hash(value)
468
+ end
469
+ hash
470
+ end
471
+
472
+ end
473
+
474
+ end
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #Qubrics Sending API
3
+
4
+ #Send emails programmatically via the Qubrics 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 Qubrics::Sending::Generated
17
+ # One delivery group public ID or a non-empty array of up to 50 IDs
18
+ module EmailSendRequestDeliveryGroup
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'Array<String>',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ return find_and_cast_into_type(klass, data)
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = Qubrics::Sending::Generated.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end