Ruby Client SDK
The OneSignal Ruby client is a server OneSignal SDK for Ruby. Integrate OneSignal with your backend events, data, and more.
Backend SDKs in User Model Beta
You still can try using new User Model endpoints, we advise customers to not use these SDKs in production.
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_API_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 api 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 | begin_live_activity | POST /apps/{app_id}/live_activities/{activity_id}/token | Start Live Activity |
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 | create_subscription | POST /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions | |
OneSignal::DefaultApi | create_user | POST /apps/{app_id}/users | |
OneSignal::DefaultApi | delete_alias | DELETE /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} | |
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 | delete_subscription | DELETE /apps/{app_id}/subscriptions/{subscription_id} | |
OneSignal::DefaultApi | delete_user | DELETE /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
OneSignal::DefaultApi | end_live_activity | DELETE /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity |
OneSignal::DefaultApi | export_players | POST /players/csv_export?app_id={app_id} | CSV export |
OneSignal::DefaultApi | fetch_aliases | GET /apps/{app_id}/subscriptions/{subscription_id}/user/identity | |
OneSignal::DefaultApi | fetch_user | GET /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
OneSignal::DefaultApi | fetch_user_identity | GET /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
OneSignal::DefaultApi | get_app | GET /apps/{app_id} | View an app |
OneSignal::DefaultApi | get_apps | GET /apps | View apps |
OneSignal::DefaultApi | get_eligible_iams | GET /apps/{app_id}/subscriptions/{subscription_id}/iams | |
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 | identify_user_by_alias | PATCH /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
OneSignal::DefaultApi | identify_user_by_subscription_id | PATCH /apps/{app_id}/subscriptions/{subscription_id}/user/identity | |
OneSignal::DefaultApi | transfer_subscription | PATCH /apps/{app_id}/subscriptions/{subscription_id}/owner | |
OneSignal::DefaultApi | update_app | PUT /apps/{app_id} | Update an app |
OneSignal::DefaultApi | update_live_activity | POST /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push |
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 |
OneSignal::DefaultApi | update_subscription | PATCH /apps/{app_id}/subscriptions/{subscription_id} | |
OneSignal::DefaultApi | update_user | PATCH /apps/{app_id}/users/by/{alias_label}/{alias_id} |
Documentation for Models
- OneSignal::App
- OneSignal::BadRequestError
- OneSignal::BasicNotification
- OneSignal::BasicNotificationAllOf
- OneSignal::BasicNotificationAllOfAndroidBackgroundLayout
- OneSignal::BeginLiveActivityRequest
- OneSignal::Button
- OneSignal::CancelNotificationSuccessResponse
- OneSignal::CreateNotificationSuccessResponse
- OneSignal::CreatePlayerSuccessResponse
- OneSignal::CreateSegmentConflictResponse
- OneSignal::CreateSegmentSuccessResponse
- OneSignal::CreateSubscriptionRequestBody
- OneSignal::CreateUserConflictResponse
- OneSignal::CreateUserConflictResponseErrorsInner
- OneSignal::CreateUserConflictResponseErrorsItemsMeta
- OneSignal::DeletePlayerNotFoundResponse
- OneSignal::DeletePlayerSuccessResponse
- OneSignal::DeleteSegmentNotFoundResponse
- OneSignal::DeleteSegmentSuccessResponse
- OneSignal::DeliveryData
- OneSignal::ExportPlayersRequestBody
- OneSignal::ExportPlayersSuccessResponse
- OneSignal::Filter
- OneSignal::FilterExpressions
- OneSignal::GetNotificationRequestBody
- OneSignal::IdentifyUserConflictResponse
- OneSignal::IdentifyUserConflictResponseErrorsInner
- OneSignal::InlineResponse200
- OneSignal::InlineResponse2003
- OneSignal::InlineResponse201
- OneSignal::InlineResponse202
- OneSignal::InvalidIdentifierError
- OneSignal::Notification
- OneSignal::Notification200Errors
- OneSignal::NotificationAllOf
- OneSignal::NotificationHistorySuccessResponse
- OneSignal::NotificationSlice
- OneSignal::NotificationTarget
- OneSignal::NotificationWithMeta
- OneSignal::NotificationWithMetaAllOf
- OneSignal::Operator
- OneSignal::OutcomeData
- OneSignal::OutcomesData
- OneSignal::PlatformDeliveryData
- OneSignal::PlatformDeliveryDataEmailAllOf
- OneSignal::PlatformDeliveryDataSmsAllOf
- OneSignal::Player
- OneSignal::PlayerNotificationTarget
- OneSignal::PlayerNotificationTargetIncludeAliases
- OneSignal::PlayerSlice
- OneSignal::PropertiesDeltas
- OneSignal::PropertiesObject
- OneSignal::Purchase
- OneSignal::Segment
- OneSignal::SegmentNotificationTarget
- OneSignal::StringMap
- OneSignal::SubscriptionObject
- OneSignal::TransferSubscriptionRequestBody
- OneSignal::UpdateLiveActivityRequest
- OneSignal::UpdateLiveActivitySuccessResponse
- OneSignal::UpdatePlayerSuccessResponse
- OneSignal::UpdatePlayerTagsRequestBody
- OneSignal::UpdatePlayerTagsSuccessResponse
- OneSignal::UpdateSubscriptionRequestBody
- OneSignal::UpdateUserRequest
- OneSignal::User
- OneSignal::UserIdentityRequestBody
- OneSignal::UserIdentityResponse
- OneSignal::UserSubscriptionOptions
Updated 3 months ago