braze_ruby 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +19 -0
- data/Gemfile.lock +5 -5
- data/README.md +9 -0
- data/lib/braze_ruby/api.rb +2 -0
- data/lib/braze_ruby/endpoints/canvas.rb +9 -0
- data/lib/braze_ruby/rest.rb +1 -0
- data/lib/braze_ruby/rest/trigger_canvas_send.rb +20 -0
- data/lib/braze_ruby/version.rb +1 -1
- data/spec/fixtures/responses/canvas/trigger_send/sends_a_canvas.yml +69 -0
- data/spec/integrations/canvas_spec.rb +15 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adcffccc751c8231b0084d858454d36d5b3a034b128bd4c7c7d72e5867a27b4b
|
4
|
+
data.tar.gz: 2e0bf1111244eb7c356f7b8b9edcf9cf146c7f38cf3687f771b9d45953fb4925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae3ccf92edd2f7f82c31812964eba85a57af09f1bf944338491f03bcc2d8e5831f7c21594a7e07a2aa5df8f0f1d732721d3aa7b9147c9380c0f3c4178f99c7e0
|
7
|
+
data.tar.gz: 9c1046684d733a8aab55c2a65a97ff950340df129c44472089424f4a43099609975c96770d39c8a3a896cd05868867ea8b203d7f2f27a5c90204634af6c23ba3
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v1
|
11
|
+
- name: Set up Ruby
|
12
|
+
uses: actions/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 2.6.x
|
15
|
+
- name: Build and test
|
16
|
+
run: |
|
17
|
+
gem install bundler
|
18
|
+
bundle install --jobs 4 --retry 3
|
19
|
+
bundle exec rake spec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
braze_ruby (0.2.
|
4
|
+
braze_ruby (0.2.2)
|
5
5
|
faraday
|
6
6
|
|
7
7
|
GEM
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
safe_yaml (~> 1.0.0)
|
22
22
|
diff-lcs (1.3)
|
23
23
|
dotenv (2.7.5)
|
24
|
-
factory_bot (5.0
|
24
|
+
factory_bot (5.1.0)
|
25
25
|
activesupport (>= 4.2.0)
|
26
26
|
faraday (0.15.4)
|
27
27
|
multipart-post (>= 1.2, < 3)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
i18n (1.6.0)
|
30
30
|
concurrent-ruby (~> 1.0)
|
31
31
|
method_source (0.9.2)
|
32
|
-
minitest (5.
|
32
|
+
minitest (5.12.0)
|
33
33
|
multipart-post (2.1.1)
|
34
34
|
pry (0.12.2)
|
35
35
|
coderay (~> 1.1.0)
|
@@ -54,11 +54,11 @@ GEM
|
|
54
54
|
tzinfo (1.2.5)
|
55
55
|
thread_safe (~> 0.1)
|
56
56
|
vcr (5.0.0)
|
57
|
-
webmock (3.7.
|
57
|
+
webmock (3.7.5)
|
58
58
|
addressable (>= 2.3.6)
|
59
59
|
crack (>= 0.3.2)
|
60
60
|
hashdiff (>= 0.4.0, < 2.0.0)
|
61
|
-
zeitwerk (2.1.
|
61
|
+
zeitwerk (2.1.10)
|
62
62
|
|
63
63
|
PLATFORMS
|
64
64
|
ruby
|
data/README.md
CHANGED
@@ -121,6 +121,15 @@ api.trigger_campaign_send(
|
|
121
121
|
)
|
122
122
|
```
|
123
123
|
|
124
|
+
### Send Canvas
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
api.trigger_canvas_send(
|
128
|
+
canvas_id: 'canvas-id',
|
129
|
+
recipients: [external_user_id: 123, canvas_entry_properties: {first_name: 'John'}]
|
130
|
+
)
|
131
|
+
```
|
132
|
+
|
124
133
|
### Changing Email Subscription
|
125
134
|
|
126
135
|
```ruby
|
data/lib/braze_ruby/api.rb
CHANGED
@@ -6,6 +6,7 @@ require 'braze_ruby/endpoints/email_status'
|
|
6
6
|
require 'braze_ruby/endpoints/email_sync'
|
7
7
|
require 'braze_ruby/endpoints/delete_users'
|
8
8
|
require 'braze_ruby/endpoints/campaigns'
|
9
|
+
require 'braze_ruby/endpoints/canvas'
|
9
10
|
|
10
11
|
module BrazeRuby
|
11
12
|
class API
|
@@ -18,6 +19,7 @@ module BrazeRuby
|
|
18
19
|
include BrazeRuby::Endpoints::EmailSync
|
19
20
|
include BrazeRuby::Endpoints::DeleteUsers
|
20
21
|
include BrazeRuby::Endpoints::Campaigns
|
22
|
+
include BrazeRuby::Endpoints::Canvas
|
21
23
|
|
22
24
|
def export_users(**payload)
|
23
25
|
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 TriggerCanvasSend < 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('/canvas/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>/canvas/trigger/send"
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"api_key":"<BRAZE_REST_API_KEY>","canvas_id":"dc23ade4-e970-0c52-81bc-b369f64f533d","recipients":[{"external_user_id":132404,"canvas_entry_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.1
|
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/"fe0b7fad99d691854e76da70f1fcfff9"
|
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
|
+
- '1569409200'
|
40
|
+
X-Request-Id:
|
41
|
+
- 768c83db-2694-4267-b21c-d070cb4a1828
|
42
|
+
X-Runtime:
|
43
|
+
- '0.023062'
|
44
|
+
Content-Length:
|
45
|
+
- '94'
|
46
|
+
Accept-Ranges:
|
47
|
+
- bytes
|
48
|
+
Date:
|
49
|
+
- Wed, 25 Sep 2019 10:36:45 GMT
|
50
|
+
Via:
|
51
|
+
- 1.1 varnish
|
52
|
+
Connection:
|
53
|
+
- keep-alive
|
54
|
+
X-Served-By:
|
55
|
+
- cache-fra19174-FRA
|
56
|
+
X-Cache:
|
57
|
+
- MISS
|
58
|
+
X-Cache-Hits:
|
59
|
+
- '0'
|
60
|
+
X-Timer:
|
61
|
+
- S1569407805.340414,VS0,VE71
|
62
|
+
Vary:
|
63
|
+
- Origin,Accept-Encoding
|
64
|
+
body:
|
65
|
+
encoding: ASCII-8BIT
|
66
|
+
string: '{"dispatch_id":"0bda43218769391588ee304c36fafb03","message":"success"}'
|
67
|
+
http_version:
|
68
|
+
recorded_at: Wed, 25 Sep 2019 10:36:45 GMT
|
69
|
+
recorded_with: VCR 5.0.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'canvas' do
|
4
|
+
describe 'trigger_send' do
|
5
|
+
it 'sends a canvas', vcr: true do
|
6
|
+
response = api.trigger_canvas_send(
|
7
|
+
canvas_id: 'dc23ade4-e970-0c52-81bc-b369f64f533d',
|
8
|
+
recipients: [
|
9
|
+
external_user_id: 132404,
|
10
|
+
canvas_entry_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.2
|
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-09-
|
13
|
+
date: 2019-09-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -147,6 +147,7 @@ executables: []
|
|
147
147
|
extensions: []
|
148
148
|
extra_rdoc_files: []
|
149
149
|
files:
|
150
|
+
- ".github/workflows/ci.yml"
|
150
151
|
- ".gitignore"
|
151
152
|
- ".rspec"
|
152
153
|
- Gemfile
|
@@ -160,6 +161,7 @@ files:
|
|
160
161
|
- lib/braze_ruby/deprecated.rb
|
161
162
|
- lib/braze_ruby/endpoints.rb
|
162
163
|
- lib/braze_ruby/endpoints/campaigns.rb
|
164
|
+
- lib/braze_ruby/endpoints/canvas.rb
|
163
165
|
- lib/braze_ruby/endpoints/delete_users.rb
|
164
166
|
- lib/braze_ruby/endpoints/email_status.rb
|
165
167
|
- lib/braze_ruby/endpoints/email_sync.rb
|
@@ -179,6 +181,7 @@ files:
|
|
179
181
|
- lib/braze_ruby/rest/send_messages.rb
|
180
182
|
- lib/braze_ruby/rest/track_users.rb
|
181
183
|
- lib/braze_ruby/rest/trigger_campaign_send.rb
|
184
|
+
- lib/braze_ruby/rest/trigger_canvas_send.rb
|
182
185
|
- lib/braze_ruby/version.rb
|
183
186
|
- spec/braze_ruby/api_spec.rb
|
184
187
|
- spec/braze_ruby/endpoints/delete_users_spec.rb
|
@@ -191,6 +194,7 @@ files:
|
|
191
194
|
- spec/braze_ruby/rest/track_users_spec.rb
|
192
195
|
- spec/factories.rb
|
193
196
|
- spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml
|
197
|
+
- spec/fixtures/responses/canvas/trigger_send/sends_a_canvas.yml
|
194
198
|
- spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml
|
195
199
|
- spec/fixtures/responses/delete_users/with_success/responds_with_created.yml
|
196
200
|
- spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml
|
@@ -215,6 +219,7 @@ files:
|
|
215
219
|
- spec/fixtures/responses/track_users/with_success/responds_with_created.yml
|
216
220
|
- spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml
|
217
221
|
- spec/integrations/campaigns_spec.rb
|
222
|
+
- spec/integrations/canvas_spec.rb
|
218
223
|
- spec/integrations/delete_users_spec.rb
|
219
224
|
- spec/integrations/email_status_spec.rb
|
220
225
|
- spec/integrations/email_sync_spec.rb
|
@@ -265,6 +270,7 @@ test_files:
|
|
265
270
|
- spec/braze_ruby/rest/track_users_spec.rb
|
266
271
|
- spec/factories.rb
|
267
272
|
- spec/fixtures/responses/campaigns/trigger_send/sends_an_email.yml
|
273
|
+
- spec/fixtures/responses/canvas/trigger_send/sends_a_canvas.yml
|
268
274
|
- spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml
|
269
275
|
- spec/fixtures/responses/delete_users/with_success/responds_with_created.yml
|
270
276
|
- spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml
|
@@ -289,6 +295,7 @@ test_files:
|
|
289
295
|
- spec/fixtures/responses/track_users/with_success/responds_with_created.yml
|
290
296
|
- spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml
|
291
297
|
- spec/integrations/campaigns_spec.rb
|
298
|
+
- spec/integrations/canvas_spec.rb
|
292
299
|
- spec/integrations/delete_users_spec.rb
|
293
300
|
- spec/integrations/email_status_spec.rb
|
294
301
|
- spec/integrations/email_sync_spec.rb
|