notification-pusher-onesignal 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c15036170fea471bfcdffbfe6d0942156299783ca6a4585bcdc587bf7df79147
4
- data.tar.gz: 2cad4bac934e4be208b38717a538cd3d5c418d11d18547f3f51aa27b9ab7b3db
3
+ metadata.gz: ae121b953df70ffadd0a49fffeb9a7021a22993725f02f833015f7fda0861466
4
+ data.tar.gz: 779daa39294bee3fb49a7601bcba73177f6c9d6374c49b0ae8a4e1c9f72eab63
5
5
  SHA512:
6
- metadata.gz: f3dff691dc7e0024d7774b78cb46e0f28a3e8070b30268260489e50ef479004246413234b95936015d04b3b66a4105d216a27704d0ff80f0e9be4ab97d7ace19
7
- data.tar.gz: 420657d2c60d5bc72d82dbfc8c9e199916b95f20f0ac79c58a6e53bd13276eadfbf1cccb82828f565924356b030a1ad6bed54244912d52db830c1a93dc939e06
6
+ metadata.gz: 5dc12ec76a46e637606b8ac4cf810df238b51bae3cd41e629ecea69d82ddb332568b806a8de0511a86dd12cd025e80f71c1d6910d7e39fe42f838688dea25ac6
7
+ data.tar.gz: 22641a2181d63da3a2b2747025d290b65ba74adfcef002a57102e0df9ecea320efbb9dd8fdfb769a2060a9e122f5315a0987803d889d25cee4ef589778d31ca0
data/README.md CHANGED
@@ -1,109 +1,84 @@
1
- # NotificationPusher for OneSignal
1
+ # notifications-rails
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/notification-pusher-onesignal.svg)](https://badge.fury.io/rb/notification-pusher-onesignal) ![Travis](https://travis-ci.com/jonhue/notifications-rails.svg?branch=master)
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
- A pusher to send cross-platform notifications with OneSignal.
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
- ## Table of Contents
9
+ **[notification-handler](notification-handler):** Create and modify your notifications through a simple API.
10
10
 
11
- * [Installation](#installation)
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
- NotificationPusher for OneSignal works with Rails 5 onwards. You can add it to your `Gemfile` with:
21
+ You can add notifications-rails to your `Gemfile` with:
23
22
 
24
23
  ```ruby
25
- gem 'notification-pusher-onesignal'
24
+ gem 'notifications-rails'
26
25
  ```
27
26
 
28
- And then execute:
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 notification-pusher-onesignal
35
-
36
- ---
37
-
38
- ## Usage
39
-
40
- Register this delivery method in your `NotificationPusher` configuration:
33
+ $ gem install notifications-rails
41
34
 
42
- ```ruby
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
- notification = Notification.create(target: User.first, object: Recipe.first)
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
- To get player id's you could use the [OnSignal](https://github.com/jonhue/onsignal-rails) gem. This is how that would look:
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
- ### Options
45
+ ## Development
76
46
 
77
- **`app_id` (required)** OneSignal App ID. Takes a string.
47
+ To start development you first have to fork this repository and locally clone your fork.
78
48
 
79
- **`auth_key` (required)** OneSignal API authentication key. Takes a string.
49
+ Install the projects dependencies by running:
80
50
 
81
- **`player_ids`** Array of OneSignal Player ID's a notification should be pushed to. Takes an array of strings.
51
+ $ bundle install
82
52
 
83
- **`url`** Specify a URL for this notification. Takes a string.
53
+ ### Testing
84
54
 
85
- **`contents`** Globalized content of the notification. Takes a hash with languages as keys and strings as values.
55
+ Tests are written with RSpec. Integration tests are located in `/spec`, unit tests can be found in `<module>/spec`.
86
56
 
87
- **`headings`** Globalized header of the notification. Takes a hash with languages as keys and strings as values.
57
+ To run all tests:
88
58
 
89
- **`subtitle`** Globalized subtitle of the notification. Takes a hash with languages as keys and strings as values.
59
+ $ ./rspec
90
60
 
91
- ---
61
+ To run RuboCop:
92
62
 
93
- ## To Do
63
+ $ bundle exec rubocop
94
64
 
95
- We use [GitHub projects](https://github.com/jonhue/notifications-rails/projects/7) to coordinate the work on this project.
65
+ You can find all commands run by the CI workflow in `.github/workflows/ci.yml`.
96
66
 
97
- To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/notifications-rails/issues/new).
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
- ## Contributing
71
+ ## Releases
102
72
 
103
- We hope that you will consider contributing to NotificationPusher for OneSignal. Please read this short overview for some information about how to get started:
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
- [Learn more about contributing to this repository](https://github.com/jonhue/notifications-rails/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/notifications-rails/blob/master/CODE_OF_CONDUCT.md)
75
+ notifications-rails follows Semantic Versioning 2.0 as defined at http://semver.org. Reference our [security policy](SECURITY.md).
106
76
 
107
- ### Semantic Versioning
77
+ ### Publishing
108
78
 
109
- NotificationPusher for OneSignal follows Semantic Versioning 2.0 as defined at http://semver.org.
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.
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'notification-handler'
4
+ require 'notification-renderer'
5
+ require 'notification-pusher'
6
+ require 'notification-settings'
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.2
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: 2019-10-10 00:00:00.000000000 Z
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.2
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.2
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 pusher to send cross-platform notifications with OneSignal.
140
- email: me@jonhue.me
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/notification-pusher-onesignal.rb
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.0.3
169
+ rubygems_version: 3.1.4
170
170
  signing_key:
171
171
  specification_version: 4
172
- summary: A pusher to send cross-platform notifications with OneSignal
172
+ summary: A delivery method to send your notifications to devices on all platforms
173
+ with OneSignal
173
174
  test_files: []
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'one_signal'
4
- require 'notification-pusher'
5
- require_relative 'notification_pusher/delivery_method/one_signal'
@@ -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