braze_ruby 0.3.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +57 -0
- data/.circleci/gem_credentials +2 -0
- data/.circleci/setup-rubygems +6 -0
- data/.gitignore +12 -19
- data/.standard.yml +1 -0
- data/Gemfile +1 -2
- data/LICENSE.txt +17 -18
- data/README.md +49 -2
- data/Rakefile +2 -1
- data/bin/release +16 -0
- data/braze_ruby.gemspec +28 -31
- data/lib/braze_ruby.rb +4 -4
- data/lib/braze_ruby/api.rb +20 -14
- data/lib/braze_ruby/deprecated.rb +4 -4
- data/lib/braze_ruby/endpoints.rb +10 -7
- data/lib/braze_ruby/endpoints/campaigns.rb +1 -1
- data/lib/braze_ruby/endpoints/canvas.rb +2 -2
- data/lib/braze_ruby/endpoints/create_user_aliases.rb +19 -0
- data/lib/braze_ruby/endpoints/delete_users.rb +2 -2
- data/lib/braze_ruby/endpoints/email_status.rb +1 -1
- data/lib/braze_ruby/endpoints/email_sync.rb +2 -2
- data/lib/braze_ruby/endpoints/identify_users.rb +2 -2
- data/lib/braze_ruby/endpoints/remove_external_ids.rb +19 -0
- data/lib/braze_ruby/endpoints/rename_external_ids.rb +19 -0
- data/lib/braze_ruby/endpoints/schedule_messages.rb +1 -1
- data/lib/braze_ruby/endpoints/send_messages.rb +1 -1
- data/lib/braze_ruby/endpoints/subscription.rb +3 -4
- data/lib/braze_ruby/endpoints/track_users.rb +5 -5
- data/lib/braze_ruby/http.rb +21 -8
- data/lib/braze_ruby/rest.rb +20 -17
- data/lib/braze_ruby/rest/base.rb +5 -3
- data/lib/braze_ruby/rest/canvas_details.rb +4 -6
- data/lib/braze_ruby/rest/create_user_aliases.rb +13 -0
- data/lib/braze_ruby/rest/delete_users.rb +3 -4
- data/lib/braze_ruby/rest/email_hard_bounces.rb +4 -6
- data/lib/braze_ruby/rest/email_status.rb +6 -8
- data/lib/braze_ruby/rest/email_unsubscribes.rb +4 -6
- data/lib/braze_ruby/rest/export_users.rb +9 -11
- data/lib/braze_ruby/rest/identify_users.rb +3 -4
- data/lib/braze_ruby/rest/list_segments.rb +2 -4
- data/lib/braze_ruby/rest/remove_external_ids.rb +13 -0
- data/lib/braze_ruby/rest/rename_external_ids.rb +13 -0
- data/lib/braze_ruby/rest/schedule_messages.rb +9 -11
- data/lib/braze_ruby/rest/send_messages.rb +6 -8
- data/lib/braze_ruby/rest/subscription_status_get.rb +4 -6
- data/lib/braze_ruby/rest/subscription_status_set.rb +4 -6
- data/lib/braze_ruby/rest/subscription_user_status.rb +4 -6
- data/lib/braze_ruby/rest/track_users.rb +5 -6
- data/lib/braze_ruby/rest/trigger_campaign_send.rb +4 -8
- data/lib/braze_ruby/rest/trigger_canvas_send.rb +4 -6
- data/lib/braze_ruby/version.rb +1 -1
- metadata +61 -175
- data/.github/workflows/ci.yml +0 -19
- data/Gemfile.lock +0 -78
- data/spec/braze_ruby/api_spec.rb +0 -6
- data/spec/braze_ruby/endpoints/delete_users_spec.rb +0 -31
- data/spec/braze_ruby/endpoints/track_users_spec.rb +0 -74
- data/spec/braze_ruby/rest/delete_users_spec.rb +0 -22
- data/spec/braze_ruby/rest/email_status_spec.rb +0 -21
- data/spec/braze_ruby/rest/export_users_spec.rb +0 -21
- data/spec/braze_ruby/rest/identify_users_spec.rb +0 -23
- data/spec/braze_ruby/rest/schedule_messages_spec.rb +0 -38
- data/spec/braze_ruby/rest/send_messages_spec.rb +0 -35
- data/spec/braze_ruby/rest/track_users_spec.rb +0 -26
- data/spec/factories.rb +0 -38
- data/spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml +0 -69
- data/spec/fixtures/responses/canvas/details/returns_error_when_no_canvas.yml +0 -67
- data/spec/fixtures/responses/canvas/trigger_send/sends_a_canvas.yml +0 -69
- data/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml +0 -66
- data/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml +0 -69
- data/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml +0 -69
- data/spec/fixtures/responses/email_status/existing_email/responds_with_created.yml +0 -69
- data/spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml +0 -69
- data/spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml +0 -69
- data/spec/fixtures/responses/email_status/unknown_email/responds_with_success_message.yml +0 -69
- data/spec/fixtures/responses/email_sync/hard_bounces/responds_with_empty_array_when_no_hard_bounces.yml +0 -73
- data/spec/fixtures/responses/email_sync/unsubscribes/responds_with_empty_array_when_no_unsubscribes.yml +0 -73
- data/spec/fixtures/responses/email_sync/unsubscribes/responds_with_unsubscribed_emails.yml +0 -74
- data/spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml +0 -69
- data/spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml +0 -69
- data/spec/fixtures/responses/identify_users/unauthorized/responds_with_unauthorized.yml +0 -66
- data/spec/fixtures/responses/identify_users/with_success/responds_with_created.yml +0 -69
- data/spec/fixtures/responses/identify_users/with_success/responds_with_success_message.yml +0 -69
- data/spec/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml +0 -81
- data/spec/fixtures/responses/list_segments/with_success/responds_with_success.yml +0 -81
- data/spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml +0 -67
- data/spec/fixtures/responses/schedule_messages/with_success/responds_with_created.yml +0 -70
- data/spec/fixtures/responses/schedule_messages/with_success/responds_with_success_message.yml +0 -70
- data/spec/fixtures/responses/send_messages/unauthorized/responds_with_unauthorized.yml +0 -66
- data/spec/fixtures/responses/send_messages/with_success/responds_with_created.yml +0 -69
- data/spec/fixtures/responses/send_messages/with_success/responds_with_success_message.yml +0 -69
- data/spec/fixtures/responses/subscription/subscription_status_set/when_subscribing/subscribes_the_user.yml +0 -69
- data/spec/fixtures/responses/subscription/subscription_status_set/when_subscription_group_does_not_exist/returns_an_error_status.yml +0 -66
- data/spec/fixtures/responses/subscription/subscription_status_set/when_unsubscribing/unsubscribes_the_user.yml +0 -135
- data/spec/fixtures/responses/subscription/when_getting_subscription_group_statuses/subscription_status_get/when_checking_subscribed_and_unsubscribed_user_status/returns_only_users_that_were_once_subscribed.yml +0 -205
- data/spec/fixtures/responses/subscription/when_getting_subscription_group_statuses/subscription_status_get/when_group_does_not_exist/returns_an_error.yml +0 -193
- data/spec/fixtures/responses/subscription/when_getting_subscription_group_statuses/subscription_user_status/returns_subscription_groups_and_status_for_every_group.yml +0 -207
- data/spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml +0 -68
- data/spec/fixtures/responses/track_users/with_success/responds_with_created.yml +0 -71
- data/spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml +0 -71
- data/spec/integrations/campaigns_spec.rb +0 -17
- data/spec/integrations/canvas_spec.rb +0 -26
- data/spec/integrations/delete_users_spec.rb +0 -31
- data/spec/integrations/email_status_spec.rb +0 -38
- data/spec/integrations/email_sync_spec.rb +0 -31
- data/spec/integrations/export_users_spec.rb +0 -29
- data/spec/integrations/identify_users_spec.rb +0 -32
- data/spec/integrations/list_segments_spec.rb +0 -21
- data/spec/integrations/schedule_messages_spec.rb +0 -33
- data/spec/integrations/send_messages_spec.rb +0 -32
- data/spec/integrations/subscription_spec.rb +0 -149
- data/spec/integrations/track_users_spec.rb +0 -37
- data/spec/spec_helper.rb +0 -33
- data/spec/support/factory_bot.rb +0 -12
- data/spec/support/integrations.rb +0 -23
- data/spec/support/vcr.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae77ca2f5ea9cf492d7f681c37fcbff40f912b8ce8ac9db237a9b91e8c5fc76a
|
4
|
+
data.tar.gz: 033f2a42048dfff0af864534900a5405ba5a56099e3630c23512f73a30a56468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d8ff06c45f2e3d90e000c9093118c80d85136e77961cf5cf6bbdf1d45dd57b704905b1ff5388413df142773cd2e76a2473e92b9e2edcdbc85752ed09a6d111
|
7
|
+
data.tar.gz: 409c1603839abd4bf95c0096c54c936ea6fa438f350d368b8e3e117b1d1a17a082c55991c53fd4d75c2b67a2649792c01330db2e7f58ef94896cd00fe8f5bbaf
|
@@ -0,0 +1,57 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
parameters:
|
6
|
+
ruby-version:
|
7
|
+
type: string
|
8
|
+
docker:
|
9
|
+
- image: << parameters.ruby-version >>
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
|
13
|
+
- run:
|
14
|
+
name: Gem install bundler
|
15
|
+
command: gem update --system && gem install bundler
|
16
|
+
|
17
|
+
- run:
|
18
|
+
name: Bundle install
|
19
|
+
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
20
|
+
|
21
|
+
- run:
|
22
|
+
name: Run tests
|
23
|
+
command: bundle exec rake
|
24
|
+
|
25
|
+
publish:
|
26
|
+
docker:
|
27
|
+
- image: ruby:3.0.0
|
28
|
+
steps:
|
29
|
+
- checkout
|
30
|
+
|
31
|
+
- run:
|
32
|
+
name: Setup Rubygems
|
33
|
+
command: bash .circleci/setup-rubygems
|
34
|
+
|
35
|
+
- run:
|
36
|
+
name: Build gem
|
37
|
+
command: gem build braze_ruby.gemspec --output braze_ruby.gem
|
38
|
+
|
39
|
+
- run:
|
40
|
+
name: Publish gem
|
41
|
+
command: gem push braze_ruby.gem
|
42
|
+
|
43
|
+
workflows:
|
44
|
+
all-tests:
|
45
|
+
jobs:
|
46
|
+
- test:
|
47
|
+
matrix:
|
48
|
+
parameters:
|
49
|
+
ruby-version: ["ruby:3.0.0", "ruby:2.7.2", "ruby:2.6.3"]
|
50
|
+
release:
|
51
|
+
jobs:
|
52
|
+
- publish:
|
53
|
+
filters:
|
54
|
+
tags:
|
55
|
+
only: /^v.*/
|
56
|
+
branches:
|
57
|
+
ignore: /.*/
|
data/.gitignore
CHANGED
@@ -1,19 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
lib/bundler/man
|
14
|
-
pkg
|
15
|
-
rdoc
|
16
|
-
spec/reports
|
17
|
-
test/tmp
|
18
|
-
test/version_tmp
|
19
|
-
tmp
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
Gemfile.lock
|
10
|
+
|
11
|
+
# rspec failure tracking
|
12
|
+
.rspec_status
|
data/.standard.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
format: progress
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2021 Jon Allured
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# BrazeRuby
|
1
|
+
# BrazeRuby [![CircleCI][badge]][circle]
|
2
2
|
|
3
3
|
A wrapper for the Braze REST API. Forked from https://github.com/DynamoMTL/appboy
|
4
4
|
|
@@ -187,7 +187,20 @@ api.subscription_status_set(
|
|
187
187
|
)
|
188
188
|
```
|
189
189
|
|
190
|
-
### User
|
190
|
+
### User Alias
|
191
|
+
|
192
|
+
#### Create an alias-only user
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
api.create_user_aliases(
|
196
|
+
user_aliases: [{
|
197
|
+
user_alias: {
|
198
|
+
alias_name: "device123",
|
199
|
+
alias_label: "my_device_identifier",
|
200
|
+
}
|
201
|
+
}]
|
202
|
+
)
|
203
|
+
```
|
191
204
|
|
192
205
|
#### Identify an alias-only user
|
193
206
|
```ruby
|
@@ -202,6 +215,37 @@ api.identify_users(
|
|
202
215
|
)
|
203
216
|
```
|
204
217
|
|
218
|
+
### External ID Migration
|
219
|
+
|
220
|
+
#### Rename users' external IDs with an array of external_id_renames
|
221
|
+
Note: you can send up to 50 rename objects per request.
|
222
|
+
```ruby
|
223
|
+
api.rename_external_ids(
|
224
|
+
external_id_renames: [{
|
225
|
+
current_external_id: "old_external_id",
|
226
|
+
new_external_id: "new_external_id",
|
227
|
+
}]
|
228
|
+
)
|
229
|
+
```
|
230
|
+
|
231
|
+
#### Remove users' old deprecated external IDs
|
232
|
+
Note: you can send up to 50 external IDs per request.
|
233
|
+
```ruby
|
234
|
+
api.remove_external_ids(external_ids: ['old_external_id'])
|
235
|
+
```
|
236
|
+
|
237
|
+
### Email Sync
|
238
|
+
|
239
|
+
#### Get List of or Query Email Unsubscribes
|
240
|
+
```ruby
|
241
|
+
api.email_unsubscribes(email: ['jdoe@example.com'])
|
242
|
+
```
|
243
|
+
|
244
|
+
#### Get List of or Query Hard Bounced Emails
|
245
|
+
```ruby
|
246
|
+
api.email_hard_bounces(email: ['jdoe@example.com'])
|
247
|
+
```
|
248
|
+
|
205
249
|
## Debugging
|
206
250
|
|
207
251
|
The BRAZE_RUBY_DEBUG environment variable will trigger full printouts of the Faraday gem's HTTP requests and responses.
|
@@ -219,3 +263,6 @@ bundle exec rails whatever
|
|
219
263
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
220
264
|
4. Push to the branch (`git push origin my-new-feature`)
|
221
265
|
5. Create new Pull Request
|
266
|
+
|
267
|
+
[badge]: https://circleci.com/gh/jonallured/braze_ruby.svg?style=svg
|
268
|
+
[circle]: https://circleci.com/gh/jonallured/braze_ruby
|
data/Rakefile
CHANGED
data/bin/release
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
set -ex
|
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"
|
14
|
+
git push origin main
|
15
|
+
git tag --annotate v$new_version --message "$tag_message"
|
16
|
+
git push origin --tags
|
data/braze_ruby.gemspec
CHANGED
@@ -1,38 +1,35 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'braze_ruby/version'
|
1
|
+
require_relative "lib/braze_ruby/version"
|
4
2
|
|
5
3
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
10
|
-
spec.description = %q{Braze wrapper}
|
11
|
-
spec.summary = %q{A wrapper for the Braze REST API forked from the appboy gem, track users/events/purchases, send & schedule messages}
|
12
|
-
spec.homepage = 'https://www.braze.com/'
|
13
|
-
spec.license = 'MIT'
|
4
|
+
spec.name = "braze_ruby"
|
5
|
+
spec.version = BrazeRuby::VERSION
|
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]
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
9
|
+
spec.summary = "A wrapper gem for the Braze REST API."
|
10
|
+
spec.description = "Wrapper for Braze API"
|
11
|
+
spec.homepage = "https://github.com/jonallured/braze_ruby"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
17
|
|
22
|
-
spec.files
|
23
|
-
|
24
|
-
|
25
|
-
spec.
|
26
|
-
spec.
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
22
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
+
spec.require_paths = ["lib"]
|
27
24
|
|
28
|
-
spec.add_dependency
|
25
|
+
spec.add_dependency "faraday"
|
29
26
|
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency
|
37
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency "dotenv"
|
28
|
+
spec.add_development_dependency "factory_bot"
|
29
|
+
spec.add_development_dependency "pry"
|
30
|
+
spec.add_development_dependency "rake"
|
31
|
+
spec.add_development_dependency "rspec"
|
32
|
+
spec.add_development_dependency "standard"
|
33
|
+
spec.add_development_dependency "vcr"
|
34
|
+
spec.add_development_dependency "webmock"
|
38
35
|
end
|
data/lib/braze_ruby.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "braze_ruby/version"
|
4
4
|
|
5
5
|
module BrazeRuby
|
6
|
-
autoload :API,
|
7
|
-
autoload :REST,
|
8
|
-
autoload :Endpoints,
|
6
|
+
autoload :API, "braze_ruby/api"
|
7
|
+
autoload :REST, "braze_ruby/rest"
|
8
|
+
autoload :Endpoints, "braze_ruby/endpoints"
|
9
9
|
end
|
data/lib/braze_ruby/api.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
3
|
+
require "braze_ruby/deprecated"
|
4
|
+
require "braze_ruby/endpoints/track_users"
|
5
|
+
require "braze_ruby/endpoints/send_messages"
|
6
|
+
require "braze_ruby/endpoints/schedule_messages"
|
7
|
+
require "braze_ruby/endpoints/email_status"
|
8
|
+
require "braze_ruby/endpoints/email_sync"
|
9
|
+
require "braze_ruby/endpoints/delete_users"
|
10
|
+
require "braze_ruby/endpoints/campaigns"
|
11
|
+
require "braze_ruby/endpoints/canvas"
|
12
|
+
require "braze_ruby/endpoints/subscription"
|
13
|
+
require "braze_ruby/endpoints/rename_external_ids"
|
14
|
+
require "braze_ruby/endpoints/remove_external_ids"
|
13
15
|
|
14
16
|
module BrazeRuby
|
15
17
|
class API
|
@@ -25,20 +27,24 @@ module BrazeRuby
|
|
25
27
|
include BrazeRuby::Endpoints::Canvas
|
26
28
|
include BrazeRuby::Endpoints::Subscription
|
27
29
|
include BrazeRuby::Endpoints::IdentifyUsers
|
30
|
+
include BrazeRuby::Endpoints::CreateUserAliases
|
31
|
+
include BrazeRuby::Endpoints::RenameExternalIds
|
32
|
+
include BrazeRuby::Endpoints::RemoveExternalIds
|
28
33
|
|
29
34
|
def export_users(**payload)
|
30
|
-
BrazeRuby::REST::ExportUsers.new(braze_url).perform(
|
35
|
+
BrazeRuby::REST::ExportUsers.new(api_key, braze_url, options).perform(**payload)
|
31
36
|
end
|
32
37
|
|
33
38
|
def list_segments
|
34
|
-
BrazeRuby::REST::ListSegments.new(braze_url).perform
|
39
|
+
BrazeRuby::REST::ListSegments.new(api_key, braze_url, options).perform
|
35
40
|
end
|
36
41
|
|
37
|
-
attr_reader :api_key, :braze_url
|
42
|
+
attr_reader :api_key, :braze_url, :options
|
38
43
|
|
39
|
-
def initialize(api_key, braze_url)
|
44
|
+
def initialize(api_key, braze_url, options = {})
|
40
45
|
@api_key = api_key
|
41
46
|
@braze_url = braze_url
|
47
|
+
@options = options
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -3,19 +3,19 @@
|
|
3
3
|
module BrazeRuby
|
4
4
|
module Deprecated
|
5
5
|
def track(attribute, events = [], purchases = [])
|
6
|
-
warn(
|
6
|
+
warn("[BrazeRuby] `track` is deprecated. Please use `track_users` instead.")
|
7
7
|
track_users(attribute: attribute, events: events, purchases: purchases)
|
8
8
|
end
|
9
9
|
|
10
10
|
def send_message(message, user_ids, segment_ids = nil)
|
11
|
-
warn(
|
11
|
+
warn("[BrazeRuby] `send_message` is deprecated. Please use `send_messages` instead.")
|
12
12
|
send_messages(messages: message, user_ids: user_ids, segment_ids: segment_ids)
|
13
13
|
end
|
14
14
|
|
15
15
|
def schedule_message(date, message, segment_id, local_timezone = false)
|
16
|
-
warn(
|
16
|
+
warn("[BrazeRuby] `schedule_message` is deprecated. Please use `schedule_messages` instead.")
|
17
17
|
schedule_messages(send_at: date, messages: message,
|
18
|
-
|
18
|
+
segment_id: segment_id, local_timezone: local_timezone)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/braze_ruby/endpoints.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
3
|
+
require "braze_ruby/endpoints/email_status"
|
4
|
+
require "braze_ruby/endpoints/email_sync"
|
5
|
+
require "braze_ruby/endpoints/schedule_messages"
|
6
|
+
require "braze_ruby/endpoints/send_messages"
|
7
|
+
require "braze_ruby/endpoints/track_users"
|
8
|
+
require "braze_ruby/endpoints/delete_users"
|
9
|
+
require "braze_ruby/endpoints/identify_users"
|
10
|
+
require "braze_ruby/endpoints/create_user_aliases"
|
11
|
+
require "braze_ruby/endpoints/rename_external_ids"
|
12
|
+
require "braze_ruby/endpoints/remove_external_ids"
|