notification-pusher-onesignal 2.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -68
- data/lib/notifications-rails.rb +6 -0
- metadata +14 -12
- 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: c4a7571c13dff52d7dd4db1fdb9e24372e4f9b2a5a60b9dfbd80677d0e1257f8
|
4
|
+
data.tar.gz: adcfa042e05403dc2a0afdce6d0c274dbce61275886505a21dac5c2355fda780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 487d9e91b85b13346780f5b6035592d0c8d8ecb67476803ad78f19f03baabcf5b6dfdb26bc89bb114189ca9af821e66fb60aeb412743e248d36db90e3d0fe6c3
|
7
|
+
data.tar.gz: 8267a103a8cbf1a5fc171c7dddf24a1e5d9d6b31cc1a87d588ad245942f6b829b697df0c9479f773e99c971b969bd12c5cdfab307282d33e4d81d9cbc3896403
|
data/README.md
CHANGED
@@ -1,109 +1,84 @@
|
|
1
|
-
#
|
1
|
+
# notifications-rails
|
2
2
|
|
3
|
-
|
3
|
+
A flexible notification library supporting the delivery to external services, rendering in various environments, and user configuration by category.
|
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:
|
4
|
+
version: 4.0.0
|
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: 2022-04-24 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:
|
19
|
+
version: 4.0.0
|
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:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: one_signal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,20 +136,21 @@ 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
|
152
|
-
metadata:
|
152
|
+
metadata:
|
153
|
+
github_repo: ssh://github.com/jonhue/notifications-rails
|
153
154
|
post_install_message:
|
154
155
|
rdoc_options: []
|
155
156
|
require_paths:
|
@@ -158,15 +159,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
159
|
requirements:
|
159
160
|
- - ">="
|
160
161
|
- !ruby/object:Gem::Version
|
161
|
-
version: 2.
|
162
|
+
version: '2.7'
|
162
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
164
|
requirements:
|
164
165
|
- - ">="
|
165
166
|
- !ruby/object:Gem::Version
|
166
167
|
version: '0'
|
167
168
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.3.7
|
169
170
|
signing_key:
|
170
171
|
specification_version: 4
|
171
|
-
summary: A
|
172
|
+
summary: A delivery method to send your notifications to devices on all platforms
|
173
|
+
with OneSignal
|
172
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
|