appboy 0.0.1 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.rspec +1 -0
  4. data/README.md +165 -21
  5. data/appboy.gemspec +18 -10
  6. data/lib/appboy.rb +5 -3
  7. data/lib/appboy/api.rb +27 -30
  8. data/lib/appboy/deprecated.rb +19 -0
  9. data/lib/appboy/endpoints/delete_users.rb +15 -0
  10. data/lib/appboy/endpoints/email_status.rb +13 -0
  11. data/lib/appboy/endpoints/list_canvas.rb +15 -0
  12. data/lib/appboy/endpoints/schedule_messages.rb +15 -0
  13. data/lib/appboy/endpoints/send_messages.rb +15 -0
  14. data/lib/appboy/endpoints/track_users.rb +29 -0
  15. data/lib/appboy/endpoints/trigger_campaign.rb +15 -0
  16. data/lib/appboy/endpoints/trigger_canvas.rb +15 -0
  17. data/lib/appboy/http.rb +32 -0
  18. data/lib/appboy/rest.rb +11 -0
  19. data/lib/appboy/rest/base.rb +15 -0
  20. data/lib/appboy/rest/delete_users.rb +21 -0
  21. data/lib/appboy/rest/email_status.rb +21 -0
  22. data/lib/appboy/rest/export_users.rb +27 -0
  23. data/lib/appboy/rest/list_canvas.rb +21 -0
  24. data/lib/appboy/rest/list_segments.rb +11 -0
  25. data/lib/appboy/rest/schedule_messages.rb +25 -0
  26. data/lib/appboy/rest/send_messages.rb +23 -0
  27. data/lib/appboy/rest/track_users.rb +14 -0
  28. data/lib/appboy/rest/trigger_campaign.rb +30 -0
  29. data/lib/appboy/rest/trigger_canvas.rb +28 -0
  30. data/lib/appboy/version.rb +1 -1
  31. data/spec/appboy/api_spec.rb +4 -0
  32. data/spec/appboy/endpoints/track_users_spec.rb +72 -0
  33. data/spec/appboy/endpoints/trigger_campaigns_spec.rb +47 -0
  34. data/spec/appboy/endpoints/trigger_canvas_spec.rb +47 -0
  35. data/spec/appboy/http_spec.rb +19 -0
  36. data/spec/appboy/rest/delete_users_spec.rb +23 -0
  37. data/spec/appboy/rest/email_status_spec.rb +19 -0
  38. data/spec/appboy/rest/export_users_spec.rb +20 -0
  39. data/spec/appboy/rest/list_canvas_spec.rb +23 -0
  40. data/spec/appboy/rest/schedule_messages_spec.rb +34 -0
  41. data/spec/appboy/rest/send_messages_spec.rb +36 -0
  42. data/spec/appboy/rest/track_users_spec.rb +24 -0
  43. data/spec/appboy/rest/trigger_campaign_spec.rb +50 -0
  44. data/spec/appboy/rest/trigger_canvas_spec.rb +47 -0
  45. data/spec/factories.rb +44 -0
  46. data/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml +58 -0
  47. data/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml +58 -0
  48. data/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml +58 -0
  49. data/spec/fixtures/responses/email_status/existing_email/responds_with_created.yml +54 -0
  50. data/spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml +54 -0
  51. data/spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml +52 -0
  52. data/spec/fixtures/responses/email_status/unknown_email/responds_with_error_message.yml +52 -0
  53. data/spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml +56 -0
  54. data/spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml +54 -0
  55. data/spec/fixtures/responses/list_canvas/with_success/responds_with_a_list_of_segments.yml +67 -0
  56. data/spec/fixtures/responses/list_canvas/with_success/responds_with_success.yml +67 -0
  57. data/spec/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml +58 -0
  58. data/spec/fixtures/responses/list_segments/with_success/responds_with_success.yml +58 -0
  59. data/spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml +53 -0
  60. data/spec/fixtures/responses/schedule_messages/with_success/responds_with_created.yml +55 -0
  61. data/spec/fixtures/responses/schedule_messages/with_success/responds_with_success_message.yml +55 -0
  62. data/spec/fixtures/responses/send_messages/unauthorized/responds_with_unauthorized.yml +52 -0
  63. data/spec/fixtures/responses/send_messages/with_success/responds_with_created.yml +54 -0
  64. data/spec/fixtures/responses/send_messages/with_success/responds_with_success_message.yml +54 -0
  65. data/spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml +54 -0
  66. data/spec/fixtures/responses/track_users/with_success/responds_with_created.yml +56 -0
  67. data/spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml +56 -0
  68. data/spec/integrations/delete_users_spec.rb +30 -0
  69. data/spec/integrations/email_status_spec.rb +36 -0
  70. data/spec/integrations/export_users_spec.rb +27 -0
  71. data/spec/integrations/list_canvas_spec.rb +21 -0
  72. data/spec/integrations/list_segments_spec.rb +21 -0
  73. data/spec/integrations/schedule_messages_spec.rb +31 -0
  74. data/spec/integrations/send_messages_spec.rb +30 -0
  75. data/spec/integrations/track_users_spec.rb +35 -0
  76. data/spec/spec_helper.rb +10 -1
  77. data/spec/support/factory_girl.rb +10 -0
  78. data/spec/support/integrations.rb +19 -0
  79. data/spec/support/vcr.rb +17 -0
  80. metadata +248 -19
  81. data/spec/api_spec.rb +0 -60
@@ -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