README.md in pushpad-0.4.0 vs README.md in pushpad-0.5.0

- old
+ new

@@ -73,15 +73,16 @@ ## Sending push notifications ```ruby notification = Pushpad::Notification.new({ - body: "Hello world!", # max 90 characters + body: "Hello world!", # max 120 characters title: "Website Name", # optional, defaults to your project name, max 30 characters target_url: "http://example.com", # optional, defaults to your project website icon_url: "http://example.com/assets/icon.png", # optional, defaults to the project icon - ttl: 604800 # optional, drop the notification after this number of seconds if a device is offline + ttl: 604800, # optional, drop the notification after this number of seconds if a device is offline + require_interaction: true # optional, default is false, if true it prevents Chrome from automatically closing the notification after a few seconds }) # deliver to a user notification.deliver_to user # or user_id @@ -91,22 +92,28 @@ # deliver to some users only if they have a given preference # e.g. only "users" who have a interested in "events" will be reached notification.deliver_to users, tags: ['events'] # deliver to segments +# e.g. any subscriber that has the tag "segment1" OR "segment2" notification.broadcast tags: ['segment1', 'segment2'] +# you can use boolean expressions +# they must be in the disjunctive normal form (without parenthesis) +notification.broadcast tags: ['zip_code:28865 && !optout:local_events || friend_of:Organizer123'] +notification.deliver_to users, tags: ['tag1 && tag2', 'tag3'] # equal to 'tag1 && tag2 || tag3' + # deliver to everyone notification.broadcast ``` If no user with that id has subscribed to push notifications, that id is simply ignored. The methods above return an hash: - `"id"` is the id of the notification on Pushpad -- `"scheduled"` is the number of devices to which the notification will be sent -- `"uids"` (`deliver_to` only) are the user IDs that will be actually reached by the notification (unless they have unsubscribed since the last notification) +- `"scheduled"` is the estimated reach of the notification (i.e. the number of devices to which the notification will be sent, which can be different from the number of users, since a user may receive notifications on multiple devices) +- `"uids"` (`deliver_to` only) are the user IDs that will be actually reached by the notification because they are subscribed to your notifications. For example if you send a notification to `['uid1', 'uid2', 'uid3']`, but only `'uid1'` is subscribed, you will get `['uid1']` in response. Note that if a user has unsubscribed after the last notification sent to him, he may still be reported for one time as subscribed (this is due to [the way](http://blog.pushpad.xyz/2016/05/the-push-api-and-its-wild-unsubscription-mechanism/) the W3C Push API works). ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).