roost 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -9
  3. data/lib/roost.rb +23 -2
  4. data/lib/roost/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77377fdae341f44fe67ef2cfd7dbf48d6074b1fb
4
- data.tar.gz: 0d774da3a5932e1dfea1aa1b183ef3c65f7a8cd0
3
+ metadata.gz: f20982ad4d6a908888cfc215b3ffdc3029a138d3
4
+ data.tar.gz: f2df7f813aba45c79a88f100f79ce6689aa031fa
5
5
  SHA512:
6
- metadata.gz: 16acce3631d7fac1a49e25713a14bfe2e9459a1c6598622273ebcb72e05d466d0e88183b3a57a98a1da406b3eacc8a23ebe8e46ba2e090748ab65d848669e866
7
- data.tar.gz: b8bdfd4636e6e049ac53af2d511be2e32c535139148ca4fbc4db6b0754336f8e82698df6fda7ee8318052712d50583c5e9ea3839f93f34d70397c023226ad92a
6
+ metadata.gz: 731dcfe5adacb57d08cd2dd107e9758a33c1f2da52079b52fc38211e7843dcfbe0621d3ce0c8e4167d0b04da6fbe1587b94ef47c24f03dcb40f9eab950806947
7
+ data.tar.gz: 413bf36d8d4613c2c4df1f7b737a99413f572fd98a78d04ec10184902974b715826f60432619b4eb72feab7afbcc8de05bda251dd77cb4ecb0f8d3829d1dff0c
data/README.md CHANGED
@@ -26,18 +26,55 @@ To send notifications you will first need to create an account on the [Roost web
26
26
  Set your Roost app key and app secret to the following environment variables: ENV["ROOST_APPKEY"] / ENV["ROOST_APPSECRET"]
27
27
  These can be found in the [Roost dashboard](https://dashboard.goroost.com) under settings -> API.
28
28
 
29
- Easliy send notifications through Roost. Notifications incule text (alert) and a landing page URL (url).
29
+ ### Basic Send
30
+
31
+ Easily send notifications through Roost. Notifications must include text (alert) and a landing page URL (url).
32
+
33
+ ```
34
+ alert = 'Thanks for subscribing for notifications'
35
+ url = 'https://goroost.com'
36
+
37
+ response = Roost::API.send({alert: alert,url: url})
38
+
39
+ if response['success'] == true
40
+ ..success..
41
+ else
42
+ ..failure..
43
+ end
30
44
  ```
31
- alert = 'Thanks for subscribing for notifications'
32
- url = 'https://goroost.com'
33
45
 
34
- response = Roost::API.send({alert: alert,url: url})
46
+ ### Sending With Parameters
35
47
 
36
- if response['success'] == true
37
- ..success..
38
- else
39
- ..failure..
40
- end
48
+ It is possible to target segments of your subscribers, or even individuals, and send scheduled notifications or advanced tests on notification sending. You must first have set these segments or identifiers via our [JavaScript API](http://docs.goroost.com/v1.0/docs/api-basics).
49
+
50
+ #### Accepted Parameters
51
+
52
+ | Key Name | Description |
53
+ | :--- | :--- |
54
+ | segments | List of Segments. If included, notification will be sent only to subscribers associated with one or more of the listed Segments.|
55
+ | aliases | List of user Aliases. If included, notification will be sent only to subscribers listed. |
56
+ | device_tokens | List of device tokens on which users registered. If included, notification will be sent only to devices listed. |
57
+ | exclude_tokens | List of device tokens. If included, devices listed will be excluded when the notification is sent. |
58
+ | test_type | Specifies that progressive A/B split-testing will be done to optimize delivery. If included, value must be: 'MULTI_ARM_BANDIT'. In this case, alert must also be specified as an array with a list of alternate titles (EX: ['A Notification Title', 'Alternate Title', 'Third Title']). |
59
+ | schedule_for | Time when the notification will be scheduled for delivery. Format: "YYYY-MM-DDTHH:mm:SSZ". Time is specified in Zulu/GMT. **Example:** '2015-06-20T08:00:00Z' |
60
+
61
+ ```
62
+ alert = 'Thanks for subscribing for notifications'
63
+ url = 'https://goroost.com'
64
+ aliases = ['dan@abc123.com', 'burton@xyz456', 'sattles@lmno789.com']
65
+ device_tokens = ['abcdefg123456789', '987654321gfedcba']
66
+ exclude_tokens = ['lmnopqrs789']
67
+ schedule_for = '2015-06-05T15:17:00Z'
68
+ segments = ['Story', 'News', 'Weather']
69
+ test_type = 'MULTI_ARM_BANDIT'
70
+
71
+ response = Roost::API.send({alert: alert,url: url, segments: segments, schedule_for: schedule_for})
72
+
73
+ if response['success'] == true
74
+ ..success..
75
+ else
76
+ ..failure..
77
+ end
41
78
  ```
42
79
 
43
80
  ## Contributing
@@ -20,10 +20,31 @@ module Roost
20
20
  request = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})
21
21
  request.basic_auth key,secret
22
22
 
23
- request.body = {
23
+ body = {
24
24
  alert:opts[:alert],
25
25
  url:opts[:url]
26
- }.to_json
26
+ }
27
+
28
+ if opts[:aliases] && !opts[:aliases].empty?
29
+ body[:aliases] = opts[:aliases]
30
+ end
31
+ if opts[:device_tokens] && !opts[:device_tokens].empty?
32
+ body[:device_tokens] = opts[:device_tokens]
33
+ end
34
+ if opts[:exclude_tokens] && !opts[:exclude_tokens].empty?
35
+ body[:exclude_tokens] = opts[:exclude_tokens]
36
+ end
37
+ if opts[:schedule_for] && !opts[:schedule_for].empty?
38
+ body[:schedule_for] = opts[:schedule_for]
39
+ end
40
+ if opts[:segments] && !opts[:segments].empty?
41
+ body[:segments] = opts[:segments]
42
+ end
43
+ if opts[:test_type] && !opts[:test_type].empty?
44
+ body[:test_type] = opts[:test_type]
45
+ end
46
+
47
+ request.body = body.to_json
27
48
 
28
49
  response = http.request(request)
29
50
  if response.code == "200"
@@ -1,3 +1,3 @@
1
1
  module Roost
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roost
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-03 00:00:00.000000000 Z
13
+ date: 2015-06-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler