braze_ruby 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -17
- data/README.md +9 -0
- data/lib/braze_ruby/api.rb +2 -0
- data/lib/braze_ruby/endpoints/campaigns.rb +9 -0
- data/lib/braze_ruby/rest.rb +1 -0
- data/lib/braze_ruby/rest/trigger_campaign_send.rb +20 -0
- data/lib/braze_ruby/version.rb +1 -1
- data/spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml +69 -0
- data/spec/integrations/campaigns_spec.rb +15 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5649f519796cde810f2c2e2028c5a14fbcdfc7c6d93cf33043068fb4195b481
|
4
|
+
data.tar.gz: b81d2eed4f84937c0bd4721318c2474f36e987d97418961fb407744dcee068fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 766e1d5e83222af37ba40d6e1333ea6e350b4e9ae327e943a31dfc60772253368a67fe8048b5ef72681759ce8e1ab13a7bdeb6c77fe92c82f167094881c22830
|
7
|
+
data.tar.gz: a1011b8b5f84bba75a5eae4bb1535d0582788ea10ef838b6821912a05dad3f3abc06bc4033a93004c3554b05ca949d74f40916caa4115f2dc9087cf066f418bf
|
data/Gemfile.lock
CHANGED
@@ -1,62 +1,64 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
braze_ruby (0.2.
|
4
|
+
braze_ruby (0.2.1)
|
5
5
|
faraday
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
10
|
+
activesupport (6.0.0)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 0.7, < 2)
|
13
13
|
minitest (~> 5.1)
|
14
14
|
tzinfo (~> 1.1)
|
15
|
-
|
16
|
-
|
15
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
16
|
+
addressable (2.7.0)
|
17
|
+
public_suffix (>= 2.0.2, < 5.0)
|
17
18
|
coderay (1.1.2)
|
18
19
|
concurrent-ruby (1.1.5)
|
19
20
|
crack (0.4.3)
|
20
21
|
safe_yaml (~> 1.0.0)
|
21
22
|
diff-lcs (1.3)
|
22
|
-
dotenv (2.7.
|
23
|
+
dotenv (2.7.5)
|
23
24
|
factory_bot (5.0.2)
|
24
25
|
activesupport (>= 4.2.0)
|
25
26
|
faraday (0.15.4)
|
26
27
|
multipart-post (>= 1.2, < 3)
|
27
|
-
hashdiff (0.
|
28
|
+
hashdiff (1.0.0)
|
28
29
|
i18n (1.6.0)
|
29
30
|
concurrent-ruby (~> 1.0)
|
30
31
|
method_source (0.9.2)
|
31
32
|
minitest (5.11.3)
|
32
|
-
multipart-post (2.
|
33
|
+
multipart-post (2.1.1)
|
33
34
|
pry (0.12.2)
|
34
35
|
coderay (~> 1.1.0)
|
35
36
|
method_source (~> 0.9.0)
|
36
|
-
public_suffix (
|
37
|
-
rake (12.3.
|
37
|
+
public_suffix (4.0.1)
|
38
|
+
rake (12.3.3)
|
38
39
|
rspec (3.8.0)
|
39
40
|
rspec-core (~> 3.8.0)
|
40
41
|
rspec-expectations (~> 3.8.0)
|
41
42
|
rspec-mocks (~> 3.8.0)
|
42
|
-
rspec-core (3.8.
|
43
|
+
rspec-core (3.8.2)
|
43
44
|
rspec-support (~> 3.8.0)
|
44
|
-
rspec-expectations (3.8.
|
45
|
+
rspec-expectations (3.8.4)
|
45
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
47
|
rspec-support (~> 3.8.0)
|
47
|
-
rspec-mocks (3.8.
|
48
|
+
rspec-mocks (3.8.1)
|
48
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
50
|
rspec-support (~> 3.8.0)
|
50
|
-
rspec-support (3.8.
|
51
|
+
rspec-support (3.8.2)
|
51
52
|
safe_yaml (1.0.5)
|
52
53
|
thread_safe (0.3.6)
|
53
54
|
tzinfo (1.2.5)
|
54
55
|
thread_safe (~> 0.1)
|
55
|
-
vcr (
|
56
|
-
webmock (3.
|
56
|
+
vcr (5.0.0)
|
57
|
+
webmock (3.7.1)
|
57
58
|
addressable (>= 2.3.6)
|
58
59
|
crack (>= 0.3.2)
|
59
|
-
hashdiff
|
60
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
61
|
+
zeitwerk (2.1.9)
|
60
62
|
|
61
63
|
PLATFORMS
|
62
64
|
ruby
|
@@ -73,4 +75,4 @@ DEPENDENCIES
|
|
73
75
|
webmock
|
74
76
|
|
75
77
|
BUNDLED WITH
|
76
|
-
2.0.
|
78
|
+
2.0.2
|
data/README.md
CHANGED
@@ -112,6 +112,15 @@ api.send_messages(messages: messages, segment_id: '<segment-id>')
|
|
112
112
|
api.schedule_messages(send_at: 1.hour.since, messages: messages, external_user_ids: [123, 456])
|
113
113
|
```
|
114
114
|
|
115
|
+
### Send Campaigns
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
api.trigger_campaign_send(
|
119
|
+
campaign_id: 'campaign-id',
|
120
|
+
recipients: [external_user_id: 123, trigger_properties: {first_name: 'John'}]
|
121
|
+
)
|
122
|
+
```
|
123
|
+
|
115
124
|
### Changing Email Subscription
|
116
125
|
|
117
126
|
```ruby
|
data/lib/braze_ruby/api.rb
CHANGED
@@ -5,6 +5,7 @@ require 'braze_ruby/endpoints/schedule_messages'
|
|
5
5
|
require 'braze_ruby/endpoints/email_status'
|
6
6
|
require 'braze_ruby/endpoints/email_sync'
|
7
7
|
require 'braze_ruby/endpoints/delete_users'
|
8
|
+
require 'braze_ruby/endpoints/campaigns'
|
8
9
|
|
9
10
|
module BrazeRuby
|
10
11
|
class API
|
@@ -16,6 +17,7 @@ module BrazeRuby
|
|
16
17
|
include BrazeRuby::Endpoints::EmailStatus
|
17
18
|
include BrazeRuby::Endpoints::EmailSync
|
18
19
|
include BrazeRuby::Endpoints::DeleteUsers
|
20
|
+
include BrazeRuby::Endpoints::Campaigns
|
19
21
|
|
20
22
|
def export_users(**payload)
|
21
23
|
BrazeRuby::REST::ExportUsers.new(braze_url).perform(api_key, payload)
|
data/lib/braze_ruby/rest.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module BrazeRuby
|
2
|
+
module REST
|
3
|
+
class TriggerCampaignSend < Base
|
4
|
+
attr_reader :api_key, :params
|
5
|
+
|
6
|
+
def initialize(api_key, braze_url, **params)
|
7
|
+
@api_key = api_key
|
8
|
+
@params = params
|
9
|
+
super braze_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform
|
13
|
+
http.post('/campaigns/trigger/send', {
|
14
|
+
'api_key': api_key,
|
15
|
+
**@params
|
16
|
+
})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/braze_ruby/version.rb
CHANGED
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: "<BRAZE_REST_URL>/campaigns/trigger/send"
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"api_key":"<BRAZE_REST_API_KEY>","campaign_id":"69e9b681-779c-4b4c-b6b8-cd74b17d21d2","recipients":[{"external_user_id":132404,"trigger_properties":{"first_name":"John"}}]}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Braze Ruby gem v0.2.0
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 201
|
21
|
+
message: Created
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, private, must-revalidate
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Etag:
|
28
|
+
- W/"838a7c62adda8d131d694ae13ba2c5b7"
|
29
|
+
Server:
|
30
|
+
- nginx
|
31
|
+
Strict-Transport-Security:
|
32
|
+
- max-age=0; includeSubDomains
|
33
|
+
- max-age=31536000; includeSubDomains
|
34
|
+
X-Ratelimit-Limit:
|
35
|
+
- '250000'
|
36
|
+
X-Ratelimit-Remaining:
|
37
|
+
- '249998'
|
38
|
+
X-Ratelimit-Reset:
|
39
|
+
- '1567425600'
|
40
|
+
X-Request-Id:
|
41
|
+
- e6f14e03-5226-45f3-9a9f-901a0139b071
|
42
|
+
X-Runtime:
|
43
|
+
- '0.019114'
|
44
|
+
Content-Length:
|
45
|
+
- '46'
|
46
|
+
Accept-Ranges:
|
47
|
+
- bytes
|
48
|
+
Date:
|
49
|
+
- Mon, 02 Sep 2019 11:41:42 GMT
|
50
|
+
Via:
|
51
|
+
- 1.1 varnish
|
52
|
+
Connection:
|
53
|
+
- keep-alive
|
54
|
+
X-Served-By:
|
55
|
+
- cache-hhn4029-HHN
|
56
|
+
X-Cache:
|
57
|
+
- MISS
|
58
|
+
X-Cache-Hits:
|
59
|
+
- '0'
|
60
|
+
X-Timer:
|
61
|
+
- S1567424502.370259,VS0,VE27
|
62
|
+
Vary:
|
63
|
+
- Origin,Accept-Encoding
|
64
|
+
body:
|
65
|
+
encoding: ASCII-8BIT
|
66
|
+
string: '{"message":"success"}'
|
67
|
+
http_version:
|
68
|
+
recorded_at: Mon, 02 Sep 2019 11:41:42 GMT
|
69
|
+
recorded_with: VCR 5.0.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'campaigns' do
|
4
|
+
describe 'trigger_send' do
|
5
|
+
it 'sends an email', vcr: true do
|
6
|
+
response = api.trigger_campaign_send(
|
7
|
+
campaign_id: '69e9b681-779c-4b4c-b6b8-cd74b17d21d2',
|
8
|
+
recipients: [
|
9
|
+
external_user_id: 132404,
|
10
|
+
trigger_properties: {first_name: 'John'}
|
11
|
+
]
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nussbaum
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-09-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/braze_ruby/api.rb
|
160
160
|
- lib/braze_ruby/deprecated.rb
|
161
161
|
- lib/braze_ruby/endpoints.rb
|
162
|
+
- lib/braze_ruby/endpoints/campaigns.rb
|
162
163
|
- lib/braze_ruby/endpoints/delete_users.rb
|
163
164
|
- lib/braze_ruby/endpoints/email_status.rb
|
164
165
|
- lib/braze_ruby/endpoints/email_sync.rb
|
@@ -177,6 +178,7 @@ files:
|
|
177
178
|
- lib/braze_ruby/rest/schedule_messages.rb
|
178
179
|
- lib/braze_ruby/rest/send_messages.rb
|
179
180
|
- lib/braze_ruby/rest/track_users.rb
|
181
|
+
- lib/braze_ruby/rest/trigger_campaign_send.rb
|
180
182
|
- lib/braze_ruby/version.rb
|
181
183
|
- spec/braze_ruby/api_spec.rb
|
182
184
|
- spec/braze_ruby/endpoints/delete_users_spec.rb
|
@@ -188,6 +190,7 @@ files:
|
|
188
190
|
- spec/braze_ruby/rest/send_messages_spec.rb
|
189
191
|
- spec/braze_ruby/rest/track_users_spec.rb
|
190
192
|
- spec/factories.rb
|
193
|
+
- spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml
|
191
194
|
- spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml
|
192
195
|
- spec/fixtures/responses/delete_users/with_success/responds_with_created.yml
|
193
196
|
- spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml
|
@@ -211,6 +214,7 @@ files:
|
|
211
214
|
- spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml
|
212
215
|
- spec/fixtures/responses/track_users/with_success/responds_with_created.yml
|
213
216
|
- spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml
|
217
|
+
- spec/integrations/campaigns_spec.rb
|
214
218
|
- spec/integrations/delete_users_spec.rb
|
215
219
|
- spec/integrations/email_status_spec.rb
|
216
220
|
- spec/integrations/email_sync_spec.rb
|
@@ -244,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
248
|
- !ruby/object:Gem::Version
|
245
249
|
version: '0'
|
246
250
|
requirements: []
|
247
|
-
rubygems_version: 3.0.
|
251
|
+
rubygems_version: 3.0.6
|
248
252
|
signing_key:
|
249
253
|
specification_version: 4
|
250
254
|
summary: A wrapper for the Braze REST API forked from the appboy gem, track users/events/purchases,
|
@@ -260,6 +264,7 @@ test_files:
|
|
260
264
|
- spec/braze_ruby/rest/send_messages_spec.rb
|
261
265
|
- spec/braze_ruby/rest/track_users_spec.rb
|
262
266
|
- spec/factories.rb
|
267
|
+
- spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml
|
263
268
|
- spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml
|
264
269
|
- spec/fixtures/responses/delete_users/with_success/responds_with_created.yml
|
265
270
|
- spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml
|
@@ -283,6 +288,7 @@ test_files:
|
|
283
288
|
- spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml
|
284
289
|
- spec/fixtures/responses/track_users/with_success/responds_with_created.yml
|
285
290
|
- spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml
|
291
|
+
- spec/integrations/campaigns_spec.rb
|
286
292
|
- spec/integrations/delete_users_spec.rb
|
287
293
|
- spec/integrations/email_status_spec.rb
|
288
294
|
- spec/integrations/email_sync_spec.rb
|