notification-pusher-onesignal 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +43 -68
- data/lib/notifications-rails.rb +6 -0
- metadata +11 -10
- data/lib/notification-pusher-onesignal.rb +0 -5
- data/lib/notification_pusher/delivery_method/one_signal.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae121b953df70ffadd0a49fffeb9a7021a22993725f02f833015f7fda0861466
|
4
|
+
data.tar.gz: 779daa39294bee3fb49a7601bcba73177f6c9d6374c49b0ae8a4e1c9f72eab63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dc12ec76a46e637606b8ac4cf810df238b51bae3cd41e629ecea69d82ddb332568b806a8de0511a86dd12cd025e80f71c1d6910d7e39fe42f838688dea25ac6
|
7
|
+
data.tar.gz: 22641a2181d63da3a2b2747025d290b65ba74adfcef002a57102e0df9ecea320efbb9dd8fdfb769a2060a9e122f5315a0987803d889d25cee4ef589778d31ca0
|
data/README.md
CHANGED
@@ -1,109 +1,84 @@
|
|
1
|
-
#
|
1
|
+
# notifications-rails
|
2
2
|
|
3
|
-
|
3
|
+
notifications-rails is the most powerful notification library for Rails. It offers not only simple APIs to create and render notifications but also supports user-integration and cross-platform delivery of notifications.
|
4
4
|
|
5
|
-
|
5
|
+
## Philosophy
|
6
6
|
|
7
|
-
|
7
|
+
notifications-rails has been built with modularity in mind. It currently consists of four components each of which bringing one essential functionality to the integration of notifications in your Rails app.
|
8
8
|
|
9
|
-
|
9
|
+
**[notification-handler](notification-handler):** Create and modify your notifications through a simple API.
|
10
10
|
|
11
|
-
|
12
|
-
* [Usage](#usage)
|
13
|
-
* [Options](#options)
|
14
|
-
* [To Do](#to-do)
|
15
|
-
* [Contributing](#contributing)
|
16
|
-
* [Semantic versioning](#semantic-versioning)
|
11
|
+
**[notification-renderer](notification-renderer):** Render your notifications in various contexts.
|
17
12
|
|
18
|
-
|
13
|
+
**[notification-pusher](notification-pusher):** Deliver your notifications to various services, including [Email](notification-pusher/notification-pusher-actionmailer) and [OneSignal](notification-pusher/notification-pusher-onesignal).
|
14
|
+
|
15
|
+
**[notification-settings](notification-settings):** Integrates with your authentication solution to craft a personalized user notification platform.
|
16
|
+
|
17
|
+
You may just use the components you actually need, or instead use this gem to bundle everything for a complete notification solution.
|
19
18
|
|
20
19
|
## Installation
|
21
20
|
|
22
|
-
|
21
|
+
You can add notifications-rails to your `Gemfile` with:
|
23
22
|
|
24
23
|
```ruby
|
25
|
-
gem '
|
24
|
+
gem 'notifications-rails'
|
26
25
|
```
|
27
26
|
|
28
|
-
And then
|
27
|
+
And then run:
|
29
28
|
|
30
|
-
$ bundle
|
29
|
+
$ bundle install
|
31
30
|
|
32
31
|
Or install it yourself as:
|
33
32
|
|
34
|
-
$ gem install
|
35
|
-
|
36
|
-
---
|
37
|
-
|
38
|
-
## Usage
|
39
|
-
|
40
|
-
Register this delivery method in your `NotificationPusher` configuration:
|
33
|
+
$ gem install notifications-rails
|
41
34
|
|
42
|
-
|
43
|
-
NotificationPusher.configure do |config|
|
44
|
-
config.register_delivery_method :one_signal, :OneSignal, app_id: 'f158a844-9f3c-4207-b246-e93603b0a970', auth_key: 'kODc3N2ItOTNC00NGzOGYtMzI5OWQ3ZmQ'
|
45
|
-
end
|
46
|
-
```
|
47
|
-
|
48
|
-
Now you can deliver your notifications through OneSignal:
|
35
|
+
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
49
36
|
|
50
37
|
```ruby
|
51
|
-
|
52
|
-
notification.deliver(:one_signal, player_ids: ['f158a844-9f3c-4207-b246-e93603b0a970'], url: Rails.application.routes.url_helpers.root_url, contents: {
|
53
|
-
en: notification.object.title
|
54
|
-
})
|
38
|
+
gem 'notifications-rails', github: 'jonhue/notifications-rails'
|
55
39
|
```
|
56
40
|
|
57
|
-
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
notification.deliver(:one_signal, player_ids: notification.target.onesignal_player_ids)
|
61
|
-
```
|
62
|
-
|
63
|
-
You can also store OneSignal information in your notification opposed to specifying it when pushing:
|
64
|
-
|
65
|
-
```ruby
|
66
|
-
notification.metadata[:onesignal_url] = Rails.application.routes.url_helpers.root_url
|
67
|
-
notification.metadata[:onesignal_contents] = { en: 'My notification content' }
|
68
|
-
notification.metadata[:onesignal_headings] = { en: 'My notification header' }
|
69
|
-
notification.metadata[:onesignal_subtitle] = { en: 'My notification subtitle' }
|
70
|
-
notification.save!
|
71
|
-
notification.deliver(:one_signal, player_ids: notification.target.onesignal_player_ids)
|
72
|
-
```
|
41
|
+
## Usage
|
73
42
|
|
43
|
+
Details on usage are provided in the [documentation](#philosophy) of the specific modules.
|
74
44
|
|
75
|
-
|
45
|
+
## Development
|
76
46
|
|
77
|
-
|
47
|
+
To start development you first have to fork this repository and locally clone your fork.
|
78
48
|
|
79
|
-
|
49
|
+
Install the projects dependencies by running:
|
80
50
|
|
81
|
-
|
51
|
+
$ bundle install
|
82
52
|
|
83
|
-
|
53
|
+
### Testing
|
84
54
|
|
85
|
-
|
55
|
+
Tests are written with RSpec. Integration tests are located in `/spec`, unit tests can be found in `<module>/spec`.
|
86
56
|
|
87
|
-
|
57
|
+
To run all tests:
|
88
58
|
|
89
|
-
|
59
|
+
$ ./rspec
|
90
60
|
|
91
|
-
|
61
|
+
To run RuboCop:
|
92
62
|
|
93
|
-
|
63
|
+
$ bundle exec rubocop
|
94
64
|
|
95
|
-
|
65
|
+
You can find all commands run by the CI workflow in `.github/workflows/ci.yml`.
|
96
66
|
|
97
|
-
|
67
|
+
## Contributing
|
98
68
|
|
99
|
-
|
69
|
+
We warmly welcome everyone who is intersted in contributing. Please reference our [contributing guidelines](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md).
|
100
70
|
|
101
|
-
##
|
71
|
+
## Releases
|
102
72
|
|
103
|
-
|
73
|
+
[Here](https://github.com/jonhue/notifications-rails/releases) you can find details on all past releases. Unreleased breaking changes that are on the current master can be found [here](CHANGELOG.md).
|
104
74
|
|
105
|
-
|
75
|
+
notifications-rails follows Semantic Versioning 2.0 as defined at http://semver.org. Reference our [security policy](SECURITY.md).
|
106
76
|
|
107
|
-
###
|
77
|
+
### Publishing
|
108
78
|
|
109
|
-
|
79
|
+
1. Review breaking changes and deprecations in `CHANGELOG.md`.
|
80
|
+
1. Change the gem version in `VERSION`.
|
81
|
+
1. Reset `CHANGELOG.md`.
|
82
|
+
1. Create a pull request to merge the changes into `master`.
|
83
|
+
1. After the pull request was merged, create a new release listing the breaking changes and commits on `master` since the last release.
|
84
|
+
1. The release workflow will publish the gems to RubyGems.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notification-pusher-onesignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: notification-pusher
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.0.
|
19
|
+
version: 3.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.0.
|
26
|
+
version: 3.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: one_signal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,16 +136,16 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description: A
|
140
|
-
|
139
|
+
description: A delivery method to send your notifications to devices on all platforms
|
140
|
+
with OneSignal.
|
141
|
+
email: jonas.huebotter@gmail.com
|
141
142
|
executables: []
|
142
143
|
extensions: []
|
143
144
|
extra_rdoc_files: []
|
144
145
|
files:
|
145
146
|
- LICENSE
|
146
147
|
- README.md
|
147
|
-
- lib/
|
148
|
-
- lib/notification_pusher/delivery_method/one_signal.rb
|
148
|
+
- lib/notifications-rails.rb
|
149
149
|
homepage: https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-onesignal
|
150
150
|
licenses:
|
151
151
|
- MIT
|
@@ -166,8 +166,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.1.4
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
|
-
summary: A
|
172
|
+
summary: A delivery method to send your notifications to devices on all platforms
|
173
|
+
with OneSignal
|
173
174
|
test_files: []
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NotificationPusher
|
4
|
-
module DeliveryMethod
|
5
|
-
class OneSignal < NotificationPusher::DeliveryMethod::Base
|
6
|
-
def call
|
7
|
-
return unless options[:player_ids].any?
|
8
|
-
|
9
|
-
::OneSignal::Notification.create params: {
|
10
|
-
app_id: options[:app_id],
|
11
|
-
url: url_param,
|
12
|
-
contents: contents_param,
|
13
|
-
headings: headings_param,
|
14
|
-
subtitle: subtitle_param,
|
15
|
-
include_player_ids: options[:player_ids]
|
16
|
-
}, opts: { auth_key: options[:auth_key] }
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def url_param
|
22
|
-
options[:url] || notification.metadata[:onesignal_url].to_h
|
23
|
-
end
|
24
|
-
|
25
|
-
def contents_param
|
26
|
-
options[:contents] || notification.metadata[:onesignal_contents].to_h
|
27
|
-
end
|
28
|
-
|
29
|
-
def headings_param
|
30
|
-
options[:headings] || notification.metadata[:onesignal_headings].to_h
|
31
|
-
end
|
32
|
-
|
33
|
-
def subtitle_param
|
34
|
-
options[:subtitle] || notification.metadata[:onesignal_subtitle].to_h
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|