README.md in pushpad-0.6.0 vs README.md in pushpad-0.7.0

- old
+ new

@@ -1,9 +1,10 @@ -# Pushpad - Web Push Notifications Service +# Pushpad - Web Push Notifications [![Build Status](https://travis-ci.org/pushpad/pushpad-ruby.svg?branch=master)](https://travis-ci.org/pushpad/pushpad-ruby) - +[![Gem Version](https://badge.fury.io/rb/pushpad.svg)](https://badge.fury.io/rb/pushpad) + [Pushpad](https://pushpad.xyz) is a service for sending push notifications from your web app. It supports the **Push API** (Chrome, Firefox, Opera) and **APNs** (Safari). Features: - notifications are delivered even when the user is not on your website @@ -80,12 +81,25 @@ notification = Pushpad::Notification.new({ 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 + image_url: "http://example.com/assets/image.png", # optional, an image to display in the notification content ttl: 604800, # optional, drop the notification after this number of seconds if a device is offline - require_interaction: true # optional, if true it prevents Chrome from automatically closing the notification after a few seconds + require_interaction: true, # optional, prevent Chrome on desktop from automatically closing the notification after a few seconds + custom_data: "123", # optional, a string that is passed as an argument to action button callbacks + // optional, add some action buttons to the notification + // see https://pushpad.xyz/docs/action_buttons + actions: [ + { + title: "My Button 1", # max length is 20 characters + target_url: "http://example.com/button-link", # optional + icon: "http://example.com/assets/button-icon.png", # optional + action: "myActionName" # optional + } + ], + starred: true # optional, bookmark the notification in the Pushpad dashboard (e.g. to highlight manual notifications) }) # deliver to a user notification.deliver_to user # or user_id @@ -107,10 +121,12 @@ # deliver to everyone notification.broadcast ``` -If no user with that id has subscribed to push notifications, that id is simply ignored. +You can set the default values for most fields in the project settings. See also [the docs](https://pushpad.xyz/docs/rest_api#notifications_api_docs) for more information about notification fields. + +If you try to send a notification to a user ID, but that user is not subscribed, that ID is simply ignored. The methods above return an hash: - `"id"` is the id of the notification on Pushpad - `"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)