braze_api_client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE.md +9 -0
  4. data/README.md +191 -0
  5. data/Rakefile +10 -0
  6. data/braze_api_client.gemspec +38 -0
  7. data/docs/Attributes.md +58 -0
  8. data/docs/AttributesArray.md +18 -0
  9. data/docs/AttributesCurrentLocation.md +20 -0
  10. data/docs/AttributesFacebook.md +22 -0
  11. data/docs/AttributesPushTokens.md +22 -0
  12. data/docs/AttributesTwitter.md +26 -0
  13. data/docs/Event.md +26 -0
  14. data/docs/EventsArray.md +18 -0
  15. data/docs/GeneralError.md +20 -0
  16. data/docs/Identifier.md +51 -0
  17. data/docs/IdentifierOneOf.md +18 -0
  18. data/docs/IdentifierOneOf1.md +18 -0
  19. data/docs/IdentifierOneOf2.md +18 -0
  20. data/docs/RestApi.md +427 -0
  21. data/docs/UsersTrackRequest.md +18 -0
  22. data/docs/UsersTrackResponse.md +24 -0
  23. data/git_push.sh +16 -0
  24. data/lib/braze_api_client/api/rest_api.rb +400 -0
  25. data/lib/braze_api_client/api_client.rb +390 -0
  26. data/lib/braze_api_client/api_error.rb +57 -0
  27. data/lib/braze_api_client/configuration.rb +294 -0
  28. data/lib/braze_api_client/models/attributes.rb +458 -0
  29. data/lib/braze_api_client/models/attributes_array.rb +225 -0
  30. data/lib/braze_api_client/models/attributes_current_location.rb +227 -0
  31. data/lib/braze_api_client/models/attributes_facebook.rb +238 -0
  32. data/lib/braze_api_client/models/attributes_push_tokens.rb +246 -0
  33. data/lib/braze_api_client/models/attributes_twitter.rb +254 -0
  34. data/lib/braze_api_client/models/event.rb +264 -0
  35. data/lib/braze_api_client/models/events_array.rb +220 -0
  36. data/lib/braze_api_client/models/general_error.rb +227 -0
  37. data/lib/braze_api_client/models/identifier.rb +106 -0
  38. data/lib/braze_api_client/models/identifier_one_of.rb +223 -0
  39. data/lib/braze_api_client/models/identifier_one_of1.rb +223 -0
  40. data/lib/braze_api_client/models/identifier_one_of2.rb +223 -0
  41. data/lib/braze_api_client/models/users_track_request.rb +245 -0
  42. data/lib/braze_api_client/models/users_track_response.rb +245 -0
  43. data/lib/braze_api_client/version.rb +15 -0
  44. data/lib/braze_api_client.rb +55 -0
  45. data/spec/api/rest_api_spec.rb +101 -0
  46. data/spec/api_client_spec.rb +226 -0
  47. data/spec/configuration_spec.rb +42 -0
  48. data/spec/models/attributes_array_spec.rb +34 -0
  49. data/spec/models/attributes_current_location_spec.rb +40 -0
  50. data/spec/models/attributes_facebook_spec.rb +46 -0
  51. data/spec/models/attributes_push_tokens_spec.rb +46 -0
  52. data/spec/models/attributes_spec.rb +166 -0
  53. data/spec/models/attributes_twitter_spec.rb +58 -0
  54. data/spec/models/event_spec.rb +58 -0
  55. data/spec/models/events_array_spec.rb +34 -0
  56. data/spec/models/general_error_spec.rb +40 -0
  57. data/spec/models/identifier_one_of1_spec.rb +34 -0
  58. data/spec/models/identifier_one_of2_spec.rb +34 -0
  59. data/spec/models/identifier_one_of_spec.rb +34 -0
  60. data/spec/models/identifier_spec.rb +31 -0
  61. data/spec/models/users_track_request_spec.rb +34 -0
  62. data/spec/models/users_track_response_spec.rb +52 -0
  63. data/spec/spec_helper.rb +111 -0
  64. metadata +164 -0
@@ -0,0 +1,400 @@
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 'cgi'
14
+
15
+ module BrazeClient
16
+ class RestApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete any user profile by specifying a known user identifier
23
+ # @param body [Object]
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Object]
26
+ def delete_users(body, opts = {})
27
+ data, _status_code, _headers = delete_users_with_http_info(body, opts)
28
+ data
29
+ end
30
+
31
+ # Delete any user profile by specifying a known user identifier
32
+ # @param body [Object]
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
35
+ def delete_users_with_http_info(body, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: RestApi.delete_users ...'
38
+ end
39
+ # verify the required parameter 'body' is set
40
+ if @api_client.config.client_side_validation && body.nil?
41
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestApi.delete_users"
42
+ end
43
+ # resource path
44
+ local_var_path = '/users/delete'
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
53
+ # HTTP header 'Content-Type'
54
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
61
+
62
+ # return_type
63
+ return_type = opts[:debug_return_type] || 'Object'
64
+
65
+ # auth_names
66
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
67
+
68
+ new_options = opts.merge(
69
+ :operation => :"RestApi.delete_users",
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => return_type
76
+ )
77
+
78
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: RestApi#delete_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+
85
+ # Identify an unidentified (alias-only) user
86
+ # @param body [Object]
87
+ # @param [Hash] opts the optional parameters
88
+ # @return [Object]
89
+ def identify_users(body, opts = {})
90
+ data, _status_code, _headers = identify_users_with_http_info(body, opts)
91
+ data
92
+ end
93
+
94
+ # Identify an unidentified (alias-only) user
95
+ # @param body [Object]
96
+ # @param [Hash] opts the optional parameters
97
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
98
+ def identify_users_with_http_info(body, opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug 'Calling API: RestApi.identify_users ...'
101
+ end
102
+ # verify the required parameter 'body' is set
103
+ if @api_client.config.client_side_validation && body.nil?
104
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestApi.identify_users"
105
+ end
106
+ # resource path
107
+ local_var_path = '/users/identify'
108
+
109
+ # query parameters
110
+ query_params = opts[:query_params] || {}
111
+
112
+ # header parameters
113
+ header_params = opts[:header_params] || {}
114
+ # HTTP header 'Accept' (if needed)
115
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
116
+ # HTTP header 'Content-Type'
117
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
118
+
119
+ # form parameters
120
+ form_params = opts[:form_params] || {}
121
+
122
+ # http body (model)
123
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
124
+
125
+ # return_type
126
+ return_type = opts[:debug_return_type] || 'Object'
127
+
128
+ # auth_names
129
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
130
+
131
+ new_options = opts.merge(
132
+ :operation => :"RestApi.identify_users",
133
+ :header_params => header_params,
134
+ :query_params => query_params,
135
+ :form_params => form_params,
136
+ :body => post_body,
137
+ :auth_names => auth_names,
138
+ :return_type => return_type
139
+ )
140
+
141
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
142
+ if @api_client.config.debugging
143
+ @api_client.config.logger.debug "API called: RestApi#identify_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
144
+ end
145
+ return data, status_code, headers
146
+ end
147
+
148
+ # Add new user aliases for existing identified users or create new unidentified users
149
+ # @param body [Object]
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [Object]
152
+ def new_user_aliases(body, opts = {})
153
+ data, _status_code, _headers = new_user_aliases_with_http_info(body, opts)
154
+ data
155
+ end
156
+
157
+ # Add new user aliases for existing identified users or create new unidentified users
158
+ # @param body [Object]
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
161
+ def new_user_aliases_with_http_info(body, opts = {})
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug 'Calling API: RestApi.new_user_aliases ...'
164
+ end
165
+ # verify the required parameter 'body' is set
166
+ if @api_client.config.client_side_validation && body.nil?
167
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestApi.new_user_aliases"
168
+ end
169
+ # resource path
170
+ local_var_path = '/users/alias/new'
171
+
172
+ # query parameters
173
+ query_params = opts[:query_params] || {}
174
+
175
+ # header parameters
176
+ header_params = opts[:header_params] || {}
177
+ # HTTP header 'Accept' (if needed)
178
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
179
+ # HTTP header 'Content-Type'
180
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
181
+
182
+ # form parameters
183
+ form_params = opts[:form_params] || {}
184
+
185
+ # http body (model)
186
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
187
+
188
+ # return_type
189
+ return_type = opts[:debug_return_type] || 'Object'
190
+
191
+ # auth_names
192
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
193
+
194
+ new_options = opts.merge(
195
+ :operation => :"RestApi.new_user_aliases",
196
+ :header_params => header_params,
197
+ :query_params => query_params,
198
+ :form_params => form_params,
199
+ :body => post_body,
200
+ :auth_names => auth_names,
201
+ :return_type => return_type
202
+ )
203
+
204
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug "API called: RestApi#new_user_aliases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
207
+ end
208
+ return data, status_code, headers
209
+ end
210
+
211
+ # Remove your users' old deprecated external IDs. This endpoint completely removes the deprecated ID and cannot be undone.
212
+ # @param body [Object]
213
+ # @param [Hash] opts the optional parameters
214
+ # @return [Object]
215
+ def remove_external_ids(body, opts = {})
216
+ data, _status_code, _headers = remove_external_ids_with_http_info(body, opts)
217
+ data
218
+ end
219
+
220
+ # Remove your users&#39; old deprecated external IDs. This endpoint completely removes the deprecated ID and cannot be undone.
221
+ # @param body [Object]
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
224
+ def remove_external_ids_with_http_info(body, opts = {})
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug 'Calling API: RestApi.remove_external_ids ...'
227
+ end
228
+ # verify the required parameter 'body' is set
229
+ if @api_client.config.client_side_validation && body.nil?
230
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestApi.remove_external_ids"
231
+ end
232
+ # resource path
233
+ local_var_path = '/users/external_ids/remove'
234
+
235
+ # query parameters
236
+ query_params = opts[:query_params] || {}
237
+
238
+ # header parameters
239
+ header_params = opts[:header_params] || {}
240
+ # HTTP header 'Accept' (if needed)
241
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
242
+ # HTTP header 'Content-Type'
243
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
244
+
245
+ # form parameters
246
+ form_params = opts[:form_params] || {}
247
+
248
+ # http body (model)
249
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
250
+
251
+ # return_type
252
+ return_type = opts[:debug_return_type] || 'Object'
253
+
254
+ # auth_names
255
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
256
+
257
+ new_options = opts.merge(
258
+ :operation => :"RestApi.remove_external_ids",
259
+ :header_params => header_params,
260
+ :query_params => query_params,
261
+ :form_params => form_params,
262
+ :body => post_body,
263
+ :auth_names => auth_names,
264
+ :return_type => return_type
265
+ )
266
+
267
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
268
+ if @api_client.config.debugging
269
+ @api_client.config.logger.debug "API called: RestApi#remove_external_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
270
+ end
271
+ return data, status_code, headers
272
+ end
273
+
274
+ # Set a new (primary) external_id for the user and deprecate their existing external_id
275
+ # @param body [Object]
276
+ # @param [Hash] opts the optional parameters
277
+ # @return [Object]
278
+ def rename_external_ids(body, opts = {})
279
+ data, _status_code, _headers = rename_external_ids_with_http_info(body, opts)
280
+ data
281
+ end
282
+
283
+ # Set a new (primary) external_id for the user and deprecate their existing external_id
284
+ # @param body [Object]
285
+ # @param [Hash] opts the optional parameters
286
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
287
+ def rename_external_ids_with_http_info(body, opts = {})
288
+ if @api_client.config.debugging
289
+ @api_client.config.logger.debug 'Calling API: RestApi.rename_external_ids ...'
290
+ end
291
+ # verify the required parameter 'body' is set
292
+ if @api_client.config.client_side_validation && body.nil?
293
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestApi.rename_external_ids"
294
+ end
295
+ # resource path
296
+ local_var_path = '/users/external_ids/rename'
297
+
298
+ # query parameters
299
+ query_params = opts[:query_params] || {}
300
+
301
+ # header parameters
302
+ header_params = opts[:header_params] || {}
303
+ # HTTP header 'Accept' (if needed)
304
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
305
+ # HTTP header 'Content-Type'
306
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
307
+
308
+ # form parameters
309
+ form_params = opts[:form_params] || {}
310
+
311
+ # http body (model)
312
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
313
+
314
+ # return_type
315
+ return_type = opts[:debug_return_type] || 'Object'
316
+
317
+ # auth_names
318
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
319
+
320
+ new_options = opts.merge(
321
+ :operation => :"RestApi.rename_external_ids",
322
+ :header_params => header_params,
323
+ :query_params => query_params,
324
+ :form_params => form_params,
325
+ :body => post_body,
326
+ :auth_names => auth_names,
327
+ :return_type => return_type
328
+ )
329
+
330
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
331
+ if @api_client.config.debugging
332
+ @api_client.config.logger.debug "API called: RestApi#rename_external_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
333
+ end
334
+ return data, status_code, headers
335
+ end
336
+
337
+ # Record custom events, purchases, and update user profile attributes
338
+ # @param users_track_request [UsersTrackRequest]
339
+ # @param [Hash] opts the optional parameters
340
+ # @return [UsersTrackResponse]
341
+ def track_users(users_track_request, opts = {})
342
+ data, _status_code, _headers = track_users_with_http_info(users_track_request, opts)
343
+ data
344
+ end
345
+
346
+ # Record custom events, purchases, and update user profile attributes
347
+ # @param users_track_request [UsersTrackRequest]
348
+ # @param [Hash] opts the optional parameters
349
+ # @return [Array<(UsersTrackResponse, Integer, Hash)>] UsersTrackResponse data, response status code and response headers
350
+ def track_users_with_http_info(users_track_request, opts = {})
351
+ if @api_client.config.debugging
352
+ @api_client.config.logger.debug 'Calling API: RestApi.track_users ...'
353
+ end
354
+ # verify the required parameter 'users_track_request' is set
355
+ if @api_client.config.client_side_validation && users_track_request.nil?
356
+ fail ArgumentError, "Missing the required parameter 'users_track_request' when calling RestApi.track_users"
357
+ end
358
+ # resource path
359
+ local_var_path = '/users/track'
360
+
361
+ # query parameters
362
+ query_params = opts[:query_params] || {}
363
+
364
+ # header parameters
365
+ header_params = opts[:header_params] || {}
366
+ # HTTP header 'Accept' (if needed)
367
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
368
+ # HTTP header 'Content-Type'
369
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
370
+
371
+ # form parameters
372
+ form_params = opts[:form_params] || {}
373
+
374
+ # http body (model)
375
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(users_track_request)
376
+
377
+ # return_type
378
+ return_type = opts[:debug_return_type] || 'UsersTrackResponse'
379
+
380
+ # auth_names
381
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
382
+
383
+ new_options = opts.merge(
384
+ :operation => :"RestApi.track_users",
385
+ :header_params => header_params,
386
+ :query_params => query_params,
387
+ :form_params => form_params,
388
+ :body => post_body,
389
+ :auth_names => auth_names,
390
+ :return_type => return_type
391
+ )
392
+
393
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
394
+ if @api_client.config.debugging
395
+ @api_client.config.logger.debug "API called: RestApi#track_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
396
+ end
397
+ return data, status_code, headers
398
+ end
399
+ end
400
+ end