Skip to content

OneSignal/onesignal-ruby-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onesignal

OneSignal - the Ruby gem for the OneSignal

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.2.2
  • Package version: 2.0.2
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://onesignal.com

Installation

Build a gem

To build the Ruby code into a gem:

gem build onesignal.gemspec

Then either install the gem locally:

gem install ./onesignal-2.0.2.gem

(for development, run gem install --dev ./onesignal-2.0.2.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'onesignal', '~> 2.0.2'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'onesignal', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'onesignal'

# Setup authorization
OneSignal.configure do |config|
  # Configure Bearer authorization: app_key
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = OneSignal::DefaultApi.new
app_id = 'app_id_example' # String | The OneSignal App ID for your app.  Available in Keys & IDs.
activity_id = 'activity_id_example' # String | Live Activity record ID
begin_live_activity_request = OneSignal::BeginLiveActivityRequest.new({push_token: 'push_token_example', subscription_id: 'subscription_id_example'}) # BeginLiveActivityRequest | 

begin
  #Start Live Activity
  api_instance.begin_live_activity(app_id, activity_id, begin_live_activity_request)
rescue OneSignal::ApiError => e
  puts "Exception when calling DefaultApi->begin_live_activity: #{e}"
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_events POST /notifications/{notification_id}/export_events?app_id={app_id} Export CSV of Events
OneSignal::DefaultApi export_players POST /players/csv_export?app_id={app_id} Export CSV of Players
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

Documentation for Authorization

app_key

  • Type: Bearer authentication

user_key

  • Type: Bearer authentication