braze_ruby 0.8.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +10 -3
  3. data/.github/workflows/release.yml +3 -1
  4. data/.rspec +2 -0
  5. data/CHANGELOG.md +141 -0
  6. data/LICENSE.txt +1 -1
  7. data/README.md +117 -6
  8. data/bin/console +10 -0
  9. data/bin/release +1 -11
  10. data/braze_ruby.gemspec +2 -2
  11. data/lib/braze_ruby/api.rb +6 -4
  12. data/lib/braze_ruby/endpoints/catalogs.rb +33 -0
  13. data/lib/braze_ruby/http.rb +12 -0
  14. data/lib/braze_ruby/rest/canvas_details.rb +1 -1
  15. data/lib/braze_ruby/rest/create_catalog_items.rb +20 -0
  16. data/lib/braze_ruby/rest/create_catalogs.rb +18 -0
  17. data/lib/braze_ruby/rest/delete_catalog.rb +18 -0
  18. data/lib/braze_ruby/rest/delete_catalog_items.rb +20 -0
  19. data/lib/braze_ruby/rest/email_hard_bounces.rb +1 -1
  20. data/lib/braze_ruby/rest/email_status.rb +1 -1
  21. data/lib/braze_ruby/rest/email_unsubscribes.rb +1 -1
  22. data/lib/braze_ruby/rest/list_catalogs.rb +11 -0
  23. data/lib/braze_ruby/rest/schedule_messages.rb +1 -1
  24. data/lib/braze_ruby/rest/scheduled_broadcasts.rb +1 -1
  25. data/lib/braze_ruby/rest/send_messages.rb +1 -1
  26. data/lib/braze_ruby/rest/subscription_status_get.rb +1 -1
  27. data/lib/braze_ruby/rest/subscription_status_set.rb +1 -1
  28. data/lib/braze_ruby/rest/subscription_user_status.rb +1 -1
  29. data/lib/braze_ruby/rest/trigger_campaign_schedule.rb +1 -1
  30. data/lib/braze_ruby/rest/trigger_campaign_send.rb +1 -1
  31. data/lib/braze_ruby/rest/trigger_canvas_send.rb +1 -1
  32. data/lib/braze_ruby/rest/update_catalog_items.rb +20 -0
  33. data/lib/braze_ruby/rest.rb +6 -0
  34. data/lib/braze_ruby/version.rb +1 -1
  35. data/lib/braze_ruby.rb +4 -0
  36. metadata +27 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92627ab40d55d8abadf9acd07b143a0eae13586d0caad935e657c8e4fb074d54
4
- data.tar.gz: e21b4acbf9aef12c2f7ab37029aece94f421a3a9e2d45afd0c41216316b3a402
3
+ metadata.gz: f8b917b476524829a7321aba5094d205b8354c09ea1f9440af5d65c1766e3dda
4
+ data.tar.gz: 76f533b0029ceed757ad322caad5e3c3671db936a80bcada11bcec7dd9fc02c2
5
5
  SHA512:
6
- metadata.gz: 841f8f3d844ee4881f2d98745eaca37cbf47f7e3352e13373a39bf95567cfd10950df47b60ace6810f805db7962e76bcdcf707dd2ae363f7a16a14850e558b57
7
- data.tar.gz: 5163647859b894bb7946503995fdbad55bc8becd0eb25fb3378b11cfb5283d1ae0cf01f8003a683246693d9c4e52b085f1b7af99e3e4cab0d6053189e10739df
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.0.1", "ruby:2.7.3", "ruby:2.6.7"]
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
@@ -1,13 +1,15 @@
1
1
  name: release
2
+
2
3
  on:
3
4
  push:
4
5
  tags:
5
6
  - v*
7
+
6
8
  jobs:
7
9
  release:
8
10
  runs-on: ubuntu-latest
9
11
  steps:
10
- - uses: actions/checkout@v2
12
+ - uses: actions/checkout@v3
11
13
  - name: Setup rubygems
12
14
  run: |
13
15
  mkdir ~/.gem
data/.rspec CHANGED
@@ -1 +1,3 @@
1
1
  --color
2
+ --order random
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,141 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog][] and this project adheres to
6
+ [Semantic Versioning][].
7
+
8
+ [Keep a Changelog]: https://keepachangelog.com
9
+ [Semantic Versioning]: https://semver.org
10
+
11
+ ## [Unreleased][]
12
+
13
+ ### Added
14
+
15
+ ### Changed
16
+
17
+ ### Deprecated
18
+
19
+ ### Removed
20
+
21
+ ### Fixed
22
+
23
+ ### Security
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
+
36
+ ## [0.9.0][] - 2024-10-25
37
+
38
+ ### Added
39
+
40
+ * Add a CHANGELOG ([#61][])
41
+ * Add console script ([#63][])
42
+
43
+ ### Changed
44
+
45
+ * Improve configuration support ([#64][])
46
+ * Improve release script ([#65][])
47
+
48
+ ### Fixed
49
+
50
+ * Fix CircleCI builds ([#62][])
51
+
52
+ ## [0.8.0][] - 2022-01-24
53
+
54
+ ### Added
55
+
56
+ * Add a Configuration class ([#42][])
57
+ * Add an endpoint for messages that are scheduled ([#43][])
58
+ * Document #scheduled_messages ([#45][])
59
+ * Add support for deleting scheduled triggers ([#47][])
60
+
61
+ ### Changed
62
+
63
+ * Standardize rest test code structure ([#44][])
64
+
65
+ ### Fixed
66
+
67
+ * Fix typo in README code example ([#46][])
68
+
69
+ ## [0.7.0][] - 2021-09-29
70
+
71
+ ### Added
72
+
73
+ * Add campaign scheduling endpoint ([#41][])
74
+
75
+ ### Fixed
76
+
77
+ * Fix syntax error in "send campaigns" example ([#38][])
78
+
79
+ ## [0.6.0][] - 2021-07-23
80
+
81
+ ### Added
82
+
83
+ * Add retry configuration pass through ([#31][])
84
+ * Endpoint for 'remove email address from spam' ([#32][])
85
+ * Ability to set Faraday connection options ([#34][])
86
+
87
+ ### Changed
88
+
89
+ * Publish via GitHub actions ([#36][])
90
+ * Allow options when exporting users by ids ([#37][])
91
+
92
+ ## [0.5.0][] - 2021-05-06
93
+
94
+ ### Added
95
+
96
+ * Add .circleci/config.yml ([#25][])
97
+ * Setup and comply with standardrb ([#28][])
98
+ * Add release workflow to publish gem from CI ([#29][])
99
+ * Add script to help automate releases ([#30][])
100
+
101
+ ### Changed
102
+
103
+ * Modernize a few files and tinker with CI setup ([#26][])
104
+ * Update authors and license ([#27][])
105
+
106
+ [Unreleased]: https://github.com/jonallured/braze_ruby/compare/v0.10.0...HEAD
107
+
108
+ [0.5.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.5.0
109
+ [0.6.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.6.0
110
+ [0.7.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.7.0
111
+ [0.8.0]: https://github.com/jonallured/braze_ruby/releases/tag/v0.8.0
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
114
+
115
+ [#25]: https://github.com/jonallured/braze_ruby/pull/25
116
+ [#26]: https://github.com/jonallured/braze_ruby/pull/26
117
+ [#27]: https://github.com/jonallured/braze_ruby/pull/27
118
+ [#28]: https://github.com/jonallured/braze_ruby/pull/28
119
+ [#29]: https://github.com/jonallured/braze_ruby/pull/29
120
+ [#30]: https://github.com/jonallured/braze_ruby/pull/30
121
+ [#31]: https://github.com/jonallured/braze_ruby/pull/31
122
+ [#32]: https://github.com/jonallured/braze_ruby/pull/32
123
+ [#34]: https://github.com/jonallured/braze_ruby/pull/34
124
+ [#36]: https://github.com/jonallured/braze_ruby/pull/36
125
+ [#37]: https://github.com/jonallured/braze_ruby/pull/37
126
+ [#38]: https://github.com/jonallured/braze_ruby/pull/38
127
+ [#41]: https://github.com/jonallured/braze_ruby/pull/41
128
+ [#42]: https://github.com/jonallured/braze_ruby/pull/42
129
+ [#43]: https://github.com/jonallured/braze_ruby/pull/43
130
+ [#44]: https://github.com/jonallured/braze_ruby/pull/44
131
+ [#45]: https://github.com/jonallured/braze_ruby/pull/45
132
+ [#46]: https://github.com/jonallured/braze_ruby/pull/46
133
+ [#47]: https://github.com/jonallured/braze_ruby/pull/47
134
+ [#60]: https://github.com/jonallured/braze_ruby/pull/60
135
+ [#61]: https://github.com/jonallured/braze_ruby/pull/61
136
+ [#62]: https://github.com/jonallured/braze_ruby/pull/62
137
+ [#63]: https://github.com/jonallured/braze_ruby/pull/63
138
+ [#64]: https://github.com/jonallured/braze_ruby/pull/64
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/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Jon Allured
3
+ Copyright (c) 2024 Jon Allured
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -19,22 +19,43 @@ Or install it yourself as:
19
19
 
20
20
  ### Configuration
21
21
 
22
- Configuration options may be passed when a new API object is instantiated:
22
+ Configuration settings may be passed when a new API object is instantiated:
23
23
 
24
24
  ```ruby
25
- BrazeRuby::API.new('<braze-rest-api-key>', '<braze-rest-url', {<additional options>})
25
+ api_key = "instance-api-key"
26
+ braze_url = "instance-braze-url"
27
+ options = { key: "instance-options" }
28
+
29
+ api = BrazeRuby::API.new(api_key, braze_url, options)
30
+
31
+ api.api_key
32
+ # => "instance-api-key"
33
+ api.braze_url
34
+ # => "instance-braze-url"
35
+ api.options
36
+ # => {:key=>"instance-options"}
26
37
  ```
27
38
 
28
39
  Alternatively, you can pass your [Braze REST API key][braze_api_key], [Braze
29
40
  REST URL][braze_url], and any required [Faraday options][faraday_options] to the
30
- `BrazeRuby::configure` method:
41
+ `BrazeRuby::configure` method. Then, if you instantiate an API object with no
42
+ arguments it will use these global configuration settings:
31
43
 
32
44
  ```ruby
33
45
  BrazeRuby.configure do |config|
34
- config.rest_api_key = '<braze-rest-api-key>'
35
- config.rest_url = '<braze-rest-url>'
36
- config.options = {<additional options>}
46
+ config.rest_api_key = "global-api-key"
47
+ config.rest_url = "global-braze-url"
48
+ config.options = { key: "global-options" }
37
49
  end
50
+
51
+ api = BrazeRuby::API.new
52
+
53
+ api.api_key
54
+ # => "global-api-key"
55
+ api.braze_url
56
+ # => "global-braze-url"
57
+ api.options
58
+ # => {:key=>"global-options"}
38
59
  ```
39
60
 
40
61
  ## Examples
@@ -296,6 +317,83 @@ api.email_hard_bounces(email: ['jdoe@example.com'])
296
317
  api.remove_emails_from_spam(email: ['jdoe@example.com'])
297
318
  ```
298
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
+
299
397
  ## Debugging
300
398
 
301
399
  The BRAZE_RUBY_DEBUG environment variable will trigger full printouts of the
@@ -307,6 +405,18 @@ export BRAZE_RUBY_DEBUG=true
307
405
  bundle exec rails whatever
308
406
  ```
309
407
 
408
+ ## Releasing
409
+
410
+ Before releasing the CHANGELOG should be updated so that the new version has
411
+ it's own section and an empty Unreleased section is ready for the next change.
412
+ New versions are released by running a script locally that bumps the minor level
413
+ of the gem and then pushes to a GitHub Action that actually sends the new
414
+ version to RubyGems.org:
415
+
416
+ ```
417
+ $ ./bin/release
418
+ ```
419
+
310
420
  ## Contributing
311
421
 
312
422
  1. Fork it
@@ -314,6 +424,7 @@ bundle exec rails whatever
314
424
  3. Commit your changes (`git commit -am 'Add some feature'`)
315
425
  4. Push to the branch (`git push origin my-new-feature`)
316
426
  5. Create new Pull Request
427
+ 6. Update CHANGELOG
317
428
 
318
429
  [badge]: https://circleci.com/gh/jonallured/braze_ruby.svg?style=svg
319
430
  [braze_api_key]: https://www.braze.com/docs/api/api_key/
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "braze_ruby"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "irb"
10
+ IRB.start(__FILE__)
data/bin/release CHANGED
@@ -1,16 +1,6 @@
1
1
  #! /bin/sh
2
2
  set -ex
3
3
 
4
- old_version=$1
5
- new_version=$2
6
-
7
- version_files="lib/braze_ruby/version.rb Gemfile.lock"
8
- commit_message="Bumping version numbers for $new_version"
9
- tag_message="Tagging version $new_version"
10
-
11
- sed -i "" "s/$old_version/$new_version/g" $version_files
12
- git add .
13
- git commit --message "$commit_message"
4
+ bundle exec bump minor --tag
14
5
  git push origin main
15
- git tag --annotate v$new_version --message "$tag_message"
16
6
  git push origin --tags
data/braze_ruby.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |spec|
4
4
  spec.name = "braze_ruby"
5
5
  spec.version = BrazeRuby::VERSION
6
6
  spec.authors = ["Josh Nussbaum", "Hugo Bastien", "Justin Boltz", "Jonathan Allured"]
7
- spec.email = %w[josh@godynamo.com hugo@godynamo.com justin.boltz@takl.com jon.allured@gmail.com]
7
+ spec.email = %w[josh@godynamo.com hugo@godynamo.com justin.boltz@takl.com jon@jonallured.com]
8
8
 
9
9
  spec.summary = "A wrapper gem for the Braze REST API."
10
10
  spec.description = "Wrapper for Braze API"
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
19
19
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
20
20
  end
21
21
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
22
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
22
  spec.require_paths = ["lib"]
24
23
 
25
24
  spec.add_dependency "faraday"
26
25
 
26
+ spec.add_development_dependency "bump"
27
27
  spec.add_development_dependency "dotenv"
28
28
  spec.add_development_dependency "factory_bot"
29
29
  spec.add_development_dependency "pry"
@@ -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
@@ -43,10 +45,10 @@ module BrazeRuby
43
45
 
44
46
  attr_reader :api_key, :braze_url, :options
45
47
 
46
- def initialize(api_key, braze_url, options = {})
47
- @api_key = api_key || configuration.rest_api_key
48
- @braze_url = braze_url || configuration.rest_url
49
- @options = options || configuration.options
48
+ def initialize(api_key = nil, braze_url = nil, options = nil)
49
+ @api_key = api_key || BrazeRuby.configuration.rest_api_key
50
+ @braze_url = braze_url || BrazeRuby.configuration.rest_url
51
+ @options = options || BrazeRuby.configuration.options || {}
50
52
  end
51
53
  end
52
54
  end
@@ -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"
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -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
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -8,7 +8,7 @@ module BrazeRuby
8
8
  def initialize(api_key, braze_url, options, email: nil, status: nil)
9
9
  @email = email
10
10
  @status = status
11
- super api_key, braze_url, options
11
+ super(api_key, braze_url, options)
12
12
  end
13
13
 
14
14
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -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
@@ -10,7 +10,7 @@ module BrazeRuby
10
10
  @time = time
11
11
  @external_user_ids = external_user_ids
12
12
  @in_local_time = in_local_time
13
- super api_key, braze_url, options
13
+ super(api_key, braze_url, options)
14
14
  end
15
15
 
16
16
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -8,7 +8,7 @@ module BrazeRuby
8
8
  def initialize(api_key, braze_url, options, messages: [], external_user_ids: [])
9
9
  @messages = messages
10
10
  @external_user_ids = external_user_ids
11
- super api_key, braze_url, options
11
+ super(api_key, braze_url, options)
12
12
  end
13
13
 
14
14
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -7,7 +7,7 @@ module BrazeRuby
7
7
 
8
8
  def initialize(api_key, braze_url, options, **params)
9
9
  @params = params
10
- super api_key, braze_url, options
10
+ super(api_key, braze_url, options)
11
11
  end
12
12
 
13
13
  def perform
@@ -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.8.0"
4
+ VERSION = "0.10.0"
5
5
  end
data/lib/braze_ruby.rb CHANGED
@@ -16,6 +16,10 @@ module BrazeRuby
16
16
  @configuration ||= Configuration.new
17
17
  end
18
18
 
19
+ def self.reset
20
+ @configuration = Configuration.new
21
+ end
22
+
19
23
  def self.configure
20
24
  yield(configuration)
21
25
  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.8.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: 2022-01-24 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
@@ -27,6 +27,20 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bump
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: dotenv
32
46
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +158,7 @@ email:
144
158
  - josh@godynamo.com
145
159
  - hugo@godynamo.com
146
160
  - justin.boltz@takl.com
147
- - jon.allured@gmail.com
161
+ - jon@jonallured.com
148
162
  executables: []
149
163
  extensions: []
150
164
  extra_rdoc_files: []
@@ -155,10 +169,12 @@ files:
155
169
  - ".gitignore"
156
170
  - ".rspec"
157
171
  - ".standard.yml"
172
+ - CHANGELOG.md
158
173
  - Gemfile
159
174
  - LICENSE.txt
160
175
  - README.md
161
176
  - Rakefile
177
+ - bin/console
162
178
  - bin/release
163
179
  - braze_ruby.gemspec
164
180
  - lib/braze_ruby.rb
@@ -168,6 +184,7 @@ files:
168
184
  - lib/braze_ruby/endpoints.rb
169
185
  - lib/braze_ruby/endpoints/campaigns.rb
170
186
  - lib/braze_ruby/endpoints/canvas.rb
187
+ - lib/braze_ruby/endpoints/catalogs.rb
171
188
  - lib/braze_ruby/endpoints/create_user_aliases.rb
172
189
  - lib/braze_ruby/endpoints/delete_users.rb
173
190
  - lib/braze_ruby/endpoints/email_status.rb
@@ -184,7 +201,11 @@ files:
184
201
  - lib/braze_ruby/rest.rb
185
202
  - lib/braze_ruby/rest/base.rb
186
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
187
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
188
209
  - lib/braze_ruby/rest/delete_trigger_campaign_schedule.rb
189
210
  - lib/braze_ruby/rest/delete_users.rb
190
211
  - lib/braze_ruby/rest/email_hard_bounces.rb
@@ -192,6 +213,7 @@ files:
192
213
  - lib/braze_ruby/rest/email_unsubscribes.rb
193
214
  - lib/braze_ruby/rest/export_users.rb
194
215
  - lib/braze_ruby/rest/identify_users.rb
216
+ - lib/braze_ruby/rest/list_catalogs.rb
195
217
  - lib/braze_ruby/rest/list_segments.rb
196
218
  - lib/braze_ruby/rest/remove_email_addresses_from_spam.rb
197
219
  - lib/braze_ruby/rest/remove_external_ids.rb
@@ -206,6 +228,7 @@ files:
206
228
  - lib/braze_ruby/rest/trigger_campaign_schedule.rb
207
229
  - lib/braze_ruby/rest/trigger_campaign_send.rb
208
230
  - lib/braze_ruby/rest/trigger_canvas_send.rb
231
+ - lib/braze_ruby/rest/update_catalog_items.rb
209
232
  - lib/braze_ruby/version.rb
210
233
  homepage: https://github.com/jonallured/braze_ruby
211
234
  licenses:
@@ -228,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
251
  - !ruby/object:Gem::Version
229
252
  version: '0'
230
253
  requirements: []
231
- rubygems_version: 3.1.2
254
+ rubygems_version: 3.3.5
232
255
  signing_key:
233
256
  specification_version: 4
234
257
  summary: A wrapper gem for the Braze REST API.