appboy 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/appboy/api.rb +3 -0
- data/lib/appboy/endpoints/list_canvas.rb +15 -0
- data/lib/appboy/rest.rb +1 -0
- data/lib/appboy/rest/list_canvas.rb +21 -0
- data/lib/appboy/version.rb +1 -1
- data/spec/appboy/rest/list_canvas_spec.rb +23 -0
- data/spec/fixtures/responses/list_canvas/with_success/responds_with_a_list_of_segments.yml +67 -0
- data/spec/fixtures/responses/list_canvas/with_success/responds_with_success.yml +67 -0
- data/spec/integrations/list_canvas_spec.rb +21 -0
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b1b915bc01148105219d0aa25762991883ac33ecdfbc42afc2d05703bd4084
|
4
|
+
data.tar.gz: 23b7079dbcf8fa2dc7c095bcce30766dd542b9580d21b8eba3044275e313ba74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5636f61473d6f7c854e8086a695af8364429387b1fc710542805fe250fef63ff709265620dcc23c4eefb8cc8da394d4d5a87bbeec2830622f4c09503b1ca1781
|
7
|
+
data.tar.gz: e61ef8f59d13886bcc8dd62e854fa7137bde95b786599a9a7bf5f57e74d9d8a5ee9e40a443e31a31938a8b7ebd8134e6e9b981d902195f7c4ea6ea5f999c4ddd
|
data/README.md
CHANGED
@@ -173,6 +173,17 @@ See: [Segment Export](https://www.braze.com/documentation/REST_API/#segment-expo
|
|
173
173
|
api.list_segments
|
174
174
|
```
|
175
175
|
|
176
|
+
### List Canvas
|
177
|
+
|
178
|
+
See: [Segment Export](https://www.braze.com/docs/api/endpoints/export/canvas/get_canvases)
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
api.list_canvas(
|
182
|
+
sort_direction: (optional, string, default: 'desc',
|
183
|
+
include_archived: (optional, boolean, default: false)
|
184
|
+
)
|
185
|
+
```
|
186
|
+
|
176
187
|
### Export Users
|
177
188
|
|
178
189
|
See: [User Export](https://www.braze.com/documentation/REST_API/#user-export)
|
data/lib/appboy/api.rb
CHANGED
@@ -6,6 +6,7 @@ require 'appboy/endpoints/schedule_messages'
|
|
6
6
|
require 'appboy/endpoints/email_status'
|
7
7
|
require 'appboy/endpoints/trigger_campaign'
|
8
8
|
require 'appboy/endpoints/trigger_canvas'
|
9
|
+
require 'appboy/endpoints/list_canvas'
|
9
10
|
|
10
11
|
module Appboy
|
11
12
|
class API
|
@@ -18,6 +19,7 @@ module Appboy
|
|
18
19
|
include Appboy::Endpoints::EmailStatus
|
19
20
|
include Appboy::Endpoints::TriggerCampaign
|
20
21
|
include Appboy::Endpoints::TriggerCanvas
|
22
|
+
include Appboy::Endpoints::ListCanvas
|
21
23
|
|
22
24
|
def export_users(**payload)
|
23
25
|
Appboy::REST::ExportUsers.new.perform(app_group_id, payload)
|
@@ -34,3 +36,4 @@ module Appboy
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
39
|
+
|
data/lib/appboy/rest.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Appboy
|
2
|
+
module REST
|
3
|
+
class ListCanvas < Base
|
4
|
+
attr_reader :app_group_id, :sort_direction, :include_archived
|
5
|
+
|
6
|
+
def initialize(app_group_id, options = {})
|
7
|
+
@app_group_id = app_group_id
|
8
|
+
@sort_direction = options[:sort_direction]
|
9
|
+
@include_archived = options[:include_archived]
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform
|
13
|
+
http.get '/canvas/list', {
|
14
|
+
app_group_id: app_group_id,
|
15
|
+
sort_direction: sort_direction,
|
16
|
+
include_archived: include_archived
|
17
|
+
}.compact
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/appboy/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Appboy::REST::ListCanvas do
|
4
|
+
let(:http) { double(:http) }
|
5
|
+
|
6
|
+
let(:payload) {{
|
7
|
+
sort_direction: "desc",
|
8
|
+
include_archived: false
|
9
|
+
}}
|
10
|
+
|
11
|
+
let(:app_group_id) { :app_group_id }
|
12
|
+
|
13
|
+
subject { described_class.new(:app_group_id, sort_direction: "desc", include_archived: false) }
|
14
|
+
|
15
|
+
before { subject.http = http }
|
16
|
+
|
17
|
+
it 'makes an http call to the list canvas endpoint' do
|
18
|
+
expect(http).to receive(:get).with '/canvas/list',
|
19
|
+
payload.merge({ app_group_id: :app_group_id })
|
20
|
+
|
21
|
+
subject.perform
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.appboy.com/canvas/list?app_group_id=<APPBOY_GROUP_ID>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v1.3.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Content-Type:
|
24
|
+
- application/json
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
X-Ratelimit-Limit:
|
28
|
+
- '250000'
|
29
|
+
X-Ratelimit-Remaining:
|
30
|
+
- '249993'
|
31
|
+
X-Ratelimit-Reset:
|
32
|
+
- '1611349200'
|
33
|
+
Etag:
|
34
|
+
- W/"51dc6bc869351170ca28552c48fbad29"
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- 1ce58ce3-e2ba-41b8-94d2-970709a9c721
|
39
|
+
X-Runtime:
|
40
|
+
- '0.026860'
|
41
|
+
Strict-Transport-Security:
|
42
|
+
- max-age=0; includeSubDomains
|
43
|
+
- max-age=31536000; includeSubDomains
|
44
|
+
Accept-Ranges:
|
45
|
+
- bytes
|
46
|
+
Date:
|
47
|
+
- Fri, 22 Jan 2021 20:24:15 GMT
|
48
|
+
Via:
|
49
|
+
- 1.1 varnish
|
50
|
+
X-Served-By:
|
51
|
+
- cache-dca17777-DCA
|
52
|
+
X-Cache:
|
53
|
+
- MISS
|
54
|
+
X-Cache-Hits:
|
55
|
+
- '0'
|
56
|
+
X-Timer:
|
57
|
+
- S1611347056.840725,VS0,VE30
|
58
|
+
Vary:
|
59
|
+
- Origin,Accept-Encoding
|
60
|
+
Transfer-Encoding:
|
61
|
+
- chunked
|
62
|
+
body:
|
63
|
+
encoding: ASCII-8BIT
|
64
|
+
string: '{"canvases":[{"id":"2f28a304-d5bf-4032-a90f-03385d1b0330","name":"ONBOARDING_NEW
|
65
|
+
SUBSCRIBERS","tags":[],"last_edited":"2017-09-05T20:57:55+00:00"},{"id":"eb7e3341-4734-4cc0-ae39-942e564c0c55","name":"ONBOARDING_COI","tags":[],"last_edited":"2017-09-05T20:58:34+00:00"},{"id":"d8bd2da6-d3ee-4a56-aa26-9c88e7f59cd8","name":"RESUBSCRIBERS","tags":[],"last_edited":"2017-09-05T21:14:17+00:00"},{"id":"c27f07fa-d3e7-8b57-fc7c-bfdbb5e0fb34","name":"NEWSLETTER_DAILY_StagingTest","tags":[],"last_edited":"2020-10-12T14:01:46+00:00"}],"message":"success"}'
|
66
|
+
recorded_at: Fri, 22 Jan 2021 20:24:15 GMT
|
67
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,67 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.appboy.com/canvas/list?app_group_id=<APPBOY_GROUP_ID>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v1.3.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Content-Type:
|
24
|
+
- application/json
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
X-Ratelimit-Limit:
|
28
|
+
- '250000'
|
29
|
+
X-Ratelimit-Remaining:
|
30
|
+
- '249992'
|
31
|
+
X-Ratelimit-Reset:
|
32
|
+
- '1611349200'
|
33
|
+
Etag:
|
34
|
+
- W/"51dc6bc869351170ca28552c48fbad29"
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- cd1e61fb-a740-413e-b12e-dadbacddf788
|
39
|
+
X-Runtime:
|
40
|
+
- '0.013484'
|
41
|
+
Strict-Transport-Security:
|
42
|
+
- max-age=0; includeSubDomains
|
43
|
+
- max-age=31536000; includeSubDomains
|
44
|
+
Accept-Ranges:
|
45
|
+
- bytes
|
46
|
+
Date:
|
47
|
+
- Fri, 22 Jan 2021 20:24:16 GMT
|
48
|
+
Via:
|
49
|
+
- 1.1 varnish
|
50
|
+
X-Served-By:
|
51
|
+
- cache-dca17778-DCA
|
52
|
+
X-Cache:
|
53
|
+
- MISS
|
54
|
+
X-Cache-Hits:
|
55
|
+
- '0'
|
56
|
+
X-Timer:
|
57
|
+
- S1611347056.075099,VS0,VE17
|
58
|
+
Vary:
|
59
|
+
- Origin,Accept-Encoding
|
60
|
+
Transfer-Encoding:
|
61
|
+
- chunked
|
62
|
+
body:
|
63
|
+
encoding: ASCII-8BIT
|
64
|
+
string: '{"canvases":[{"id":"2f28a304-d5bf-4032-a90f-03385d1b0330","name":"ONBOARDING_NEW
|
65
|
+
SUBSCRIBERS","tags":[],"last_edited":"2017-09-05T20:57:55+00:00"},{"id":"eb7e3341-4734-4cc0-ae39-942e564c0c55","name":"ONBOARDING_COI","tags":[],"last_edited":"2017-09-05T20:58:34+00:00"},{"id":"d8bd2da6-d3ee-4a56-aa26-9c88e7f59cd8","name":"RESUBSCRIBERS","tags":[],"last_edited":"2017-09-05T21:14:17+00:00"},{"id":"c27f07fa-d3e7-8b57-fc7c-bfdbb5e0fb34","name":"NEWSLETTER_DAILY_StagingTest","tags":[],"last_edited":"2020-10-12T14:01:46+00:00"}],"message":"success"}'
|
66
|
+
recorded_at: Fri, 22 Jan 2021 20:24:16 GMT
|
67
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'list canvas' do
|
4
|
+
subject(:list_canvas) { api.list_canvas }
|
5
|
+
|
6
|
+
context 'with success', :vcr do
|
7
|
+
it 'responds with success' do
|
8
|
+
expect(list_canvas).to be_success
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'responds with a list of segments' do
|
12
|
+
expect(canvases.count).to be 4
|
13
|
+
|
14
|
+
expect(canvases.first['name']).to eq 'ONBOARDING_NEW SUBSCRIBERS'
|
15
|
+
end
|
16
|
+
|
17
|
+
def canvases
|
18
|
+
JSON.parse(list_canvas.body)['canvases']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nussbaum
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- lib/appboy/deprecated.rb
|
200
200
|
- lib/appboy/endpoints/delete_users.rb
|
201
201
|
- lib/appboy/endpoints/email_status.rb
|
202
|
+
- lib/appboy/endpoints/list_canvas.rb
|
202
203
|
- lib/appboy/endpoints/schedule_messages.rb
|
203
204
|
- lib/appboy/endpoints/send_messages.rb
|
204
205
|
- lib/appboy/endpoints/track_users.rb
|
@@ -210,6 +211,7 @@ files:
|
|
210
211
|
- lib/appboy/rest/delete_users.rb
|
211
212
|
- lib/appboy/rest/email_status.rb
|
212
213
|
- lib/appboy/rest/export_users.rb
|
214
|
+
- lib/appboy/rest/list_canvas.rb
|
213
215
|
- lib/appboy/rest/list_segments.rb
|
214
216
|
- lib/appboy/rest/schedule_messages.rb
|
215
217
|
- lib/appboy/rest/send_messages.rb
|
@@ -225,6 +227,7 @@ files:
|
|
225
227
|
- spec/appboy/rest/delete_users_spec.rb
|
226
228
|
- spec/appboy/rest/email_status_spec.rb
|
227
229
|
- spec/appboy/rest/export_users_spec.rb
|
230
|
+
- spec/appboy/rest/list_canvas_spec.rb
|
228
231
|
- spec/appboy/rest/schedule_messages_spec.rb
|
229
232
|
- spec/appboy/rest/send_messages_spec.rb
|
230
233
|
- spec/appboy/rest/track_users_spec.rb
|
@@ -240,6 +243,8 @@ files:
|
|
240
243
|
- spec/fixtures/responses/email_status/unknown_email/responds_with_error_message.yml
|
241
244
|
- spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml
|
242
245
|
- spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml
|
246
|
+
- spec/fixtures/responses/list_canvas/with_success/responds_with_a_list_of_segments.yml
|
247
|
+
- spec/fixtures/responses/list_canvas/with_success/responds_with_success.yml
|
243
248
|
- spec/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml
|
244
249
|
- spec/fixtures/responses/list_segments/with_success/responds_with_success.yml
|
245
250
|
- spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml
|
@@ -254,6 +259,7 @@ files:
|
|
254
259
|
- spec/integrations/delete_users_spec.rb
|
255
260
|
- spec/integrations/email_status_spec.rb
|
256
261
|
- spec/integrations/export_users_spec.rb
|
262
|
+
- spec/integrations/list_canvas_spec.rb
|
257
263
|
- spec/integrations/list_segments_spec.rb
|
258
264
|
- spec/integrations/schedule_messages_spec.rb
|
259
265
|
- spec/integrations/send_messages_spec.rb
|
@@ -281,8 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
287
|
- !ruby/object:Gem::Version
|
282
288
|
version: '0'
|
283
289
|
requirements: []
|
284
|
-
|
285
|
-
rubygems_version: 2.7.6
|
290
|
+
rubygems_version: 3.1.2
|
286
291
|
signing_key:
|
287
292
|
specification_version: 4
|
288
293
|
summary: A wrapper for the Appboy REST API, track users/events/purchases, send & schedule
|
@@ -296,6 +301,7 @@ test_files:
|
|
296
301
|
- spec/appboy/rest/delete_users_spec.rb
|
297
302
|
- spec/appboy/rest/email_status_spec.rb
|
298
303
|
- spec/appboy/rest/export_users_spec.rb
|
304
|
+
- spec/appboy/rest/list_canvas_spec.rb
|
299
305
|
- spec/appboy/rest/schedule_messages_spec.rb
|
300
306
|
- spec/appboy/rest/send_messages_spec.rb
|
301
307
|
- spec/appboy/rest/track_users_spec.rb
|
@@ -311,6 +317,8 @@ test_files:
|
|
311
317
|
- spec/fixtures/responses/email_status/unknown_email/responds_with_error_message.yml
|
312
318
|
- spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml
|
313
319
|
- spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml
|
320
|
+
- spec/fixtures/responses/list_canvas/with_success/responds_with_a_list_of_segments.yml
|
321
|
+
- spec/fixtures/responses/list_canvas/with_success/responds_with_success.yml
|
314
322
|
- spec/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml
|
315
323
|
- spec/fixtures/responses/list_segments/with_success/responds_with_success.yml
|
316
324
|
- spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml
|
@@ -325,6 +333,7 @@ test_files:
|
|
325
333
|
- spec/integrations/delete_users_spec.rb
|
326
334
|
- spec/integrations/email_status_spec.rb
|
327
335
|
- spec/integrations/export_users_spec.rb
|
336
|
+
- spec/integrations/list_canvas_spec.rb
|
328
337
|
- spec/integrations/list_segments_spec.rb
|
329
338
|
- spec/integrations/schedule_messages_spec.rb
|
330
339
|
- spec/integrations/send_messages_spec.rb
|