appboy 0.0.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rspec +1 -0
  4. data/README.md +111 -21
  5. data/appboy.gemspec +18 -10
  6. data/lib/appboy.rb +5 -3
  7. data/lib/appboy/api.rb +18 -30
  8. data/lib/appboy/deprecated.rb +19 -0
  9. data/lib/appboy/endpoints/email_status.rb +13 -0
  10. data/lib/appboy/endpoints/schedule_messages.rb +15 -0
  11. data/lib/appboy/endpoints/send_messages.rb +15 -0
  12. data/lib/appboy/endpoints/track_users.rb +29 -0
  13. data/lib/appboy/http.rb +24 -0
  14. data/lib/appboy/rest.rb +7 -0
  15. data/lib/appboy/rest/base.rb +15 -0
  16. data/lib/appboy/rest/email_status.rb +21 -0
  17. data/lib/appboy/rest/export_users.rb +27 -0
  18. data/lib/appboy/rest/list_segments.rb +11 -0
  19. data/lib/appboy/rest/schedule_messages.rb +25 -0
  20. data/lib/appboy/rest/send_messages.rb +23 -0
  21. data/lib/appboy/rest/track_users.rb +14 -0
  22. data/lib/appboy/version.rb +1 -1
  23. data/spec/appboy/api_spec.rb +4 -0
  24. data/spec/appboy/endpoints/track_users_spec.rb +72 -0
  25. data/spec/appboy/rest/email_status_spec.rb +19 -0
  26. data/spec/appboy/rest/export_users_spec.rb +20 -0
  27. data/spec/appboy/rest/schedule_messages_spec.rb +34 -0
  28. data/spec/appboy/rest/send_messages_spec.rb +36 -0
  29. data/spec/appboy/rest/track_users_spec.rb +24 -0
  30. data/spec/factories.rb +32 -0
  31. data/spec/fixtures/responses/email_status/existing_email/responds_with_created.yml +54 -0
  32. data/spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml +54 -0
  33. data/spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml +52 -0
  34. data/spec/fixtures/responses/email_status/unknown_email/responds_with_error_message.yml +52 -0
  35. data/spec/fixtures/responses/export_users/by_ids/with_success/responds_with_created.yml +56 -0
  36. data/spec/fixtures/responses/export_users/by_segment/with_success/responds_with_created.yml +54 -0
  37. data/spec/fixtures/responses/list_segments/with_success/responds_with_a_list_of_segments.yml +58 -0
  38. data/spec/fixtures/responses/list_segments/with_success/responds_with_success.yml +58 -0
  39. data/spec/fixtures/responses/schedule_messages/unauthorized/responds_with_unauthorize.yml +53 -0
  40. data/spec/fixtures/responses/schedule_messages/with_success/responds_with_created.yml +55 -0
  41. data/spec/fixtures/responses/schedule_messages/with_success/responds_with_success_message.yml +55 -0
  42. data/spec/fixtures/responses/send_messages/unauthorized/responds_with_unauthorized.yml +52 -0
  43. data/spec/fixtures/responses/send_messages/with_success/responds_with_created.yml +54 -0
  44. data/spec/fixtures/responses/send_messages/with_success/responds_with_success_message.yml +54 -0
  45. data/spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml +54 -0
  46. data/spec/fixtures/responses/track_users/with_success/responds_with_created.yml +56 -0
  47. data/spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml +56 -0
  48. data/spec/integrations/email_status_spec.rb +36 -0
  49. data/spec/integrations/export_users_spec.rb +27 -0
  50. data/spec/integrations/list_segments_spec.rb +21 -0
  51. data/spec/integrations/schedule_messages_spec.rb +31 -0
  52. data/spec/integrations/send_messages_spec.rb +30 -0
  53. data/spec/integrations/track_users_spec.rb +35 -0
  54. data/spec/spec_helper.rb +10 -1
  55. data/spec/support/factory_girl.rb +10 -0
  56. data/spec/support/integrations.rb +19 -0
  57. data/spec/support/vcr.rb +17 -0
  58. metadata +212 -18
  59. data/spec/api_spec.rb +0 -60
@@ -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
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/users/export/segment
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","segment_id":"<APPBOY_TEST_SEGMENT>","callback_endpoint":"https://example.com"}'
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
+ - Tue, 24 Mar 2015 17:33:21 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
+ - '"0b603642a946afe389ef6c98459d8ba5"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - d51ea5a511c9ae34f37def7faa8c8799
45
+ X-Runtime:
46
+ - '0.012174'
47
+ Vary:
48
+ - Accept-Encoding
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"url":"https://appboy-data-export.s3.amazonaws.com/<REDACTED>.zip","message":"success"}'
52
+ http_version:
53
+ recorded_at: Tue, 24 Mar 2015 17:33:20 GMT
54
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.appboy.com/segments/list?app_group_id=<APPBOY_GROUP_ID>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
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
+ Server:
22
+ - nginx/1.6.2
23
+ Date:
24
+ - Tue, 24 Mar 2015 17:02:25 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Status:
32
+ - 200 OK
33
+ Strict-Transport-Security:
34
+ - max-age=31536000
35
+ X-Ua-Compatible:
36
+ - IE=Edge,chrome=1
37
+ Etag:
38
+ - '"5f9d8fd4ccb0c6be554231c5db4a50ef"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - c1d0235b282453da0401292810dab3a1
43
+ X-Runtime:
44
+ - '0.011660'
45
+ Vary:
46
+ - Accept-Encoding
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"segments":[{"id":"<APPBOY_TEST_SEGMENT>","name":"test","analytics_tracking_enabled":false},{"id":"<APPBOY_TEST_SEGMENT>","name":"All
50
+ Users (Zweet Local - iOS)","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"Engaged
51
+ Recent Users","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"User
52
+ Onboarding - Second Week","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"User
53
+ Onboarding - First Week","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"Lapsed
54
+ Users - 30 days","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"Lapsed
55
+ Users - 7 days","analytics_tracking_enabled":true}],"message":"success"}'
56
+ http_version:
57
+ recorded_at: Tue, 24 Mar 2015 17:02:25 GMT
58
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.appboy.com/segments/list?app_group_id=<APPBOY_GROUP_ID>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
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
+ Server:
22
+ - nginx/1.6.2
23
+ Date:
24
+ - Tue, 24 Mar 2015 17:00:42 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Status:
32
+ - 200 OK
33
+ Strict-Transport-Security:
34
+ - max-age=31536000
35
+ X-Ua-Compatible:
36
+ - IE=Edge,chrome=1
37
+ Etag:
38
+ - '"5f9d8fd4ccb0c6be554231c5db4a50ef"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - d46d80a0252ffe2f86ea5c5e11ce8650
43
+ X-Runtime:
44
+ - '0.009647'
45
+ Vary:
46
+ - Accept-Encoding
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"segments":[{"id":"<APPBOY_TEST_SEGMENT>","name":"test","analytics_tracking_enabled":false},{"id":"<APPBOY_TEST_SEGMENT>","name":"All
50
+ Users (Zweet Local - iOS)","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"Engaged
51
+ Recent Users","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"User
52
+ Onboarding - Second Week","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"User
53
+ Onboarding - First Week","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>1","name":"Lapsed
54
+ Users - 30 days","analytics_tracking_enabled":true},{"id":"<APPBOY_TEST_SEGMENT>","name":"Lapsed
55
+ Users - 7 days","analytics_tracking_enabled":true}],"message":"success"}'
56
+ http_version:
57
+ recorded_at: Tue, 24 Mar 2015 17:00:42 GMT
58
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/messages/schedule
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"non-existent","segment_ids":["<APPBOY_TEST_SEGMENT>"],"send_at":"2015-02-15
9
+ 00:00:00 -0500","deliver_in_local_timezone":false,"messages":{"apple_push":{"alert":"hello"}}}'
10
+ headers:
11
+ User-Agent:
12
+ - Faraday v0.9.1
13
+ Content-Type:
14
+ - application/json
15
+ Accept-Encoding:
16
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
17
+ Accept:
18
+ - "*/*"
19
+ response:
20
+ status:
21
+ code: 401
22
+ message: Unauthorized
23
+ headers:
24
+ Server:
25
+ - nginx/1.6.2
26
+ Date:
27
+ - Mon, 16 Feb 2015 02:04:31 GMT
28
+ Content-Type:
29
+ - application/json
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ Status:
35
+ - 401 Unauthorized
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Cache-Control:
41
+ - no-cache
42
+ X-Request-Id:
43
+ - 4fced4dccb4363e4660606ba27c2561a
44
+ X-Runtime:
45
+ - '0.018142'
46
+ Vary:
47
+ - Accept-Encoding
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"message":"Invalid or missing App Group API Identifier: non-existent"}'
51
+ http_version:
52
+ recorded_at: Mon, 16 Feb 2015 02:04:31 GMT
53
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.appboy.com/messages/schedule
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"app_group_id":"<APPBOY_GROUP_ID>","segment_ids":["<APPBOY_TEST_SEGMENT>"],"send_at":"2015-02-15
9
+ 00:00:00 -0500","deliver_in_local_timezone":false,"messages":{"apple_push":{"alert":"hello"}}}'
10
+ headers:
11
+ User-Agent:
12
+ - Faraday v0.9.1
13
+ Content-Type:
14
+ - application/json
15
+ Accept-Encoding:
16
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
17
+ Accept:
18
+ - "*/*"
19
+ response:
20
+ status:
21
+ code: 201
22
+ message: Created
23
+ headers:
24
+ Server:
25
+ - nginx/1.6.2
26
+ Date:
27
+ - Mon, 16 Feb 2015 02:04:31 GMT
28
+ Content-Type:
29
+ - application/json
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ Status:
35
+ - 201 Created
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ X-Ua-Compatible:
39
+ - IE=Edge,chrome=1
40
+ Etag:
41
+ - '"8736cdfe08480bca66cffeee06268705"'
42
+ Cache-Control:
43
+ - max-age=0, private, must-revalidate
44
+ X-Request-Id:
45
+ - a66956f310c2c8d642746ea807a4d1a5
46
+ X-Runtime:
47
+ - '0.026183'
48
+ Vary:
49
+ - Accept-Encoding
50
+ body:
51
+ encoding: UTF-8
52
+ string: '{"message":"success"}'
53
+ http_version:
54
+ recorded_at: Mon, 16 Feb 2015 02:04:31 GMT
55
+ recorded_with: VCR 2.9.2