appboy 0.0.1 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/README.md +165 -21
- data/appboy.gemspec +18 -10
- data/lib/appboy.rb +5 -3
- data/lib/appboy/api.rb +27 -30
- data/lib/appboy/deprecated.rb +19 -0
- data/lib/appboy/endpoints/delete_users.rb +15 -0
- data/lib/appboy/endpoints/email_status.rb +13 -0
- data/lib/appboy/endpoints/list_canvas.rb +15 -0
- data/lib/appboy/endpoints/schedule_messages.rb +15 -0
- data/lib/appboy/endpoints/send_messages.rb +15 -0
- data/lib/appboy/endpoints/track_users.rb +29 -0
- data/lib/appboy/endpoints/trigger_campaign.rb +15 -0
- data/lib/appboy/endpoints/trigger_canvas.rb +15 -0
- data/lib/appboy/http.rb +32 -0
- data/lib/appboy/rest.rb +11 -0
- data/lib/appboy/rest/base.rb +15 -0
- data/lib/appboy/rest/delete_users.rb +21 -0
- data/lib/appboy/rest/email_status.rb +21 -0
- data/lib/appboy/rest/export_users.rb +27 -0
- data/lib/appboy/rest/list_canvas.rb +21 -0
- data/lib/appboy/rest/list_segments.rb +11 -0
- data/lib/appboy/rest/schedule_messages.rb +25 -0
- data/lib/appboy/rest/send_messages.rb +23 -0
- data/lib/appboy/rest/track_users.rb +14 -0
- data/lib/appboy/rest/trigger_campaign.rb +30 -0
- data/lib/appboy/rest/trigger_canvas.rb +28 -0
- data/lib/appboy/version.rb +1 -1
- data/spec/appboy/api_spec.rb +4 -0
- data/spec/appboy/endpoints/track_users_spec.rb +72 -0
- data/spec/appboy/endpoints/trigger_campaigns_spec.rb +47 -0
- data/spec/appboy/endpoints/trigger_canvas_spec.rb +47 -0
- data/spec/appboy/http_spec.rb +19 -0
- data/spec/appboy/rest/delete_users_spec.rb +23 -0
- data/spec/appboy/rest/email_status_spec.rb +19 -0
- data/spec/appboy/rest/export_users_spec.rb +20 -0
- data/spec/appboy/rest/list_canvas_spec.rb +23 -0
- data/spec/appboy/rest/schedule_messages_spec.rb +34 -0
- data/spec/appboy/rest/send_messages_spec.rb +36 -0
- data/spec/appboy/rest/track_users_spec.rb +24 -0
- data/spec/appboy/rest/trigger_campaign_spec.rb +50 -0
- data/spec/appboy/rest/trigger_canvas_spec.rb +47 -0
- data/spec/factories.rb +44 -0
- data/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml +58 -0
- data/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml +58 -0
- data/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml +58 -0
- data/spec/fixtures/responses/email_status/existing_email/responds_with_created.yml +54 -0
- data/spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml +54 -0
- data/spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml +52 -0
- data/spec/fixtures/responses/email_status/unknown_email/responds_with_error_message.yml +52 -0
- data/spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml +56 -0
- data/spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml +54 -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/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml +58 -0
- data/spec/fixtures/responses/list_segments/with_success/responds_with_success.yml +58 -0
- data/spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml +53 -0
- data/spec/fixtures/responses/schedule_messages/with_success/responds_with_created.yml +55 -0
- data/spec/fixtures/responses/schedule_messages/with_success/responds_with_success_message.yml +55 -0
- data/spec/fixtures/responses/send_messages/unauthorized/responds_with_unauthorized.yml +52 -0
- data/spec/fixtures/responses/send_messages/with_success/responds_with_created.yml +54 -0
- data/spec/fixtures/responses/send_messages/with_success/responds_with_success_message.yml +54 -0
- data/spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml +54 -0
- data/spec/fixtures/responses/track_users/with_success/responds_with_created.yml +56 -0
- data/spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml +56 -0
- data/spec/integrations/delete_users_spec.rb +30 -0
- data/spec/integrations/email_status_spec.rb +36 -0
- data/spec/integrations/export_users_spec.rb +27 -0
- data/spec/integrations/list_canvas_spec.rb +21 -0
- data/spec/integrations/list_segments_spec.rb +21 -0
- data/spec/integrations/schedule_messages_spec.rb +31 -0
- data/spec/integrations/send_messages_spec.rb +30 -0
- data/spec/integrations/track_users_spec.rb +35 -0
- data/spec/spec_helper.rb +10 -1
- data/spec/support/factory_girl.rb +10 -0
- data/spec/support/integrations.rb +19 -0
- data/spec/support/vcr.rb +17 -0
- metadata +248 -19
- data/spec/api_spec.rb +0 -60
data/spec/api_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Appboy::API do
|
4
|
-
let(:appboy) { Appboy::API.new('secret-key', 'app-group-id')}
|
5
|
-
|
6
|
-
context "#track" do
|
7
|
-
it "calls api" do
|
8
|
-
Appboy::API.should_receive(:post).with(
|
9
|
-
'/users/track',
|
10
|
-
query: {
|
11
|
-
company_secret: 'secret-key',
|
12
|
-
app_group_id: 'app-group-id',
|
13
|
-
attributes: :attributes,
|
14
|
-
events: :events,
|
15
|
-
purchases: :purchases
|
16
|
-
}
|
17
|
-
).and_return('message' => 'success')
|
18
|
-
|
19
|
-
expect(appboy.track(:attributes, :events, :purchases)).to be_true
|
20
|
-
end
|
21
|
-
|
22
|
-
it "handles error"
|
23
|
-
end
|
24
|
-
|
25
|
-
context "#send_message" do
|
26
|
-
it "calls api" do
|
27
|
-
Appboy::API.should_receive(:post).with(
|
28
|
-
'/messages/send',
|
29
|
-
query: {
|
30
|
-
company_secret: 'secret-key',
|
31
|
-
app_group_id: 'app-group-id',
|
32
|
-
external_user_ids: :user_ids,
|
33
|
-
segment_ids: [:segment_id],
|
34
|
-
messages: :message
|
35
|
-
}
|
36
|
-
).and_return('message' => 'success')
|
37
|
-
|
38
|
-
expect(appboy.send_message(:message, :user_ids, :segment_id)).to be_true
|
39
|
-
end
|
40
|
-
it "handles error"
|
41
|
-
end
|
42
|
-
|
43
|
-
context "#schedule_message" do
|
44
|
-
it "calls api" do
|
45
|
-
Appboy::API.should_receive(:post).with(
|
46
|
-
'/messages/schedule',
|
47
|
-
query: {
|
48
|
-
company_secret: 'secret-key',
|
49
|
-
segment_ids: [:segment_id],
|
50
|
-
send_at: :date,
|
51
|
-
deliver_in_local_timezone: :in_local_timezone,
|
52
|
-
messages: :message
|
53
|
-
}
|
54
|
-
).and_return('message' => 'success')
|
55
|
-
|
56
|
-
expect(appboy.schedule_message(:date, :message, :segment_id, :in_local_timezone)).to be_true
|
57
|
-
end
|
58
|
-
it "handles error"
|
59
|
-
end
|
60
|
-
end
|