braze_api_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/braze_api_client.gemspec +1 -1
  4. data/docs/RestApi.md +26 -26
  5. data/docs/UsersAliasNewResponse.md +20 -0
  6. data/docs/{IdentifierOneOf.md → UsersDeleteResponse.md} +4 -4
  7. data/docs/UsersExternalIdsRemoveResponse.md +22 -0
  8. data/docs/UsersExternalIdsRenameResponse.md +22 -0
  9. data/docs/UsersExternalIdsRenameResponseExternalIds.md +20 -0
  10. data/docs/UsersIdentifyResponse.md +20 -0
  11. data/lib/braze_api_client/api/rest_api.rb +25 -25
  12. data/lib/braze_api_client/api_client.rb +2 -2
  13. data/lib/braze_api_client/api_error.rb +1 -1
  14. data/lib/braze_api_client/configuration.rb +1 -1
  15. data/lib/braze_api_client/models/general_error.rb +1 -1
  16. data/lib/braze_api_client/models/{attributes_array.rb → users_alias_new_response.rb} +20 -18
  17. data/lib/braze_api_client/models/{events_array.rb → users_delete_response.rb} +11 -13
  18. data/lib/braze_api_client/models/{users_track_request.rb → users_external_ids_remove_response.rb} +32 -37
  19. data/lib/braze_api_client/models/{attributes_push_tokens.rb → users_external_ids_rename_response.rb} +27 -33
  20. data/lib/braze_api_client/models/{attributes_facebook.rb → users_external_ids_rename_response_external_ids.rb} +17 -28
  21. data/lib/braze_api_client/models/{attributes_current_location.rb → users_identify_response.rb} +17 -17
  22. data/lib/braze_api_client/models/users_track_response.rb +1 -1
  23. data/lib/braze_api_client/version.rb +2 -2
  24. data/lib/braze_api_client.rb +7 -14
  25. data/spec/api/rest_api_spec.rb +7 -7
  26. data/spec/api_client_spec.rb +1 -1
  27. data/spec/configuration_spec.rb +1 -1
  28. data/spec/models/general_error_spec.rb +1 -1
  29. data/spec/models/{attributes_current_location_spec.rb → users_alias_new_response_spec.rb} +9 -9
  30. data/spec/models/{identifier_one_of2_spec.rb → users_delete_response_spec.rb} +8 -8
  31. data/spec/models/{attributes_facebook_spec.rb → users_external_ids_remove_response_spec.rb} +10 -10
  32. data/spec/models/users_external_ids_rename_response_external_ids_spec.rb +40 -0
  33. data/spec/models/{attributes_push_tokens_spec.rb → users_external_ids_rename_response_spec.rb} +10 -10
  34. data/spec/models/users_identify_response_spec.rb +40 -0
  35. data/spec/models/users_track_response_spec.rb +1 -1
  36. data/spec/spec_helper.rb +1 -1
  37. metadata +26 -54
  38. data/docs/Attributes.md +0 -58
  39. data/docs/AttributesArray.md +0 -18
  40. data/docs/AttributesCurrentLocation.md +0 -20
  41. data/docs/AttributesFacebook.md +0 -22
  42. data/docs/AttributesPushTokens.md +0 -22
  43. data/docs/AttributesTwitter.md +0 -26
  44. data/docs/Event.md +0 -26
  45. data/docs/EventsArray.md +0 -18
  46. data/docs/Identifier.md +0 -51
  47. data/docs/IdentifierOneOf1.md +0 -18
  48. data/docs/IdentifierOneOf2.md +0 -18
  49. data/docs/UsersTrackRequest.md +0 -18
  50. data/lib/braze_api_client/models/attributes.rb +0 -458
  51. data/lib/braze_api_client/models/attributes_twitter.rb +0 -254
  52. data/lib/braze_api_client/models/event.rb +0 -264
  53. data/lib/braze_api_client/models/identifier.rb +0 -106
  54. data/lib/braze_api_client/models/identifier_one_of.rb +0 -223
  55. data/lib/braze_api_client/models/identifier_one_of1.rb +0 -223
  56. data/lib/braze_api_client/models/identifier_one_of2.rb +0 -223
  57. data/spec/models/attributes_array_spec.rb +0 -34
  58. data/spec/models/attributes_spec.rb +0 -166
  59. data/spec/models/attributes_twitter_spec.rb +0 -58
  60. data/spec/models/event_spec.rb +0 -58
  61. data/spec/models/events_array_spec.rb +0 -34
  62. data/spec/models/identifier_one_of1_spec.rb +0 -34
  63. data/spec/models/identifier_one_of_spec.rb +0 -34
  64. data/spec/models/identifier_spec.rb +0 -31
  65. data/spec/models/users_track_request_spec.rb +0 -34
@@ -1,254 +0,0 @@
1
- =begin
2
- #Braze
3
-
4
- #Track users, send messages, export data, and more
5
-
6
- The version of the OpenAPI document: 0.1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.1
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module BrazeClient
17
- class AttributesTwitter
18
- attr_accessor :id
19
-
20
- attr_accessor :screen_name
21
-
22
- attr_accessor :followers_count
23
-
24
- attr_accessor :friends_count
25
-
26
- attr_accessor :statuses_count
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'id' => :'id',
32
- :'screen_name' => :'screen_name',
33
- :'followers_count' => :'followers_count',
34
- :'friends_count' => :'friends_count',
35
- :'statuses_count' => :'statuses_count'
36
- }
37
- end
38
-
39
- # Returns all the JSON keys this model knows about
40
- def self.acceptable_attributes
41
- attribute_map.values
42
- end
43
-
44
- # Attribute type mapping.
45
- def self.openapi_types
46
- {
47
- :'id' => :'Integer',
48
- :'screen_name' => :'String',
49
- :'followers_count' => :'Integer',
50
- :'friends_count' => :'Integer',
51
- :'statuses_count' => :'Integer'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::AttributesTwitter` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::AttributesTwitter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
- end
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:'id')
77
- self.id = attributes[:'id']
78
- end
79
-
80
- if attributes.key?(:'screen_name')
81
- self.screen_name = attributes[:'screen_name']
82
- end
83
-
84
- if attributes.key?(:'followers_count')
85
- self.followers_count = attributes[:'followers_count']
86
- end
87
-
88
- if attributes.key?(:'friends_count')
89
- self.friends_count = attributes[:'friends_count']
90
- end
91
-
92
- if attributes.key?(:'statuses_count')
93
- self.statuses_count = attributes[:'statuses_count']
94
- end
95
- end
96
-
97
- # Show invalid properties with the reasons. Usually used together with valid?
98
- # @return Array for valid properties with the reasons
99
- def list_invalid_properties
100
- invalid_properties = Array.new
101
- invalid_properties
102
- end
103
-
104
- # Check to see if the all the properties in the model are valid
105
- # @return true if the model is valid
106
- def valid?
107
- true
108
- end
109
-
110
- # Checks equality by comparing each attribute.
111
- # @param [Object] Object to be compared
112
- def ==(o)
113
- return true if self.equal?(o)
114
- self.class == o.class &&
115
- id == o.id &&
116
- screen_name == o.screen_name &&
117
- followers_count == o.followers_count &&
118
- friends_count == o.friends_count &&
119
- statuses_count == o.statuses_count
120
- end
121
-
122
- # @see the `==` method
123
- # @param [Object] Object to be compared
124
- def eql?(o)
125
- self == o
126
- end
127
-
128
- # Calculates hash code according to all attributes.
129
- # @return [Integer] Hash code
130
- def hash
131
- [id, screen_name, followers_count, friends_count, statuses_count].hash
132
- end
133
-
134
- # Builds the object from hash
135
- # @param [Hash] attributes Model attributes in the form of hash
136
- # @return [Object] Returns the model itself
137
- def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def build_from_hash(attributes)
145
- return nil unless attributes.is_a?(Hash)
146
- self.class.openapi_types.each_pair do |key, type|
147
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
148
- self.send("#{key}=", nil)
149
- elsif type =~ /\AArray<(.*)>/i
150
- # check to ensure the input is an array given that the attribute
151
- # is documented as an array but the input is not
152
- if attributes[self.class.attribute_map[key]].is_a?(Array)
153
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
- end
155
- elsif !attributes[self.class.attribute_map[key]].nil?
156
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
- end
158
- end
159
-
160
- self
161
- end
162
-
163
- # Deserializes the data based on type
164
- # @param string type Data type
165
- # @param string value Value to be deserialized
166
- # @return [Object] Deserialized data
167
- def _deserialize(type, value)
168
- case type.to_sym
169
- when :Time
170
- Time.parse(value)
171
- when :Date
172
- Date.parse(value)
173
- when :String
174
- value.to_s
175
- when :Integer
176
- value.to_i
177
- when :Float
178
- value.to_f
179
- when :Boolean
180
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
- true
182
- else
183
- false
184
- end
185
- when :Object
186
- # generic object (usually a Hash), return directly
187
- value
188
- when /\AArray<(?<inner_type>.+)>\z/
189
- inner_type = Regexp.last_match[:inner_type]
190
- value.map { |v| _deserialize(inner_type, v) }
191
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
- k_type = Regexp.last_match[:k_type]
193
- v_type = Regexp.last_match[:v_type]
194
- {}.tap do |hash|
195
- value.each do |k, v|
196
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
- end
198
- end
199
- else # model
200
- # models (e.g. Pet) or oneOf
201
- klass = BrazeClient.const_get(type)
202
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
- end
204
- end
205
-
206
- # Returns the string representation of the object
207
- # @return [String] String presentation of the object
208
- def to_s
209
- to_hash.to_s
210
- end
211
-
212
- # to_body is an alias to to_hash (backward compatibility)
213
- # @return [Hash] Returns the object in the form of hash
214
- def to_body
215
- to_hash
216
- end
217
-
218
- # Returns the object in the form of hash
219
- # @return [Hash] Returns the object in the form of hash
220
- def to_hash
221
- hash = {}
222
- self.class.attribute_map.each_pair do |attr, param|
223
- value = self.send(attr)
224
- if value.nil?
225
- is_nullable = self.class.openapi_nullable.include?(attr)
226
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
- end
228
-
229
- hash[param] = _to_hash(value)
230
- end
231
- hash
232
- end
233
-
234
- # Outputs non-array value in the form of hash
235
- # For object, use to_hash. Otherwise, just return the value
236
- # @param [Object] value Any valid value
237
- # @return [Hash] Returns the value in the form of hash
238
- def _to_hash(value)
239
- if value.is_a?(Array)
240
- value.compact.map { |v| _to_hash(v) }
241
- elsif value.is_a?(Hash)
242
- {}.tap do |hash|
243
- value.each { |k, v| hash[k] = _to_hash(v) }
244
- end
245
- elsif value.respond_to? :to_hash
246
- value.to_hash
247
- else
248
- value
249
- end
250
- end
251
-
252
- end
253
-
254
- end
@@ -1,264 +0,0 @@
1
- =begin
2
- #Braze
3
-
4
- #Track users, send messages, export data, and more
5
-
6
- The version of the OpenAPI document: 0.1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.1
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module BrazeClient
17
- class Event
18
- attr_accessor :name
19
-
20
- attr_accessor :time
21
-
22
- attr_accessor :app_id
23
-
24
- attr_accessor :properties
25
-
26
- attr_accessor :_update_existing_only
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'name' => :'name',
32
- :'time' => :'time',
33
- :'app_id' => :'app_id',
34
- :'properties' => :'properties',
35
- :'_update_existing_only' => :'_update_existing_only'
36
- }
37
- end
38
-
39
- # Returns all the JSON keys this model knows about
40
- def self.acceptable_attributes
41
- attribute_map.values
42
- end
43
-
44
- # Attribute type mapping.
45
- def self.openapi_types
46
- {
47
- :'name' => :'String',
48
- :'time' => :'Time',
49
- :'app_id' => :'String',
50
- :'properties' => :'Object',
51
- :'_update_existing_only' => :'Boolean'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::Event` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
- end
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:'name')
77
- self.name = attributes[:'name']
78
- end
79
-
80
- if attributes.key?(:'time')
81
- self.time = attributes[:'time']
82
- end
83
-
84
- if attributes.key?(:'app_id')
85
- self.app_id = attributes[:'app_id']
86
- end
87
-
88
- if attributes.key?(:'properties')
89
- self.properties = attributes[:'properties']
90
- end
91
-
92
- if attributes.key?(:'_update_existing_only')
93
- self._update_existing_only = attributes[:'_update_existing_only']
94
- end
95
- end
96
-
97
- # Show invalid properties with the reasons. Usually used together with valid?
98
- # @return Array for valid properties with the reasons
99
- def list_invalid_properties
100
- invalid_properties = Array.new
101
- if @name.nil?
102
- invalid_properties.push('invalid value for "name", name cannot be nil.')
103
- end
104
-
105
- if @time.nil?
106
- invalid_properties.push('invalid value for "time", time cannot be nil.')
107
- end
108
-
109
- invalid_properties
110
- end
111
-
112
- # Check to see if the all the properties in the model are valid
113
- # @return true if the model is valid
114
- def valid?
115
- return false if @name.nil?
116
- return false if @time.nil?
117
- true
118
- end
119
-
120
- # Checks equality by comparing each attribute.
121
- # @param [Object] Object to be compared
122
- def ==(o)
123
- return true if self.equal?(o)
124
- self.class == o.class &&
125
- name == o.name &&
126
- time == o.time &&
127
- app_id == o.app_id &&
128
- properties == o.properties &&
129
- _update_existing_only == o._update_existing_only
130
- end
131
-
132
- # @see the `==` method
133
- # @param [Object] Object to be compared
134
- def eql?(o)
135
- self == o
136
- end
137
-
138
- # Calculates hash code according to all attributes.
139
- # @return [Integer] Hash code
140
- def hash
141
- [name, time, app_id, properties, _update_existing_only].hash
142
- end
143
-
144
- # Builds the object from hash
145
- # @param [Hash] attributes Model attributes in the form of hash
146
- # @return [Object] Returns the model itself
147
- def self.build_from_hash(attributes)
148
- new.build_from_hash(attributes)
149
- end
150
-
151
- # Builds the object from hash
152
- # @param [Hash] attributes Model attributes in the form of hash
153
- # @return [Object] Returns the model itself
154
- def build_from_hash(attributes)
155
- return nil unless attributes.is_a?(Hash)
156
- self.class.openapi_types.each_pair do |key, type|
157
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
158
- self.send("#{key}=", nil)
159
- elsif type =~ /\AArray<(.*)>/i
160
- # check to ensure the input is an array given that the attribute
161
- # is documented as an array but the input is not
162
- if attributes[self.class.attribute_map[key]].is_a?(Array)
163
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
- end
165
- elsif !attributes[self.class.attribute_map[key]].nil?
166
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
- end
168
- end
169
-
170
- self
171
- end
172
-
173
- # Deserializes the data based on type
174
- # @param string type Data type
175
- # @param string value Value to be deserialized
176
- # @return [Object] Deserialized data
177
- def _deserialize(type, value)
178
- case type.to_sym
179
- when :Time
180
- Time.parse(value)
181
- when :Date
182
- Date.parse(value)
183
- when :String
184
- value.to_s
185
- when :Integer
186
- value.to_i
187
- when :Float
188
- value.to_f
189
- when :Boolean
190
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
- true
192
- else
193
- false
194
- end
195
- when :Object
196
- # generic object (usually a Hash), return directly
197
- value
198
- when /\AArray<(?<inner_type>.+)>\z/
199
- inner_type = Regexp.last_match[:inner_type]
200
- value.map { |v| _deserialize(inner_type, v) }
201
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
- k_type = Regexp.last_match[:k_type]
203
- v_type = Regexp.last_match[:v_type]
204
- {}.tap do |hash|
205
- value.each do |k, v|
206
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
- end
208
- end
209
- else # model
210
- # models (e.g. Pet) or oneOf
211
- klass = BrazeClient.const_get(type)
212
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
213
- end
214
- end
215
-
216
- # Returns the string representation of the object
217
- # @return [String] String presentation of the object
218
- def to_s
219
- to_hash.to_s
220
- end
221
-
222
- # to_body is an alias to to_hash (backward compatibility)
223
- # @return [Hash] Returns the object in the form of hash
224
- def to_body
225
- to_hash
226
- end
227
-
228
- # Returns the object in the form of hash
229
- # @return [Hash] Returns the object in the form of hash
230
- def to_hash
231
- hash = {}
232
- self.class.attribute_map.each_pair do |attr, param|
233
- value = self.send(attr)
234
- if value.nil?
235
- is_nullable = self.class.openapi_nullable.include?(attr)
236
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
- end
238
-
239
- hash[param] = _to_hash(value)
240
- end
241
- hash
242
- end
243
-
244
- # Outputs non-array value in the form of hash
245
- # For object, use to_hash. Otherwise, just return the value
246
- # @param [Object] value Any valid value
247
- # @return [Hash] Returns the value in the form of hash
248
- def _to_hash(value)
249
- if value.is_a?(Array)
250
- value.compact.map { |v| _to_hash(v) }
251
- elsif value.is_a?(Hash)
252
- {}.tap do |hash|
253
- value.each { |k, v| hash[k] = _to_hash(v) }
254
- end
255
- elsif value.respond_to? :to_hash
256
- value.to_hash
257
- else
258
- value
259
- end
260
- end
261
-
262
- end
263
-
264
- end
@@ -1,106 +0,0 @@
1
- =begin
2
- #Braze
3
-
4
- #Track users, send messages, export data, and more
5
-
6
- The version of the OpenAPI document: 0.1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.1
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module BrazeClient
17
- module Identifier
18
- class << self
19
- # List of class defined in oneOf (OpenAPI v3)
20
- def openapi_one_of
21
- [
22
- :'IdentifierOneOf',
23
- :'IdentifierOneOf1',
24
- :'IdentifierOneOf2'
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 defacto 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
- typed_data = find_and_cast_into_type(klass, data)
43
- return typed_data if typed_data
44
- rescue # rescue all errors so we keep iterating even if the current item lookup raises
45
- end
46
- end
47
-
48
- openapi_one_of.include?(:AnyType) ? data : nil
49
- end
50
-
51
- private
52
-
53
- SchemaMismatchError = Class.new(StandardError)
54
-
55
- # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
56
- def find_and_cast_into_type(klass, data)
57
- return if data.nil?
58
-
59
- case klass.to_s
60
- when 'Boolean'
61
- return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
62
- when 'Float'
63
- return data if data.instance_of?(Float)
64
- when 'Integer'
65
- return data if data.instance_of?(Integer)
66
- when 'Time'
67
- return Time.parse(data)
68
- when 'Date'
69
- return Date.parse(data)
70
- when 'String'
71
- return data if data.instance_of?(String)
72
- when 'Object' # "type: object"
73
- return data if data.instance_of?(Hash)
74
- when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
75
- if data.instance_of?(Array)
76
- sub_type = Regexp.last_match[:sub_type]
77
- return data.map { |item| find_and_cast_into_type(sub_type, item) }
78
- end
79
- when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
80
- if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
81
- sub_type = Regexp.last_match[:sub_type]
82
- return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
83
- end
84
- else # model
85
- const = BrazeClient.const_get(klass)
86
- if const
87
- if const.respond_to?(:openapi_one_of) # nested oneOf model
88
- model = const.build(data)
89
- return model if model
90
- else
91
- # raise if data contains keys that are not known to the model
92
- raise unless (data.keys - const.acceptable_attributes).empty?
93
- model = const.build_from_hash(data)
94
- return model if model && model.valid?
95
- end
96
- end
97
- end
98
-
99
- raise # if no match by now, raise
100
- rescue
101
- raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
102
- end
103
- end
104
- end
105
-
106
- end