braze_api_client 0.1.0 → 0.1.1

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 (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,22 +0,0 @@
1
- # BrazeClient::AttributesPushTokens
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **app_id** | **String** | | |
8
- | **token** | **String** | | |
9
- | **device_id** | **String** | | [optional] |
10
-
11
- ## Example
12
-
13
- ```ruby
14
- require 'braze_api_client'
15
-
16
- instance = BrazeClient::AttributesPushTokens.new(
17
- app_id: null,
18
- token: null,
19
- device_id: null
20
- )
21
- ```
22
-
@@ -1,26 +0,0 @@
1
- # BrazeClient::AttributesTwitter
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **id** | **Integer** | | [optional] |
8
- | **screen_name** | **String** | | [optional] |
9
- | **followers_count** | **Integer** | | [optional] |
10
- | **friends_count** | **Integer** | | [optional] |
11
- | **statuses_count** | **Integer** | | [optional] |
12
-
13
- ## Example
14
-
15
- ```ruby
16
- require 'braze_api_client'
17
-
18
- instance = BrazeClient::AttributesTwitter.new(
19
- id: null,
20
- screen_name: null,
21
- followers_count: null,
22
- friends_count: null,
23
- statuses_count: null
24
- )
25
- ```
26
-
data/docs/Event.md DELETED
@@ -1,26 +0,0 @@
1
- # BrazeClient::Event
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **name** | **String** | | |
8
- | **time** | **Time** | | |
9
- | **app_id** | **String** | | [optional] |
10
- | **properties** | **Object** | | [optional] |
11
- | **_update_existing_only** | **Boolean** | | [optional] |
12
-
13
- ## Example
14
-
15
- ```ruby
16
- require 'braze_api_client'
17
-
18
- instance = BrazeClient::Event.new(
19
- name: null,
20
- time: null,
21
- app_id: null,
22
- properties: null,
23
- _update_existing_only: null
24
- )
25
- ```
26
-
data/docs/EventsArray.md DELETED
@@ -1,18 +0,0 @@
1
- # BrazeClient::EventsArray
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **attributes** | [**Array<Event>**](Event.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'braze_api_client'
13
-
14
- instance = BrazeClient::EventsArray.new(
15
- attributes: null
16
- )
17
- ```
18
-
data/docs/Identifier.md DELETED
@@ -1,51 +0,0 @@
1
- # BrazeClient::Identifier
2
-
3
- ## Class instance methods
4
-
5
- ### `openapi_one_of`
6
-
7
- Returns the list of classes defined in oneOf.
8
-
9
- #### Example
10
-
11
- ```ruby
12
- require 'braze_api_client'
13
-
14
- BrazeClient::Identifier.openapi_one_of
15
- # =>
16
- # [
17
- # :'IdentifierOneOf',
18
- # :'IdentifierOneOf1',
19
- # :'IdentifierOneOf2'
20
- # ]
21
- ```
22
-
23
- ### build
24
-
25
- Find the appropriate object from the `openapi_one_of` list and casts the data into it.
26
-
27
- #### Example
28
-
29
- ```ruby
30
- require 'braze_api_client'
31
-
32
- BrazeClient::Identifier.build(data)
33
- # => #<IdentifierOneOf:0x00007fdd4aab02a0>
34
-
35
- BrazeClient::Identifier.build(data_that_doesnt_match)
36
- # => nil
37
- ```
38
-
39
- #### Parameters
40
-
41
- | Name | Type | Description |
42
- | ---- | ---- | ----------- |
43
- | **data** | **Mixed** | data to be matched against the list of oneOf items |
44
-
45
- #### Return type
46
-
47
- - `IdentifierOneOf`
48
- - `IdentifierOneOf1`
49
- - `IdentifierOneOf2`
50
- - `nil` (if no type matches)
51
-
@@ -1,18 +0,0 @@
1
- # BrazeClient::IdentifierOneOf1
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **user_alias** | **String** | | |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'braze_api_client'
13
-
14
- instance = BrazeClient::IdentifierOneOf1.new(
15
- user_alias: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # BrazeClient::IdentifierOneOf2
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **braze_id** | **String** | | |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'braze_api_client'
13
-
14
- instance = BrazeClient::IdentifierOneOf2.new(
15
- braze_id: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # BrazeClient::UsersTrackRequest
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **attributes** | [**Array&lt;Event&gt;**](Event.md) | | |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'braze_api_client'
13
-
14
- instance = BrazeClient::UsersTrackRequest.new(
15
- attributes: null
16
- )
17
- ```
18
-
@@ -1,458 +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 Attributes
18
- attr_accessor :country
19
-
20
- attr_accessor :current_location
21
-
22
- attr_accessor :date_of_first_session
23
-
24
- attr_accessor :date_of_last_session
25
-
26
- attr_accessor :dob
27
-
28
- attr_accessor :email
29
-
30
- attr_accessor :email_subscribe
31
-
32
- attr_accessor :email_open_tracking_disabled
33
-
34
- attr_accessor :email_click_tracking_disabled
35
-
36
- attr_accessor :facebook
37
-
38
- attr_accessor :first_name
39
-
40
- attr_accessor :gender
41
-
42
- attr_accessor :home_city
43
-
44
- attr_accessor :language
45
-
46
- attr_accessor :last_name
47
-
48
- attr_accessor :marked_email_as_spam_at
49
-
50
- attr_accessor :phone
51
-
52
- attr_accessor :push_subscribe
53
-
54
- attr_accessor :push_tokens
55
-
56
- attr_accessor :time_zone
57
-
58
- attr_accessor :twitter
59
-
60
- class EnumAttributeValidator
61
- attr_reader :datatype
62
- attr_reader :allowable_values
63
-
64
- def initialize(datatype, allowable_values)
65
- @allowable_values = allowable_values.map do |value|
66
- case datatype.to_s
67
- when /Integer/i
68
- value.to_i
69
- when /Float/i
70
- value.to_f
71
- else
72
- value
73
- end
74
- end
75
- end
76
-
77
- def valid?(value)
78
- !value || allowable_values.include?(value)
79
- end
80
- end
81
-
82
- # Attribute mapping from ruby-style variable name to JSON key.
83
- def self.attribute_map
84
- {
85
- :'country' => :'country',
86
- :'current_location' => :'current_location',
87
- :'date_of_first_session' => :'date_of_first_session',
88
- :'date_of_last_session' => :'date_of_last_session',
89
- :'dob' => :'dob',
90
- :'email' => :'email',
91
- :'email_subscribe' => :'email_subscribe',
92
- :'email_open_tracking_disabled' => :'email_open_tracking_disabled',
93
- :'email_click_tracking_disabled' => :'email_click_tracking_disabled',
94
- :'facebook' => :'facebook',
95
- :'first_name' => :'first_name',
96
- :'gender' => :'gender',
97
- :'home_city' => :'home_city',
98
- :'language' => :'language',
99
- :'last_name' => :'last_name',
100
- :'marked_email_as_spam_at' => :'marked_email_as_spam_at',
101
- :'phone' => :'phone',
102
- :'push_subscribe' => :'push_subscribe',
103
- :'push_tokens' => :'push_tokens',
104
- :'time_zone' => :'time_zone',
105
- :'twitter' => :'twitter'
106
- }
107
- end
108
-
109
- # Returns all the JSON keys this model knows about
110
- def self.acceptable_attributes
111
- attribute_map.values
112
- end
113
-
114
- # Attribute type mapping.
115
- def self.openapi_types
116
- {
117
- :'country' => :'String',
118
- :'current_location' => :'AttributesCurrentLocation',
119
- :'date_of_first_session' => :'Time',
120
- :'date_of_last_session' => :'Time',
121
- :'dob' => :'Date',
122
- :'email' => :'String',
123
- :'email_subscribe' => :'String',
124
- :'email_open_tracking_disabled' => :'Boolean',
125
- :'email_click_tracking_disabled' => :'Boolean',
126
- :'facebook' => :'AttributesFacebook',
127
- :'first_name' => :'String',
128
- :'gender' => :'String',
129
- :'home_city' => :'String',
130
- :'language' => :'String',
131
- :'last_name' => :'String',
132
- :'marked_email_as_spam_at' => :'Time',
133
- :'phone' => :'String',
134
- :'push_subscribe' => :'String',
135
- :'push_tokens' => :'Array<AttributesPushTokens>',
136
- :'time_zone' => :'String',
137
- :'twitter' => :'AttributesTwitter'
138
- }
139
- end
140
-
141
- # List of attributes with nullable: true
142
- def self.openapi_nullable
143
- Set.new([
144
- ])
145
- end
146
-
147
- # Initializes the object
148
- # @param [Hash] attributes Model attributes in the form of hash
149
- def initialize(attributes = {})
150
- if (!attributes.is_a?(Hash))
151
- fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::Attributes` initialize method"
152
- end
153
-
154
- # check to see if the attribute exists and convert string to symbol for hash key
155
- attributes = attributes.each_with_object({}) { |(k, v), h|
156
- if (!self.class.attribute_map.key?(k.to_sym))
157
- fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::Attributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
158
- end
159
- h[k.to_sym] = v
160
- }
161
-
162
- if attributes.key?(:'country')
163
- self.country = attributes[:'country']
164
- end
165
-
166
- if attributes.key?(:'current_location')
167
- self.current_location = attributes[:'current_location']
168
- end
169
-
170
- if attributes.key?(:'date_of_first_session')
171
- self.date_of_first_session = attributes[:'date_of_first_session']
172
- end
173
-
174
- if attributes.key?(:'date_of_last_session')
175
- self.date_of_last_session = attributes[:'date_of_last_session']
176
- end
177
-
178
- if attributes.key?(:'dob')
179
- self.dob = attributes[:'dob']
180
- end
181
-
182
- if attributes.key?(:'email')
183
- self.email = attributes[:'email']
184
- end
185
-
186
- if attributes.key?(:'email_subscribe')
187
- self.email_subscribe = attributes[:'email_subscribe']
188
- end
189
-
190
- if attributes.key?(:'email_open_tracking_disabled')
191
- self.email_open_tracking_disabled = attributes[:'email_open_tracking_disabled']
192
- end
193
-
194
- if attributes.key?(:'email_click_tracking_disabled')
195
- self.email_click_tracking_disabled = attributes[:'email_click_tracking_disabled']
196
- end
197
-
198
- if attributes.key?(:'facebook')
199
- self.facebook = attributes[:'facebook']
200
- end
201
-
202
- if attributes.key?(:'first_name')
203
- self.first_name = attributes[:'first_name']
204
- end
205
-
206
- if attributes.key?(:'gender')
207
- self.gender = attributes[:'gender']
208
- end
209
-
210
- if attributes.key?(:'home_city')
211
- self.home_city = attributes[:'home_city']
212
- end
213
-
214
- if attributes.key?(:'language')
215
- self.language = attributes[:'language']
216
- end
217
-
218
- if attributes.key?(:'last_name')
219
- self.last_name = attributes[:'last_name']
220
- end
221
-
222
- if attributes.key?(:'marked_email_as_spam_at')
223
- self.marked_email_as_spam_at = attributes[:'marked_email_as_spam_at']
224
- end
225
-
226
- if attributes.key?(:'phone')
227
- self.phone = attributes[:'phone']
228
- end
229
-
230
- if attributes.key?(:'push_subscribe')
231
- self.push_subscribe = attributes[:'push_subscribe']
232
- end
233
-
234
- if attributes.key?(:'push_tokens')
235
- if (value = attributes[:'push_tokens']).is_a?(Array)
236
- self.push_tokens = value
237
- end
238
- end
239
-
240
- if attributes.key?(:'time_zone')
241
- self.time_zone = attributes[:'time_zone']
242
- end
243
-
244
- if attributes.key?(:'twitter')
245
- self.twitter = attributes[:'twitter']
246
- end
247
- end
248
-
249
- # Show invalid properties with the reasons. Usually used together with valid?
250
- # @return Array for valid properties with the reasons
251
- def list_invalid_properties
252
- invalid_properties = Array.new
253
- invalid_properties
254
- end
255
-
256
- # Check to see if the all the properties in the model are valid
257
- # @return true if the model is valid
258
- def valid?
259
- email_subscribe_validator = EnumAttributeValidator.new('String', ["opted_in", "unsubscribed", "subscribed"])
260
- return false unless email_subscribe_validator.valid?(@email_subscribe)
261
- gender_validator = EnumAttributeValidator.new('String', ["M", "F", "O", "N", "P", "null"])
262
- return false unless gender_validator.valid?(@gender)
263
- push_subscribe_validator = EnumAttributeValidator.new('String', ["opted_in", "unsubscribed", "subscribed"])
264
- return false unless push_subscribe_validator.valid?(@push_subscribe)
265
- true
266
- end
267
-
268
- # Custom attribute writer method checking allowed values (enum).
269
- # @param [Object] email_subscribe Object to be assigned
270
- def email_subscribe=(email_subscribe)
271
- validator = EnumAttributeValidator.new('String', ["opted_in", "unsubscribed", "subscribed"])
272
- unless validator.valid?(email_subscribe)
273
- fail ArgumentError, "invalid value for \"email_subscribe\", must be one of #{validator.allowable_values}."
274
- end
275
- @email_subscribe = email_subscribe
276
- end
277
-
278
- # Custom attribute writer method checking allowed values (enum).
279
- # @param [Object] gender Object to be assigned
280
- def gender=(gender)
281
- validator = EnumAttributeValidator.new('String', ["M", "F", "O", "N", "P", "null"])
282
- unless validator.valid?(gender)
283
- fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}."
284
- end
285
- @gender = gender
286
- end
287
-
288
- # Custom attribute writer method checking allowed values (enum).
289
- # @param [Object] push_subscribe Object to be assigned
290
- def push_subscribe=(push_subscribe)
291
- validator = EnumAttributeValidator.new('String', ["opted_in", "unsubscribed", "subscribed"])
292
- unless validator.valid?(push_subscribe)
293
- fail ArgumentError, "invalid value for \"push_subscribe\", must be one of #{validator.allowable_values}."
294
- end
295
- @push_subscribe = push_subscribe
296
- end
297
-
298
- # Checks equality by comparing each attribute.
299
- # @param [Object] Object to be compared
300
- def ==(o)
301
- return true if self.equal?(o)
302
- self.class == o.class &&
303
- country == o.country &&
304
- current_location == o.current_location &&
305
- date_of_first_session == o.date_of_first_session &&
306
- date_of_last_session == o.date_of_last_session &&
307
- dob == o.dob &&
308
- email == o.email &&
309
- email_subscribe == o.email_subscribe &&
310
- email_open_tracking_disabled == o.email_open_tracking_disabled &&
311
- email_click_tracking_disabled == o.email_click_tracking_disabled &&
312
- facebook == o.facebook &&
313
- first_name == o.first_name &&
314
- gender == o.gender &&
315
- home_city == o.home_city &&
316
- language == o.language &&
317
- last_name == o.last_name &&
318
- marked_email_as_spam_at == o.marked_email_as_spam_at &&
319
- phone == o.phone &&
320
- push_subscribe == o.push_subscribe &&
321
- push_tokens == o.push_tokens &&
322
- time_zone == o.time_zone &&
323
- twitter == o.twitter
324
- end
325
-
326
- # @see the `==` method
327
- # @param [Object] Object to be compared
328
- def eql?(o)
329
- self == o
330
- end
331
-
332
- # Calculates hash code according to all attributes.
333
- # @return [Integer] Hash code
334
- def hash
335
- [country, current_location, date_of_first_session, date_of_last_session, dob, email, email_subscribe, email_open_tracking_disabled, email_click_tracking_disabled, facebook, first_name, gender, home_city, language, last_name, marked_email_as_spam_at, phone, push_subscribe, push_tokens, time_zone, twitter].hash
336
- end
337
-
338
- # Builds the object from hash
339
- # @param [Hash] attributes Model attributes in the form of hash
340
- # @return [Object] Returns the model itself
341
- def self.build_from_hash(attributes)
342
- new.build_from_hash(attributes)
343
- end
344
-
345
- # Builds the object from hash
346
- # @param [Hash] attributes Model attributes in the form of hash
347
- # @return [Object] Returns the model itself
348
- def build_from_hash(attributes)
349
- return nil unless attributes.is_a?(Hash)
350
- self.class.openapi_types.each_pair do |key, type|
351
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
352
- self.send("#{key}=", nil)
353
- elsif type =~ /\AArray<(.*)>/i
354
- # check to ensure the input is an array given that the attribute
355
- # is documented as an array but the input is not
356
- if attributes[self.class.attribute_map[key]].is_a?(Array)
357
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
358
- end
359
- elsif !attributes[self.class.attribute_map[key]].nil?
360
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
361
- end
362
- end
363
-
364
- self
365
- end
366
-
367
- # Deserializes the data based on type
368
- # @param string type Data type
369
- # @param string value Value to be deserialized
370
- # @return [Object] Deserialized data
371
- def _deserialize(type, value)
372
- case type.to_sym
373
- when :Time
374
- Time.parse(value)
375
- when :Date
376
- Date.parse(value)
377
- when :String
378
- value.to_s
379
- when :Integer
380
- value.to_i
381
- when :Float
382
- value.to_f
383
- when :Boolean
384
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
385
- true
386
- else
387
- false
388
- end
389
- when :Object
390
- # generic object (usually a Hash), return directly
391
- value
392
- when /\AArray<(?<inner_type>.+)>\z/
393
- inner_type = Regexp.last_match[:inner_type]
394
- value.map { |v| _deserialize(inner_type, v) }
395
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
396
- k_type = Regexp.last_match[:k_type]
397
- v_type = Regexp.last_match[:v_type]
398
- {}.tap do |hash|
399
- value.each do |k, v|
400
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
401
- end
402
- end
403
- else # model
404
- # models (e.g. Pet) or oneOf
405
- klass = BrazeClient.const_get(type)
406
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
407
- end
408
- end
409
-
410
- # Returns the string representation of the object
411
- # @return [String] String presentation of the object
412
- def to_s
413
- to_hash.to_s
414
- end
415
-
416
- # to_body is an alias to to_hash (backward compatibility)
417
- # @return [Hash] Returns the object in the form of hash
418
- def to_body
419
- to_hash
420
- end
421
-
422
- # Returns the object in the form of hash
423
- # @return [Hash] Returns the object in the form of hash
424
- def to_hash
425
- hash = {}
426
- self.class.attribute_map.each_pair do |attr, param|
427
- value = self.send(attr)
428
- if value.nil?
429
- is_nullable = self.class.openapi_nullable.include?(attr)
430
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
431
- end
432
-
433
- hash[param] = _to_hash(value)
434
- end
435
- hash
436
- end
437
-
438
- # Outputs non-array value in the form of hash
439
- # For object, use to_hash. Otherwise, just return the value
440
- # @param [Object] value Any valid value
441
- # @return [Hash] Returns the value in the form of hash
442
- def _to_hash(value)
443
- if value.is_a?(Array)
444
- value.compact.map { |v| _to_hash(v) }
445
- elsif value.is_a?(Hash)
446
- {}.tap do |hash|
447
- value.each { |k, v| hash[k] = _to_hash(v) }
448
- end
449
- elsif value.respond_to? :to_hash
450
- value.to_hash
451
- else
452
- value
453
- end
454
- end
455
-
456
- end
457
-
458
- end