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
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/users/delete
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"non-existent","external_ids":[1,2],"appboy_ids":[]}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.12.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 401
21
+ message: Unauthorized
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/json
27
+ Server:
28
+ - nginx/1.10.2
29
+ X-Request-Id:
30
+ - 90baa9c2-258b-4231-8308-0153e89dffe2
31
+ X-Runtime:
32
+ - '0.005878'
33
+ Content-Length:
34
+ - '85'
35
+ Accept-Ranges:
36
+ - bytes
37
+ Date:
38
+ - Tue, 27 Jun 2017 14:45:31 GMT
39
+ Via:
40
+ - 1.1 varnish
41
+ Connection:
42
+ - keep-alive
43
+ X-Served-By:
44
+ - cache-ord1737-ORD
45
+ X-Cache:
46
+ - MISS
47
+ X-Cache-Hits:
48
+ - '0'
49
+ X-Timer:
50
+ - S1498574732.800538,VS0,VE27
51
+ Vary:
52
+ - Accept-Encoding
53
+ body:
54
+ encoding: ASCII-8BIT
55
+ string: '{"message":"Invalid App Group API Identifier: non-existent"}'
56
+ http_version:
57
+ recorded_at: Tue, 27 Jun 2017 14:45:31 GMT
58
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/users/delete
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","external_ids":[1,2],"appboy_ids":[]}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.12.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/json
27
+ Server:
28
+ - nginx/1.10.2
29
+ X-Request-Id:
30
+ - c0ea7c6b-9323-4e1d-9467-f04d29fd4084
31
+ X-Runtime:
32
+ - '0.005712'
33
+ Content-Length:
34
+ - '80'
35
+ Accept-Ranges:
36
+ - bytes
37
+ Date:
38
+ - Tue, 27 Jun 2017 14:44:20 GMT
39
+ Via:
40
+ - 1.1 varnish
41
+ Connection:
42
+ - keep-alive
43
+ X-Served-By:
44
+ - cache-ord1747-ORD
45
+ X-Cache:
46
+ - MISS
47
+ X-Cache-Hits:
48
+ - '0'
49
+ X-Timer:
50
+ - S1498574660.342690,VS0,VE121
51
+ Vary:
52
+ - Accept-Encoding
53
+ body:
54
+ encoding: ASCII-8BIT
55
+ string: '{"deleted":1,message":"success"}'
56
+ http_version:
57
+ recorded_at: Tue, 27 Jun 2017 14:44:20 GMT
58
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/users/delete
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","external_ids":[1,2],"appboy_ids":[]}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.12.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/json
27
+ Server:
28
+ - nginx/1.10.2
29
+ X-Request-Id:
30
+ - 1e432499-cdf9-49c6-abc5-00354e59fe6b
31
+ X-Runtime:
32
+ - '0.003536'
33
+ Content-Length:
34
+ - '80'
35
+ Accept-Ranges:
36
+ - bytes
37
+ Date:
38
+ - Tue, 27 Jun 2017 14:44:22 GMT
39
+ Via:
40
+ - 1.1 varnish
41
+ Connection:
42
+ - keep-alive
43
+ X-Served-By:
44
+ - cache-ord1729-ORD
45
+ X-Cache:
46
+ - MISS
47
+ X-Cache-Hits:
48
+ - '0'
49
+ X-Timer:
50
+ - S1498574662.030820,VS0,VE24
51
+ Vary:
52
+ - Accept-Encoding
53
+ body:
54
+ encoding: ASCII-8BIT
55
+ string: '{"deleted":2,"message":"success"}'
56
+ http_version:
57
+ recorded_at: Tue, 27 Jun 2017 14:44:22 GMT
58
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/email/status
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","email":"john@example.com","subscription_state":"unsubscribed"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.2
25
+ Date:
26
+ - Thu, 19 Feb 2015 20:42:25 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Status:
34
+ - 201 Created
35
+ Strict-Transport-Security:
36
+ - max-age=31536000
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Etag:
40
+ - '"8736cdfe08480bca66cffeee06268705"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 664ec9e1c8bf8666cadff79ee1a56434
45
+ X-Runtime:
46
+ - '0.024496'
47
+ Vary:
48
+ - Accept-Encoding
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"message":"success"}'
52
+ http_version:
53
+ recorded_at: Thu, 19 Feb 2015 20:42:24 GMT
54
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/email/status
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","email":"john@example.com","subscription_state":"unsubscribed"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.2
25
+ Date:
26
+ - Thu, 19 Feb 2015 20:42:25 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Status:
34
+ - 201 Created
35
+ Strict-Transport-Security:
36
+ - max-age=31536000
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Etag:
40
+ - '"8736cdfe08480bca66cffeee06268705"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 0854d9c1be11939007bace0da4e264ac
45
+ X-Runtime:
46
+ - '0.025690'
47
+ Vary:
48
+ - Accept-Encoding
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"message":"success"}'
52
+ http_version:
53
+ recorded_at: Thu, 19 Feb 2015 20:42:25 GMT
54
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/email/status
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","email":"doesntexist@example.com","subscription_state":"unsubscribed"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 400
21
+ message: Bad Request
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.2
25
+ Date:
26
+ - Thu, 19 Feb 2015 20:42:25 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Status:
34
+ - 400 Bad Request
35
+ Strict-Transport-Security:
36
+ - max-age=31536000
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Cache-Control:
40
+ - no-cache
41
+ X-Request-Id:
42
+ - bf074c868b8c3a9c3d20dcecc7684d0b
43
+ X-Runtime:
44
+ - '0.015444'
45
+ Vary:
46
+ - Accept-Encoding
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"message":"There is no user with the provided email"}'
50
+ http_version:
51
+ recorded_at: Thu, 19 Feb 2015 20:42:25 GMT
52
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/email/status
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","email":"doesntexist@example.com","subscription_state":"unsubscribed"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 400
21
+ message: Bad Request
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.2
25
+ Date:
26
+ - Thu, 19 Feb 2015 20:42:25 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Status:
34
+ - 400 Bad Request
35
+ Strict-Transport-Security:
36
+ - max-age=31536000
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Cache-Control:
40
+ - no-cache
41
+ X-Request-Id:
42
+ - 3817bbfc977af9d97686243969e9733f
43
+ X-Runtime:
44
+ - '0.015907'
45
+ Vary:
46
+ - Accept-Encoding
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"message":"There is no user with the provided email"}'
50
+ http_version:
51
+ recorded_at: Thu, 19 Feb 2015 20:42:25 GMT
52
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/users/export/ids
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","external_ids":[1]}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.2
25
+ Date:
26
+ - Thu, 26 Feb 2015 21:41:18 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Status:
34
+ - 201 Created
35
+ Strict-Transport-Security:
36
+ - max-age=31536000
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Etag:
40
+ - '"051590a5519f8271c86bbaa59a309f47"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 25b7fb12aad1ffaea7b9f4f4752a0bec
45
+ X-Runtime:
46
+ - '1.105644'
47
+ Vary:
48
+ - Accept-Encoding
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"users":[{"external_id":"1","email":"john@example.com","total_revenue":97.09,"push_subscribe":"subscribed","email_subscribe":"opted_in","custom_attributes":{"custom_attribute":"Yes","foo":"fighters","capabilities":["Rewards","Custom
52
+ Survey Questions","Foo","Baz","K-invite","Multi-Redemption"]},"apps":[],"custom_events":[{"name":"baz","first":"2015-02-15T00:16:33Z","last":"2015-02-16T02:04:32Z","count":19},{"name":"Does
53
+ something significant","first":"2015-02-20T03:28:55Z","last":"2015-02-20T03:28:55Z","count":1}],"purchases":[{"name":null,"first":"2015-02-15T00:23:08Z","last":"2015-02-20T03:34:55Z","count":21},{"name":null,"first":"2015-02-20T03:35:44Z","last":"2015-02-20T03:35:44Z","count":1}]}],"invalid_user_ids":[1],"message":"success"}'
54
+ http_version:
55
+ recorded_at: Thu, 26 Feb 2015 21:41:18 GMT
56
+ recorded_with: VCR 2.9.2