braze_ruby 0.9.0 → 0.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13d93e632f509eb5ccaef744c1e378092fc25c68829f0819524484c1612e5438
4
- data.tar.gz: f3827d451cf7ba1d424a23365676c74e83d0d3e999a0dfc295bacc0240de4261
3
+ metadata.gz: f8b917b476524829a7321aba5094d205b8354c09ea1f9440af5d65c1766e3dda
4
+ data.tar.gz: 76f533b0029ceed757ad322caad5e3c3671db936a80bcada11bcec7dd9fc02c2
5
5
  SHA512:
6
- metadata.gz: fc3543daf80e77fa1a59d0cbcb11825ca0078426c02802dc7acd66b48f9e745baaa0a0e7f19b86c22c7678b0732c9a04d53fbe92e521daa50e32734f12298b78
7
- data.tar.gz: 89d604660de041f123a0d051d1a075d9b51ccf389e6e2342966657ea557aa6408fc149340855523d23454106d2efba65fbb8881cb1c63cf29aad27bb9b8c042f
6
+ metadata.gz: 12e35e8e02474f45b79e7090ee3d09ab0396511b4575a0e21e6bfa25aacc65932a664b6695d5e53ada5c5c312e724fd961d3e693bcf6af59d811e8c9e5dd49fb
7
+ data.tar.gz: 8b8933c389cc3d43ec94a047c1dcfdf596b9ff1cc26f60366a0fb41faec3be5a22fb8752c2357a851759d4adf650d83469dabaec96e145a6fb8f432d5b0b157b
data/.circleci/config.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  version: 2.1
2
+
2
3
  jobs:
3
4
  test:
4
5
  parameters:
@@ -17,10 +18,16 @@ jobs:
17
18
  - run:
18
19
  name: Run tests
19
20
  command: bundle exec rake
21
+
20
22
  workflows:
21
23
  all-tests:
22
24
  jobs:
23
25
  - test:
24
- matrix:
25
- parameters:
26
- ruby-version: ["ruby:3.1.6", "ruby:3.2.5", "ruby:3.3.5"]
26
+ name: test-latest
27
+ ruby-version: ruby:3.3.6
28
+ - test:
29
+ name: test-minus-one
30
+ ruby-version: ruby:3.2.6
31
+ - test:
32
+ name: test-minus-two
33
+ ruby-version: ruby:3.1.6
data/CHANGELOG.md CHANGED
@@ -22,6 +22,17 @@ The format is based on [Keep a Changelog][] and this project adheres to
22
22
 
23
23
  ### Security
24
24
 
25
+ ## [0.10.0][] - 2024-11-15
26
+
27
+ ### Added
28
+
29
+ * Partial support for Braze catalogs ([#60][])
30
+
31
+ ### Changed
32
+
33
+ * Use more generic CI job names ([#67][])
34
+ * Bump Ruby versions for CI ([#68][])
35
+
25
36
  ## [0.9.0][] - 2024-10-25
26
37
 
27
38
  ### Added
@@ -92,13 +103,14 @@ The format is based on [Keep a Changelog][] and this project adheres to
92
103
  * Modernize a few files and tinker with CI setup ([#26][])
93
104
  * Update authors and license ([#27][])
94
105
 
95
- [Unreleased]: https://github.com/jonallured/braze_ruby/compare/v0.9.0...HEAD
106
+ [Unreleased]: https://github.com/jonallured/braze_ruby/compare/v0.10.0...HEAD
96
107
 
97
108
  [0.5.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.5.0
98
109
  [0.6.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.6.0
99
110
  [0.7.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.7.0
100
111
  [0.8.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.8.0
101
112
  [0.9.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.9.0
113
+ [0.10.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.10.0
102
114
 
103
115
  [#25]: https://github.com/jonallured/braze_ruby/pull/25
104
116
  [#26]: https://github.com/jonallured/braze_ruby/pull/26
@@ -119,8 +131,11 @@ The format is based on [Keep a Changelog][] and this project adheres to
119
131
  [#45]: https://github.com/jonallured/braze_ruby/pull/45
120
132
  [#46]: https://github.com/jonallured/braze_ruby/pull/46
121
133
  [#47]: https://github.com/jonallured/braze_ruby/pull/47
134
+ [#60]: https://github.com/jonallured/braze_ruby/pull/60
122
135
  [#61]: https://github.com/jonallured/braze_ruby/pull/61
123
136
  [#62]: https://github.com/jonallured/braze_ruby/pull/62
124
137
  [#63]: https://github.com/jonallured/braze_ruby/pull/63
125
138
  [#64]: https://github.com/jonallured/braze_ruby/pull/64
126
139
  [#65]: https://github.com/jonallured/braze_ruby/pull/65
140
+ [#67]: https://github.com/jonallured/braze_ruby/pull/67
141
+ [#68]: https://github.com/jonallured/braze_ruby/pull/68
data/README.md CHANGED
@@ -317,6 +317,83 @@ api.email_hard_bounces(email: ['jdoe@example.com'])
317
317
  api.remove_emails_from_spam(email: ['jdoe@example.com'])
318
318
  ```
319
319
 
320
+ ### Braze catalogs
321
+
322
+ As of november 2024, Braze catalogs still have some moving parts (beta) and only
323
+ partial support has been implemented
324
+
325
+ #### Create Catalogs
326
+ ```ruby
327
+ api.create_catalogs(
328
+ catalogs: [
329
+ {
330
+ name: "restaurants",
331
+ description: "My Restaurants",
332
+ fields: [
333
+ {name: "id", type: "string"},
334
+ {name: "Name", type: "string"},
335
+ {name: "Loyalty_Program", type: "boolean"},
336
+ {name: "Created_At", type: "time"}
337
+ ]
338
+ }
339
+ ]
340
+ )
341
+ ```
342
+
343
+ #### List Catalogs
344
+ ```ruby
345
+ api.list_catalogs
346
+ ```
347
+
348
+ #### Delete Catalog
349
+ ```ruby
350
+ api.delete_catalog("restaurants")
351
+ ```
352
+
353
+ #### Create Catalog Items
354
+ ```ruby
355
+ api.create_catalog_items(
356
+ "restaurants",
357
+ items: [
358
+ {
359
+ id: "restaurant1",
360
+ Name: "Restaurant1",
361
+ Loyalty_Program: true,
362
+ Created_At: "2022-11-01T09:03:19.967+00:00"
363
+ }
364
+ ]
365
+ )
366
+ ```
367
+
368
+ #### Delete Catalog Items
369
+ ```ruby
370
+ api.delete_catalog_items(
371
+ "restaurants",
372
+ items: [
373
+ {id: "restaurant1"}
374
+ ]
375
+ )
376
+ ```
377
+
378
+ #### Update Catalog Items
379
+
380
+ This functions like an upsert, the name of the associated permission api key
381
+ permission is `catalog.replace_items`
382
+
383
+ ```ruby
384
+ api.update_catalog_items(
385
+ "restaurants",
386
+ items: [
387
+ {
388
+ id: "restaurant1",
389
+ Name: "NewRestaurantName",
390
+ Loyalty_Program: false,
391
+ Created_At: "2022-11-01T09:03:19.967+00:00"
392
+ }
393
+ ]
394
+ )
395
+ ```
396
+
320
397
  ## Debugging
321
398
 
322
399
  The BRAZE_RUBY_DEBUG environment variable will trigger full printouts of the
@@ -9,6 +9,7 @@ require "braze_ruby/endpoints/email_sync"
9
9
  require "braze_ruby/endpoints/delete_users"
10
10
  require "braze_ruby/endpoints/campaigns"
11
11
  require "braze_ruby/endpoints/canvas"
12
+ require "braze_ruby/endpoints/catalogs"
12
13
  require "braze_ruby/endpoints/subscription"
13
14
  require "braze_ruby/endpoints/rename_external_ids"
14
15
  require "braze_ruby/endpoints/remove_external_ids"
@@ -26,6 +27,7 @@ module BrazeRuby
26
27
  include BrazeRuby::Endpoints::DeleteUsers
27
28
  include BrazeRuby::Endpoints::Campaigns
28
29
  include BrazeRuby::Endpoints::Canvas
30
+ include BrazeRuby::Endpoints::Catalogs
29
31
  include BrazeRuby::Endpoints::Subscription
30
32
  include BrazeRuby::Endpoints::IdentifyUsers
31
33
  include BrazeRuby::Endpoints::CreateUserAliases
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module Endpoints
5
+ module Catalogs
6
+ # Catalog management
7
+ def create_catalogs(**payload)
8
+ BrazeRuby::REST::CreateCatalogs.new(api_key, braze_url, options, **payload).perform
9
+ end
10
+
11
+ def delete_catalog(catalog_name)
12
+ BrazeRuby::REST::DeleteCatalog.new(api_key, braze_url, options, catalog_name).perform
13
+ end
14
+
15
+ def list_catalogs
16
+ BrazeRuby::REST::ListCatalogs.new(api_key, braze_url, options).perform
17
+ end
18
+
19
+ # Catalog items
20
+ def create_catalog_items(catalog_name, **payload)
21
+ BrazeRuby::REST::CreateCatalogItems.new(api_key, braze_url, options, catalog_name, **payload).perform
22
+ end
23
+
24
+ def delete_catalog_items(catalog_name, **payload)
25
+ BrazeRuby::REST::DeleteCatalogItems.new(api_key, braze_url, options, catalog_name, **payload).perform
26
+ end
27
+
28
+ def update_catalog_items(catalog_name, **payload)
29
+ BrazeRuby::REST::UpdateCatalogItems.new(api_key, braze_url, options, catalog_name, **payload).perform
30
+ end
31
+ end
32
+ end
33
+ end
@@ -20,10 +20,22 @@ module BrazeRuby
20
20
  end
21
21
  end
22
22
 
23
+ def put(path, payload)
24
+ connection.post path do |request|
25
+ request.body = JSON.dump(payload)
26
+ end
27
+ end
28
+
23
29
  def get(path, query = {})
24
30
  connection.get path, query
25
31
  end
26
32
 
33
+ def delete(path, payload = nil)
34
+ connection.delete path do |request|
35
+ request.body = JSON.dump(payload) if payload
36
+ end
37
+ end
38
+
27
39
  def connection
28
40
  @connection ||= Faraday.new(url: @braze_url) do |connection|
29
41
  connection.headers["Content-Type"] = "application/json"
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class CreateCatalogItems < 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.post("/catalogs/#{@catalog_name}/items", @params)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class CreateCatalogs < 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("/catalogs", @params)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class DeleteCatalog < Base
6
+ attr_reader :params
7
+
8
+ def initialize(api_key, braze_url, options, catalog_name)
9
+ @catalog_name = catalog_name
10
+ super(api_key, braze_url, options)
11
+ end
12
+
13
+ def perform
14
+ http.delete("/catalogs/#{@catalog_name}")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrazeRuby
4
+ module REST
5
+ class DeleteCatalogItems < 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.delete("/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 ListCatalogs < Base
6
+ def perform
7
+ http.get("/catalogs")
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 UpdateCatalogItems < 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.put("/catalogs/#{@catalog_name}/items", @params)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -24,3 +24,9 @@ require "braze_ruby/rest/create_user_aliases"
24
24
  require "braze_ruby/rest/rename_external_ids"
25
25
  require "braze_ruby/rest/remove_external_ids"
26
26
  require "braze_ruby/rest/remove_email_addresses_from_spam"
27
+ require "braze_ruby/rest/create_catalogs"
28
+ require "braze_ruby/rest/delete_catalog"
29
+ require "braze_ruby/rest/list_catalogs"
30
+ require "braze_ruby/rest/create_catalog_items"
31
+ require "braze_ruby/rest/delete_catalog_items"
32
+ require "braze_ruby/rest/update_catalog_items"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrazeRuby
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braze_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nussbaum
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-10-25 00:00:00.000000000 Z
14
+ date: 2024-11-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -184,6 +184,7 @@ files:
184
184
  - lib/braze_ruby/endpoints.rb
185
185
  - lib/braze_ruby/endpoints/campaigns.rb
186
186
  - lib/braze_ruby/endpoints/canvas.rb
187
+ - lib/braze_ruby/endpoints/catalogs.rb
187
188
  - lib/braze_ruby/endpoints/create_user_aliases.rb
188
189
  - lib/braze_ruby/endpoints/delete_users.rb
189
190
  - lib/braze_ruby/endpoints/email_status.rb
@@ -200,7 +201,11 @@ files:
200
201
  - lib/braze_ruby/rest.rb
201
202
  - lib/braze_ruby/rest/base.rb
202
203
  - lib/braze_ruby/rest/canvas_details.rb
204
+ - lib/braze_ruby/rest/create_catalog_items.rb
205
+ - lib/braze_ruby/rest/create_catalogs.rb
203
206
  - lib/braze_ruby/rest/create_user_aliases.rb
207
+ - lib/braze_ruby/rest/delete_catalog.rb
208
+ - lib/braze_ruby/rest/delete_catalog_items.rb
204
209
  - lib/braze_ruby/rest/delete_trigger_campaign_schedule.rb
205
210
  - lib/braze_ruby/rest/delete_users.rb
206
211
  - lib/braze_ruby/rest/email_hard_bounces.rb
@@ -208,6 +213,7 @@ files:
208
213
  - lib/braze_ruby/rest/email_unsubscribes.rb
209
214
  - lib/braze_ruby/rest/export_users.rb
210
215
  - lib/braze_ruby/rest/identify_users.rb
216
+ - lib/braze_ruby/rest/list_catalogs.rb
211
217
  - lib/braze_ruby/rest/list_segments.rb
212
218
  - lib/braze_ruby/rest/remove_email_addresses_from_spam.rb
213
219
  - lib/braze_ruby/rest/remove_external_ids.rb
@@ -222,6 +228,7 @@ files:
222
228
  - lib/braze_ruby/rest/trigger_campaign_schedule.rb
223
229
  - lib/braze_ruby/rest/trigger_campaign_send.rb
224
230
  - lib/braze_ruby/rest/trigger_canvas_send.rb
231
+ - lib/braze_ruby/rest/update_catalog_items.rb
225
232
  - lib/braze_ruby/version.rb
226
233
  homepage: https://github.com/jonallured/braze_ruby
227
234
  licenses: