Skip to content

Commit a7ffda1

Browse files
committed
Update code example to be clearer what needs to change and create_notification over cancel_notification for clarity
1 parent 861daa0 commit a7ffda1

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,24 @@ Or install it yourself as:
4848
Please follow the [installation](#installation) procedure and then run the following code:
4949

5050
```ruby
51-
# Load the gem
51+
require 'time'
5252
require 'onesignal'
53-
54-
# Setup authorization
53+
# setup authorization
5554
OneSignal.configure do |config|
5655
# Configure Bearer authorization: app_key
57-
config.access_token = 'YOUR BEARER TOKEN'
56+
config.access_token = 'YOUR BEARER TOKEN' # Change this
5857
end
5958

6059
api_instance = OneSignal::DefaultApi.new
61-
app_id = 'APP ID EXAMPLE' # String |
62-
notification_id = 'NOTIFICATION ID EXAMPLE' # String |
60+
notification = OneSignal::Notification.new({app_id: 'YOUR APP ID'}) # Notification
6361

6462
begin
65-
#Stop a scheduled or currently outgoing notification
66-
result = api_instance.cancel_notification(app_id, notification_id)
63+
# Create notification
64+
result = api_instance.create_notification(notification)
6765
p result
6866
rescue OneSignal::ApiError => e
69-
puts "Exception when calling DefaultApi->cancel_notification: #{e}"
67+
puts "Error when calling DefaultApi->create_notification: #{e}"
7068
end
71-
7269
```
7370

7471
## Documentation for API Endpoints

0 commit comments

Comments
 (0)