Ruby Client SDK
The OneSignal Ruby client is a server OneSignal SDK for Ruby. Integrate OneSignal with your backend events, data, and more.
Ruby Client SDK
OneSignal - the Ruby gem for the OneSignal
🖤 RubyGems
Click to view the latest release version.
Installation
Add this line to your application's Gemfile:
gem 'onesignal', '~> 1.0.1'
And then execute:
$ bundle
Or install with:
$ gem install onesignal
Or install from Github:
$ gem "onesignal", '~> 1.0.1', git: 'git://github.com/OneSignal/onesignal-ruby-api.git'
Getting Started
Please follow the installation procedure and then run the following code:
require 'onesignal'
# setup authorization
OneSignal.configure do |config|
# Configure Bearer authorization: app_key
config.user_key = 'YOUR_USER_KEY' # Change this
config.app_key = 'YOUR_APP_KEY'
end
api_instance = OneSignal::DefaultApi.new
notification = OneSignal::Notification.new({app_id: 'YOUR APP ID'}) # Notification
begin
# Create notification
result = api_instance.create_notification(notification)
p result
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->create_notification: #{e}"
end
Documentation for Authorization
app_key
- Type: Bearer authentication
OneSignal.configure do |config|
config.app_key = 'APP_KEY' # replace with your app key
end
user_key
- Type: Bearer authentication
OneSignal.configure do |config|
config.user_key = 'USER_KEY' # replace with your user key
end
Documentation for API Endpoints
All URIs are relative to https://onesignal.com/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
OneSignal::DefaultApi | cancel_notification | DELETE /notifications/{notification_id} | Stop a scheduled or currently outgoing notification |
OneSignal::DefaultApi | create_app | POST /apps | Create an app |
OneSignal::DefaultApi | create_notification | POST /notifications | Create notification |
OneSignal::DefaultApi | create_player | POST /players | Add a device |
OneSignal::DefaultApi | create_segments | POST /apps/{app_id}/segments | Create Segments |
OneSignal::DefaultApi | delete_player | DELETE /players/{player_id} | Delete a user record |
OneSignal::DefaultApi | delete_segments | DELETE /apps/{app_id}/segments/{segment_id} | Delete Segments |
OneSignal::DefaultApi | export_players | POST /players/csv_export?app_id={app_id} | CSV export |
OneSignal::DefaultApi | get_app | GET /apps/{app_id} | View an app |
OneSignal::DefaultApi | get_apps | GET /apps | View apps |
OneSignal::DefaultApi | get_notification | GET /notifications/{notification_id} | View notification |
OneSignal::DefaultApi | get_notification_history | POST /notifications/{notification_id}/history | Notification History |
OneSignal::DefaultApi | get_notifications | GET /notifications | View notifications |
OneSignal::DefaultApi | get_outcomes | GET /apps/{app_id}/outcomes | View Outcomes |
OneSignal::DefaultApi | get_player | GET /players/{player_id} | View device |
OneSignal::DefaultApi | get_players | GET /players | View devices |
OneSignal::DefaultApi | update_app | PUT /apps/{app_id} | Update an app |
OneSignal::DefaultApi | update_player | PUT /players/{player_id} | Edit device |
OneSignal::DefaultApi | update_player_tags | PUT /apps/{app_id}/users/{external_user_id} | Edit tags with external user id |
Updated about 2 years ago