braze_ruby 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8b917b476524829a7321aba5094d205b8354c09ea1f9440af5d65c1766e3dda
4
- data.tar.gz: 76f533b0029ceed757ad322caad5e3c3671db936a80bcada11bcec7dd9fc02c2
3
+ metadata.gz: 4b76039a0f4cb84b70161c37d758241dd0f0fa3d4114bd407102e84ca04731d7
4
+ data.tar.gz: 8ff20890e2800b240a19798ca094d1aad8d02801b93d15b82a1831385a1cfdfd
5
5
  SHA512:
6
- metadata.gz: 12e35e8e02474f45b79e7090ee3d09ab0396511b4575a0e21e6bfa25aacc65932a664b6695d5e53ada5c5c312e724fd961d3e693bcf6af59d811e8c9e5dd49fb
7
- data.tar.gz: 8b8933c389cc3d43ec94a047c1dcfdf596b9ff1cc26f60366a0fb41faec3be5a22fb8752c2357a851759d4adf650d83469dabaec96e145a6fb8f432d5b0b157b
6
+ metadata.gz: 6c4ba02f5c3a96a1286d885dda68be3c9b939e458f040412fdbe707e36d0a3089f65e8549e2fb8f2b749be36d61a97794cc9f06fd1e4f642043902f8456c72d2
7
+ data.tar.gz: '084eec3c3b6fa0e36b2ddcec06afac74d002c9e4bfd5ae2ccb7f5788f4b970fd072d78ca7d80b2770e0880fa6d6c607a7cf166374d3af72ddaae4ee3e5bb17f2'
data/CHANGELOG.md CHANGED
@@ -22,6 +22,15 @@ The format is based on [Keep a Changelog][] and this project adheres to
22
22
 
23
23
  ### Security
24
24
 
25
+ ## [0.11.0][] - 2025-01-31
26
+
27
+ ### Added
28
+
29
+ * Support for Faraday middlewares ([#66][])
30
+ * Adding support for v2 subscription endpoint ([#53][])
31
+ * Support for Braze catalogs : edit_catalog_items ([#69][])
32
+ * Add support for export campaigns ([#52][])
33
+
25
34
  ## [0.10.0][] - 2024-11-15
26
35
 
27
36
  ### Added
@@ -103,7 +112,7 @@ The format is based on [Keep a Changelog][] and this project adheres to
103
112
  * Modernize a few files and tinker with CI setup ([#26][])
104
113
  * Update authors and license ([#27][])
105
114
 
106
- [Unreleased]: https://github.com/jonallured/braze_ruby/compare/v0.10.0...HEAD
115
+ [Unreleased]: https://github.com/jonallured/braze_ruby/compare/v0.11.0...HEAD
107
116
 
108
117
  [0.5.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.5.0
109
118
  [0.6.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.6.0
@@ -111,6 +120,7 @@ The format is based on [Keep a Changelog][] and this project adheres to
111
120
  [0.8.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.8.0
112
121
  [0.9.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.9.0
113
122
  [0.10.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.10.0
123
+ [0.11.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.11.0
114
124
 
115
125
  [#25]: https://github.com/jonallured/braze_ruby/pull/25
116
126
  [#26]: https://github.com/jonallured/braze_ruby/pull/26
@@ -131,6 +141,7 @@ The format is based on [Keep a Changelog][] and this project adheres to
131
141
  [#45]: https://github.com/jonallured/braze_ruby/pull/45
132
142
  [#46]: https://github.com/jonallured/braze_ruby/pull/46
133
143
  [#47]: https://github.com/jonallured/braze_ruby/pull/47
144
+ [#52]: https://github.com/jonallured/braze_ruby/pull/52
134
145
  [#60]: https://github.com/jonallured/braze_ruby/pull/60
135
146
  [#61]: https://github.com/jonallured/braze_ruby/pull/61
136
147
  [#62]: https://github.com/jonallured/braze_ruby/pull/62
@@ -139,3 +150,4 @@ The format is based on [Keep a Changelog][] and this project adheres to
139
150
  [#65]: https://github.com/jonallured/braze_ruby/pull/65
140
151
  [#67]: https://github.com/jonallured/braze_ruby/pull/67
141
152
  [#68]: https://github.com/jonallured/braze_ruby/pull/68
153
+ [#69]: https://github.com/jonallured/braze_ruby/pull/69
data/README.md CHANGED
@@ -58,6 +58,13 @@ api.options
58
58
  # => {:key=>"global-options"}
59
59
  ```
60
60
 
61
+ #### Available `options` keys
62
+
63
+ - retry - Number of times to retry a failed request
64
+ - open_timeout - Number of seconds to wait for the connection to open
65
+ - timeout - Number of seconds to wait for the request to complete
66
+ - middlewares - Array of Faraday middleware to use
67
+
61
68
  ## Examples
62
69
 
63
70
  ### Initializing API
@@ -221,10 +228,13 @@ api.export_users(external_ids: [1])
221
228
  ```ruby
222
229
  api.export_users(segment_id: segment_id, callback_endpoint: 'https://example.com')
223
230
  ```
231
+
224
232
  ### Delete Users
225
233
 
226
234
  #####
235
+
227
236
  Delete Braze Users with an array of external_ids
237
+
228
238
  ```ruby
229
239
  api.delete_users([1, 2, 3])
230
240
  ```
@@ -232,11 +242,13 @@ api.delete_users([1, 2, 3])
232
242
  ### Subscription groups
233
243
 
234
244
  #### Get subscription group status for users by id
245
+
235
246
  ```ruby
236
247
  api.subscription_user_status(external_id: [1])
237
248
  ```
238
249
 
239
250
  #### Get users status for a specific subscription group
251
+
240
252
  ```ruby
241
253
  api.subscription_status_get(
242
254
  external_id: [1],
@@ -245,6 +257,7 @@ api.subscription_status_get(
245
257
  ```
246
258
 
247
259
  #### Set user status for a specific subscription group
260
+
248
261
  ```ruby
249
262
  api.subscription_status_set(
250
263
  external_id: [1],
@@ -253,6 +266,20 @@ api.subscription_status_set(
253
266
  )
254
267
  ```
255
268
 
269
+ #### Set user status for a specific subscription group using v2 route
270
+
271
+ ```ruby
272
+ api.v2_subscription_status_set(
273
+ subscription_groups: [
274
+ {
275
+ external_id: [1],
276
+ subscription_group_id: 'some-uuid',
277
+ subscription_state: 'subscribed|unsubscribed'
278
+ }
279
+ ]
280
+ )
281
+ ```
282
+
256
283
  ### User Alias
257
284
 
258
285
  #### Create an alias-only user
@@ -269,6 +296,7 @@ api.create_user_aliases(
269
296
  ```
270
297
 
271
298
  #### Identify an alias-only user
299
+
272
300
  ```ruby
273
301
  api.identify_users(
274
302
  aliases_to_identify: [{
@@ -284,7 +312,9 @@ api.identify_users(
284
312
  ### External ID Migration
285
313
 
286
314
  #### Rename users' external IDs with an array of external_id_renames
315
+
287
316
  Note: you can send up to 50 rename objects per request.
317
+
288
318
  ```ruby
289
319
  api.rename_external_ids(
290
320
  external_id_renames: [{
@@ -295,7 +325,9 @@ api.rename_external_ids(
295
325
  ```
296
326
 
297
327
  #### Remove users' old deprecated external IDs
328
+
298
329
  Note: you can send up to 50 external IDs per request.
330
+
299
331
  ```ruby
300
332
  api.remove_external_ids(external_ids: ['old_external_id'])
301
333
  ```
@@ -303,16 +335,19 @@ api.remove_external_ids(external_ids: ['old_external_id'])
303
335
  ### Email Sync
304
336
 
305
337
  #### Get List of or Query Email Unsubscribes
338
+
306
339
  ```ruby
307
340
  api.email_unsubscribes(email: ['jdoe@example.com'])
308
341
  ```
309
342
 
310
343
  #### Get List of or Query Hard Bounced Emails
344
+
311
345
  ```ruby
312
346
  api.email_hard_bounces(email: ['jdoe@example.com'])
313
347
  ```
314
348
 
315
349
  #### Remove Email Addresses From Spam List
350
+
316
351
  ```ruby
317
352
  api.remove_emails_from_spam(email: ['jdoe@example.com'])
318
353
  ```
@@ -323,6 +358,7 @@ As of november 2024, Braze catalogs still have some moving parts (beta) and only
323
358
  partial support has been implemented
324
359
 
325
360
  #### Create Catalogs
361
+
326
362
  ```ruby
327
363
  api.create_catalogs(
328
364
  catalogs: [
@@ -341,16 +377,19 @@ api.create_catalogs(
341
377
  ```
342
378
 
343
379
  #### List Catalogs
380
+
344
381
  ```ruby
345
382
  api.list_catalogs
346
383
  ```
347
384
 
348
385
  #### Delete Catalog
386
+
349
387
  ```ruby
350
388
  api.delete_catalog("restaurants")
351
389
  ```
352
390
 
353
391
  #### Create Catalog Items
392
+
354
393
  ```ruby
355
394
  api.create_catalog_items(
356
395
  "restaurants",
@@ -366,6 +405,7 @@ api.create_catalog_items(
366
405
  ```
367
406
 
368
407
  #### Delete Catalog Items
408
+
369
409
  ```ruby
370
410
  api.delete_catalog_items(
371
411
  "restaurants",
@@ -377,6 +417,7 @@ api.delete_catalog_items(
377
417
 
378
418
  #### Update Catalog Items
379
419
 
420
+ **EDIT : This functions hints at functioning like an upsert but actual API behaviour is more of the create if not existing. Further calls on items already existing will do nothing. Use edit_catalog_items for that, see below**
380
421
  This functions like an upsert, the name of the associated permission api key
381
422
  permission is `catalog.replace_items`
382
423
 
@@ -394,6 +435,52 @@ api.update_catalog_items(
394
435
  )
395
436
  ```
396
437
 
438
+ #### Edit Catalog Items
439
+
440
+ This functions actually _updates_ items. The update catalog items does not. This
441
+ is very confusing and Braze support answers late nov 2024 did not clarify this
442
+ point. TL;DR Actual behaviour is `update_catalog_items` functions more or less
443
+ like an create if not existing. `edit_catalog_items` functions like an update
444
+ without the creation bit if it item does not already exists. This will stay in
445
+ an in-between state while Braze continues working on its implementation.
446
+
447
+ `edit_catalog_items` only updates the property in the payload, it does not reset
448
+ value for the existing properties that were omitted.
449
+
450
+ When fixed we will be able to better name things
451
+
452
+ ```ruby
453
+ api.edit_catalog_items(
454
+ "restaurants",
455
+ items: [
456
+ {
457
+ id: "restaurant1",
458
+ Name: "NewRestaurantName",
459
+ }
460
+ ]
461
+ )
462
+ ```
463
+
464
+ ### Export Campaigns
465
+
466
+ #### Export Campaigns List
467
+
468
+ ```ruby
469
+ api.export_campaigns_list(page: 1)
470
+ ```
471
+
472
+ #### Export Campaign Details
473
+
474
+ ```ruby
475
+ api.export_campaign_details(campaign_id: 1)
476
+ ```
477
+
478
+ #### Export Campaign Analytics
479
+
480
+ ```ruby
481
+ api.export_campaign_analytics(campaign_id: 1, length: 100, ending_at: '2022-12-13T11:21:09-08:00' ))
482
+ ```
483
+
397
484
  ## Debugging
398
485
 
399
486
  The BRAZE_RUBY_DEBUG environment variable will trigger full printouts of the
@@ -6,6 +6,7 @@ require "braze_ruby/endpoints/send_messages"
6
6
  require "braze_ruby/endpoints/schedule_messages"
7
7
  require "braze_ruby/endpoints/email_status"
8
8
  require "braze_ruby/endpoints/email_sync"
9
+ require "braze_ruby/endpoints/export"
9
10
  require "braze_ruby/endpoints/delete_users"
10
11
  require "braze_ruby/endpoints/campaigns"
11
12
  require "braze_ruby/endpoints/canvas"
@@ -24,6 +25,7 @@ module BrazeRuby
24
25
  include BrazeRuby::Endpoints::ScheduleMessages
25
26
  include BrazeRuby::Endpoints::EmailStatus
26
27
  include BrazeRuby::Endpoints::EmailSync
28
+ include BrazeRuby::Endpoints::Export
27
29
  include BrazeRuby::Endpoints::DeleteUsers
28
30
  include BrazeRuby::Endpoints::Campaigns
29
31
  include BrazeRuby::Endpoints::Canvas
@@ -28,6 +28,10 @@ module BrazeRuby
28
28
  def update_catalog_items(catalog_name, **payload)
29
29
  BrazeRuby::REST::UpdateCatalogItems.new(api_key, braze_url, options, catalog_name, **payload).perform
30
30
  end
31
+
32
+ def edit_catalog_items(catalog_name, **payload)
33
+ BrazeRuby::REST::EditCatalogItems.new(api_key, braze_url, options, catalog_name, **payload).perform
34
+ end
31
35
  end
32
36
  end
33
37
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module Endpoints
5
+ module Export
6
+ def export_campaigns_list(**payload)
7
+ BrazeRuby::REST::ExportCampaignsList.new(api_key, braze_url, options).perform(**payload)
8
+ end
9
+
10
+ def export_campaign_details(**payload)
11
+ BrazeRuby::REST::ExportCampaignDetails.new(api_key, braze_url, options).perform(**payload)
12
+ end
13
+
14
+ def export_campaign_analytics(**payload)
15
+ BrazeRuby::REST::ExportCampaignAnalytics.new(api_key, braze_url, options).perform(**payload)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -7,6 +7,10 @@ module BrazeRuby
7
7
  BrazeRuby::REST::SubscriptionStatusSet.new(api_key, braze_url, options, **payload).perform
8
8
  end
9
9
 
10
+ def v2_subscription_status_set(**payload)
11
+ BrazeRuby::REST::V2SubscriptionStatusSet.new(api_key, braze_url, options, **payload).perform
12
+ end
13
+
10
14
  def subscription_status_get(**payload)
11
15
  BrazeRuby::REST::SubscriptionStatusGet.new(api_key, braze_url, options, **payload).perform
12
16
  end
@@ -26,6 +26,12 @@ module BrazeRuby
26
26
  end
27
27
  end
28
28
 
29
+ def patch(path, payload)
30
+ connection.patch path do |request|
31
+ request.body = JSON.dump(payload)
32
+ end
33
+ end
34
+
29
35
  def get(path, query = {})
30
36
  connection.get path, query
31
37
  end
@@ -50,6 +56,10 @@ module BrazeRuby
50
56
 
51
57
  connection.options[:timeout] = @options[:timeout]
52
58
  connection.options[:open_timeout] = @options[:open_timeout]
59
+
60
+ @options.fetch(:middlewares, []).each do |middleware|
61
+ connection.use middleware
62
+ end
53
63
  end
54
64
  end
55
65
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class EditCatalogItems < Base
6
+ attr_reader :params
7
+ attr_reader :catalog_name
8
+
9
+ def initialize(api_key, braze_url, options, catalog_name, **params)
10
+ @catalog_name = catalog_name
11
+ @params = params
12
+ super(api_key, braze_url, options)
13
+ end
14
+
15
+ def perform
16
+ http.patch("/catalogs/#{@catalog_name}/items", @params)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class ExportCampaignAnalytics < Base
6
+ def perform(options)
7
+ http.get("/campaigns/data_series", options)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class ExportCampaignDetails < Base
6
+ def perform(options)
7
+ http.get("/campaigns/details", options)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class ExportCampaignsList < Base
6
+ def perform(options)
7
+ http.get("/campaigns/list", options)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class V2SubscriptionStatusSet < Base
6
+ attr_reader :params
7
+
8
+ def initialize(api_key, braze_url, options, **params)
9
+ @params = params
10
+ super(api_key, braze_url, options)
11
+ end
12
+
13
+ def perform
14
+ http.post("/v2/subscription/status/set", {
15
+ **params
16
+ })
17
+ end
18
+ end
19
+ end
20
+ end
@@ -8,6 +8,9 @@ require "braze_ruby/rest/scheduled_broadcasts"
8
8
  require "braze_ruby/rest/email_status"
9
9
  require "braze_ruby/rest/email_hard_bounces"
10
10
  require "braze_ruby/rest/email_unsubscribes"
11
+ require "braze_ruby/rest/export_campaign_analytics"
12
+ require "braze_ruby/rest/export_campaign_details"
13
+ require "braze_ruby/rest/export_campaigns_list"
11
14
  require "braze_ruby/rest/export_users"
12
15
  require "braze_ruby/rest/list_segments"
13
16
  require "braze_ruby/rest/delete_users"
@@ -30,3 +33,5 @@ require "braze_ruby/rest/list_catalogs"
30
33
  require "braze_ruby/rest/create_catalog_items"
31
34
  require "braze_ruby/rest/delete_catalog_items"
32
35
  require "braze_ruby/rest/update_catalog_items"
36
+ require "braze_ruby/rest/edit_catalog_items"
37
+ require "braze_ruby/rest/v2_subscription_status_set"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrazeRuby
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braze_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nussbaum
8
8
  - Hugo Bastien
9
9
  - Justin Boltz
10
10
  - Jonathan Allured
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-11-15 00:00:00.000000000 Z
14
+ date: 2025-01-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -189,6 +189,7 @@ files:
189
189
  - lib/braze_ruby/endpoints/delete_users.rb
190
190
  - lib/braze_ruby/endpoints/email_status.rb
191
191
  - lib/braze_ruby/endpoints/email_sync.rb
192
+ - lib/braze_ruby/endpoints/export.rb
192
193
  - lib/braze_ruby/endpoints/identify_users.rb
193
194
  - lib/braze_ruby/endpoints/remove_email_addresses_from_spam.rb
194
195
  - lib/braze_ruby/endpoints/remove_external_ids.rb
@@ -208,9 +209,13 @@ files:
208
209
  - lib/braze_ruby/rest/delete_catalog_items.rb
209
210
  - lib/braze_ruby/rest/delete_trigger_campaign_schedule.rb
210
211
  - lib/braze_ruby/rest/delete_users.rb
212
+ - lib/braze_ruby/rest/edit_catalog_items.rb
211
213
  - lib/braze_ruby/rest/email_hard_bounces.rb
212
214
  - lib/braze_ruby/rest/email_status.rb
213
215
  - lib/braze_ruby/rest/email_unsubscribes.rb
216
+ - lib/braze_ruby/rest/export_campaign_analytics.rb
217
+ - lib/braze_ruby/rest/export_campaign_details.rb
218
+ - lib/braze_ruby/rest/export_campaigns_list.rb
214
219
  - lib/braze_ruby/rest/export_users.rb
215
220
  - lib/braze_ruby/rest/identify_users.rb
216
221
  - lib/braze_ruby/rest/list_catalogs.rb
@@ -229,6 +234,7 @@ files:
229
234
  - lib/braze_ruby/rest/trigger_campaign_send.rb
230
235
  - lib/braze_ruby/rest/trigger_canvas_send.rb
231
236
  - lib/braze_ruby/rest/update_catalog_items.rb
237
+ - lib/braze_ruby/rest/v2_subscription_status_set.rb
232
238
  - lib/braze_ruby/version.rb
233
239
  homepage: https://github.com/jonallured/braze_ruby
234
240
  licenses:
@@ -236,7 +242,7 @@ licenses:
236
242
  metadata:
237
243
  homepage_uri: https://github.com/jonallured/braze_ruby
238
244
  source_code_uri: https://github.com/jonallured/braze_ruby
239
- post_install_message:
245
+ post_install_message:
240
246
  rdoc_options: []
241
247
  require_paths:
242
248
  - lib
@@ -251,8 +257,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
257
  - !ruby/object:Gem::Version
252
258
  version: '0'
253
259
  requirements: []
254
- rubygems_version: 3.3.5
255
- signing_key:
260
+ rubygems_version: 3.4.20
261
+ signing_key:
256
262
  specification_version: 4
257
263
  summary: A wrapper gem for the Braze REST API.
258
264
  test_files: []