Giter Club home page Giter Club logo

onesignal-ruby-old's Introduction

OneSignal Ruby bindings Build Status

This gem provides a simple SDK to access the OneSignal API.

Also check my onesignal-go library.

Installation

gem install one_signal

Development

Run the tests

bundle exec rake

Basic usage

See basic examples in example.rb. To run it:

  • rename .env.example into .env
  • set your USER_AUTH_KEY and API_KEY in the .env file
  • run ruby example.rb

Documentation

Specify your User Auth key to deal with Apps:

OneSignal::OneSignal.user_auth_key = YOUR_USER_AUTH_KEY

Specify your API key to deal with Players and Notifications:

OneSignal::OneSignal.api_key = YOUR_API_KEY

Then call the following methods on the App, Player and Notification classes. The params argument in those methods is a ruby hash and the accepted/required keys for this hash are documented in the OneSignal API documentation

Each method also accepts an optional opts hash that allows you to specify the user_auth_key/api_key on a per method basis. It allows a ruby app to talk to several different OneSignal apps:

app_1_api_key = "fake api key 1"
app_2_api_key = "fake api key 2"

# by default, method calls will use app_1_api_key
OneSignal::OneSignal.api_key = app_1_api_key

# get player with id "123" in app_1
OneSignal::Player.get(id: "123")

# get player with id "456" in app_2
OneSignal::Player.get(id: "123", opts: {auth_key: app_2_api_key})

The return value of each method is a Net::HTTPResponse.

Apps

- OneSignal::App.all(params:)
- OneSignal::App.get(id:)
- OneSignal::App.create(params:)
- OneSignal::App.update(id:, params:)

Players

- OneSignal::Player.all(params:)
- OneSignal::Player.csv_export(params:)
- OneSignal::Player.get(id:)
- OneSignal::Player.create(params:)
- OneSignal::Player.create_session(id:, params:)
- OneSignal::Player.create_purchase(id:, params:)
- OneSignal::Player.create_focus(id:, params:)
- OneSignal::Player.update(id:, params:)

Notifications

- OneSignal::Notification.all(params:)
- OneSignal::Notification.get(id:, params:)
- OneSignal::Notification.create(params:)
- OneSignal::Notification.update(id:, params:)
- OneSignal::Notification.delete(id:, params:)

Changes

See CHANGELOG.txt

Contributors

They are listed here, thanks to them!

License

Please see LICENSE for licensing details.

onesignal-ruby-old's People

Contributors

tbalthazar avatar jormon avatar koppen avatar allaire avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.