Skip to content

Commit

Permalink
Update Ruby API
Browse files Browse the repository at this point in the history
  • Loading branch information
OneSignal committed Apr 11, 2022
1 parent b83385b commit 9705e33
Show file tree
Hide file tree
Showing 118 changed files with 14,471 additions and 237 deletions.
38 changes: 38 additions & 0 deletions OneSignal.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- encoding: utf-8 -*-

=begin
#OneSignal
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
The version of the OpenAPI document: 1.0.1
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.0.0-SNAPSHOT
=end

$:.push File.expand_path("../lib", __FILE__)
require "OneSignal/version"

Gem::Specification.new do |s|
s.name = "OneSignal"
s.version = OneSignal::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["OneSignal"]
s.email = ["devrel@onesignal.com"]
s.homepage = "https://onesignal.com/"
s.summary = "OneSignal"
s.description = "OneSignal"
s.license = "Modified MIT"
s.required_ruby_version = ">= 2.4"

s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'

s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'

s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
s.test_files = `find spec/*`.split("\n")
s.executables = []
s.require_paths = ["lib"]
end
109 changes: 44 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,80 @@
<h1 align="center">Welcome to the official OneSignal Ruby Client 👋</h1>

[![Gem Version][rgb]][rgl]

<p>
<a href="https://github.com/OneSignal/onesignal-ruby-client/blob/master/README.md" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
<a href="https://github.com/OneSignal/onesignal-ruby-client/graphs/commit-activity" target="_blank">
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" />
</a>
<a href="https://twitter.com/onesignal" target="_blank">
<img alt="Twitter: onesignal" src="https://img.shields.io/twitter/follow/onesignal.svg?style=social" />
</a>
</p>

# 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](https://openapi-generator.tech) project:

OneSignal is a simple ruby wrapper for the [OneSignal API][osa].
- API version: 1.0.1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
For more information, please visit [https://onesignal.com](https://onesignal.com)

### 🖤 [RubyGems](https://rubygems.org/gems/onesignal)
## Installation

## 🚧 In Beta 🚧
### Build a gem

## Installation
To build the Ruby code into a gem:

Add this line to your application's Gemfile:
```shell
gem build OneSignal.gemspec
```

```ruby
gem 'onesignal', '~> 1.0.0.beta1'
Then either install the gem locally:

```shell
gem install ./OneSignal-1.0.0.gem
```

And then execute:
(for development, run `gem install --dev ./OneSignal-1.0.0.gem` to install the development dependencies)

or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).

Finally add this to the Gemfile:

gem 'OneSignal', '~> 1.0.0'

### 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:

$ bundle
gem 'OneSignal', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Or install it yourself as:
### Include the Ruby code directly

$ gem install onesignal --pre
Include the Ruby code directly using `-I` as follows:

Or install from Github:
$ gem "onesignal", '~> 1.0.0.beta1', git: 'git://github.com/OneSignal/onesignal-ruby-client.git'
```shell
ruby -Ilib script.rb
```

## Getting Started

Please follow the [installation](#installation) procedure and then run the following code:

```ruby
require 'time'
require 'onesignal'
# setup authorization
# Load the gem
require 'OneSignal'

# Setup authorization
OneSignal.configure do |config|
# Configure Bearer authorization: app_key
config.access_token = 'YOUR BEARER TOKEN' # Change this
config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = OneSignal::DefaultApi.new
notification = OneSignal::Notification.new({app_id: 'YOUR APP ID'}) # Notification
app_id = 'app_id_example' # String |
notification_id = 'notification_id_example' # String |

begin
# Create notification
result = api_instance.create_notification(notification)
#Stop a scheduled or currently outgoing notification
result = api_instance.cancel_notification(app_id, notification_id)
p result
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->create_notification: #{e}"
puts "Exception when calling DefaultApi->cancel_notification: #{e}"
end

```

## Documentation for API Endpoints
Expand Down Expand Up @@ -118,7 +124,7 @@ Class | Method | HTTP request | Description
- [OneSignal::InlineResponse400](docs/InlineResponse400.md)
- [OneSignal::InlineResponse4001](docs/InlineResponse4001.md)
- [OneSignal::InlineResponse4002](docs/InlineResponse4002.md)
- [OneSignal::InlineResponse409](docs/InlineResponse409.md)
- [OneSignal::InlineResponse4003](docs/InlineResponse4003.md)
- [OneSignal::Notification](docs/Notification.md)
- [OneSignal::NotificationAllOf](docs/NotificationAllOf.md)
- [OneSignal::NotificationAllOfAndroidBackgroundLayout](docs/NotificationAllOfAndroidBackgroundLayout.md)
Expand Down Expand Up @@ -148,30 +154,3 @@ Class | Method | HTTP request | Description

- **Type**: Bearer authentication

## License

The gem is available as open source under the terms of the [MIT License][mit].

[rgb]: https://img.shields.io/gem/v/onesignal.svg
[rgl]: https://rubygems.org/gems/onesignal
[osa]: https://documentation.onesignal.com/reference/
[mit]: http://opensource.org/licenses/MIT

## Author

* Website: https://onesignal.com
* Twitter: [@onesignal](https://twitter.com/onesignal)
* Github: [@OneSignal](https://github.com/OneSignal)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/OneSignal/onesignal-ruby-client/issues).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2022 [OneSignal](https://github.com/OneSignal).<br />
This project is [MIT](https://opensource.org/licenses/MIT) licensed.
2 changes: 1 addition & 1 deletion docs/App.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
## Example

```ruby
require 'onesignal'
require 'OneSignal'

instance = OneSignal::App.new(
id: null,
Expand Down
2 changes: 1 addition & 1 deletion docs/Button.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Example

```ruby
require 'onesignal'
require 'OneSignal'

instance = OneSignal::Button.new(
id: null,
Expand Down
Loading

0 comments on commit 9705e33

Please sign in to comment.