notification-pusher 1.2.5 → 1.2.6

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: 1f6404dbf957d4af8cceeb6bd84c6180cce3089cad6ca82752c55977fac71096
4
- data.tar.gz: 80ab8ef54938e0d0fdccb647a0f0b5aba711ca001ec73721cec313b1f9aa7fb7
3
+ metadata.gz: fd7560832ef4368464860d34007181d07d670a83cd1926183adf6fa1b1143e67
4
+ data.tar.gz: 0774f7d730f7d22ba99111f1b2f3f78281ccd172b108fbd5de8985684740877e
5
5
  SHA512:
6
- metadata.gz: 758e31c13bc359c16df2a79c429a4efe91ee78b4db917ac95fdd40a0e7186fe1bca0523c07c4a0876bc5e7deda9eae6ed85af01bdb4d9f0938f031b640efeb50
7
- data.tar.gz: d4215771ebcb8fcc589da3037509a51d4c2675c26d879fbf95e64bc51223929ed186669ec1941a763d657553373f20a3f806ec393de2bff6620da743df4f4469
6
+ metadata.gz: 273c928173e93271afe9fef5a7d84251307c5c440e0b403c2748dc5661a538f8fc29ffa811b058100f96aa3279412f1d6516da078fc204d4d7b9933cb834236b
7
+ data.tar.gz: 1b5c830ba48b9576da245dd71556169e909e9874c97751167bf306262360937c3de3e6c90180629752cea286fa48f6cece2b51c04bf81b85a9177c6904014237
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Jonas Hübotter
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Jonas Hübotter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,177 +1,177 @@
1
- # NotificationPusher
2
-
3
- [![Gem Version](https://badge.fury.io/rb/notification-pusher.svg)](https://badge.fury.io/rb/notification-pusher) <img src="https://travis-ci.org/jonhue/notifications-rails.svg?branch=master" />
4
-
5
- Push your notifications to various services. Including Email, ActionCable, OneSignal (cross-platform notifications).
6
-
7
- ---
8
-
9
- ## Table of Contents
10
-
11
- * [Installation](#installation)
12
- * [Usage](#usage)
13
- * [Pushers](#pushers)
14
- * [Defining a pusher](#defining-a-pusher)
15
- * [Using a pusher](#using-a-pusher)
16
- * [Writing a custom pusher](#writing-a-custom-pusher)
17
- * [To Do](#to-do)
18
- * [Contributing](#contributing)
19
- * [Contributors](#contributors)
20
- * [Semantic versioning](#semantic-versioning)
21
- * [License](#license)
22
-
23
- ---
24
-
25
- ## Installation
26
-
27
- NotificationPusher works with Rails 5 onwards. You can add it to your `Gemfile` with:
28
-
29
- ```ruby
30
- gem 'notification-pusher'
31
- ```
32
-
33
- And then execute:
34
-
35
- $ bundle
36
-
37
- Or install it yourself as:
38
-
39
- $ gem install notification-pusher
40
-
41
- If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
42
-
43
- ```ruby
44
- gem 'notification-pusher', github: 'jonhue/notifications-rails'
45
- ```
46
-
47
- Now run the generator:
48
-
49
- $ rails g notification_pusher:install
50
-
51
- To wrap things up, migrate the changes to your database:
52
-
53
- $ rails db:migrate
54
-
55
- ---
56
-
57
- ## Usage
58
-
59
- ### Pushers
60
-
61
- A pusher handles the process of sending your notifications to various services for you.
62
-
63
- #### Defining a pusher
64
-
65
- You define pushers in your `NotificationPusher` configuration (`config/initializers/notification-pusher.rb`). Using:
66
-
67
- ```ruby
68
- NotificationPusher.configure do |config|
69
- config.define_pusher name, options
70
- end
71
- ```
72
-
73
- More details about defining a specific pusher (name and available options) are available in the respective documentation of the gem.
74
-
75
- #### Using a pusher
76
-
77
- It is super simple to initialize a push:
78
-
79
- ```ruby
80
- notification = Notification.create target: User.first, object: Recipe.first
81
- notification.push name, custom_options
82
- ```
83
-
84
- Where `name` is the name of the defined pusher and `custom_options` are the options that will override the default options the pusher has been defined with.
85
-
86
- You are also able to do the exact same in just one line of code:
87
-
88
- ```ruby
89
- notification = Notification.create target: User.first, object: Recipe.first, pusher: name, pusher_options: custom_options
90
- ```
91
-
92
- **Note:** In this case, pass `custom_options` as a `Hash`.
93
-
94
- It is possible to use mutliple pushers at a time:
95
-
96
- ```ruby
97
- notification.push [name_one, name_two], name_one: custom_options, name_two: custom_options
98
- ```
99
-
100
- ### Writing a custom pusher
101
-
102
- Writing custom pushers is fairly simple. Just add a new subclass to `NotificationPusher`:
103
-
104
- ```ruby
105
- class NotificationPusher::CustomPusher
106
-
107
- def initialize notification, options = {}
108
- # ...
109
- end
110
-
111
- end
112
- ```
113
-
114
- This is how to define and use your pusher:
115
-
116
- ```ruby
117
- NotificationPusher.configure do |config|
118
- config.define_pusher :CustomPusher, option_one: 'value_one'
119
- end
120
- ```
121
-
122
- ```ruby
123
- notification = Notification.create target: User.first, object: Recipe.first
124
- notification.push :CustomPusher, option_one: 'value_two'
125
- ```
126
-
127
- For further reference take a look at the default [ActionMailer](notification-pusher-actionmailer), [ActionCable](notification-pusher-actioncable) and [OneSignal](notification-pusher-onesignal) pusher.
128
-
129
- ---
130
-
131
- ## To Do
132
-
133
- [Here](https://github.com/jonhue/notifications-rails/projects/3) is the full list of current projects.
134
-
135
- To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/notifications-rails/issues/new).
136
-
137
- ---
138
-
139
- ## Contributing
140
-
141
- We hope that you will consider contributing to NotificationPusher. Please read this short overview for some information about how to get started:
142
-
143
- [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)
144
-
145
- ### Contributors
146
-
147
- Give the people some :heart: who are working on this project. See them all at:
148
-
149
- https://github.com/jonhue/notifications-rails/graphs/contributors
150
-
151
- ### Semantic Versioning
152
-
153
- NotificationPusher follows Semantic Versioning 2.0 as defined at http://semver.org.
154
-
155
- ## License
156
-
157
- MIT License
158
-
159
- Copyright (c) 2017 Jonas Hübotter
160
-
161
- Permission is hereby granted, free of charge, to any person obtaining a copy
162
- of this software and associated documentation files (the "Software"), to deal
163
- in the Software without restriction, including without limitation the rights
164
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
165
- copies of the Software, and to permit persons to whom the Software is
166
- furnished to do so, subject to the following conditions:
167
-
168
- The above copyright notice and this permission notice shall be included in all
169
- copies or substantial portions of the Software.
170
-
171
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
172
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
173
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
174
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
175
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
176
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
177
- SOFTWARE.
1
+ # NotificationPusher
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/notification-pusher.svg)](https://badge.fury.io/rb/notification-pusher) <img src="https://travis-ci.org/jonhue/notifications-rails.svg?branch=master" />
4
+
5
+ Push your notifications to various services. Including Email, ActionCable, OneSignal (cross-platform notifications).
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ * [Installation](#installation)
12
+ * [Usage](#usage)
13
+ * [Pushers](#pushers)
14
+ * [Defining a pusher](#defining-a-pusher)
15
+ * [Using a pusher](#using-a-pusher)
16
+ * [Writing a custom pusher](#writing-a-custom-pusher)
17
+ * [To Do](#to-do)
18
+ * [Contributing](#contributing)
19
+ * [Contributors](#contributors)
20
+ * [Semantic versioning](#semantic-versioning)
21
+ * [License](#license)
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ NotificationPusher works with Rails 5 onwards. You can add it to your `Gemfile` with:
28
+
29
+ ```ruby
30
+ gem 'notification-pusher'
31
+ ```
32
+
33
+ And then execute:
34
+
35
+ $ bundle
36
+
37
+ Or install it yourself as:
38
+
39
+ $ gem install notification-pusher
40
+
41
+ If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
42
+
43
+ ```ruby
44
+ gem 'notification-pusher', github: 'jonhue/notifications-rails'
45
+ ```
46
+
47
+ Now run the generator:
48
+
49
+ $ rails g notification_pusher:install
50
+
51
+ To wrap things up, migrate the changes to your database:
52
+
53
+ $ rails db:migrate
54
+
55
+ ---
56
+
57
+ ## Usage
58
+
59
+ ### Pushers
60
+
61
+ A pusher handles the process of sending your notifications to various services for you.
62
+
63
+ #### Defining a pusher
64
+
65
+ You define pushers in your `NotificationPusher` configuration (`config/initializers/notification-pusher.rb`). Using:
66
+
67
+ ```ruby
68
+ NotificationPusher.configure do |config|
69
+ config.define_pusher name, options
70
+ end
71
+ ```
72
+
73
+ More details about defining a specific pusher (name and available options) are available in the respective documentation of the gem.
74
+
75
+ #### Using a pusher
76
+
77
+ It is super simple to initialize a push:
78
+
79
+ ```ruby
80
+ notification = Notification.create target: User.first, object: Recipe.first
81
+ notification.push name, custom_options
82
+ ```
83
+
84
+ Where `name` is the name of the defined pusher and `custom_options` are the options that will override the default options the pusher has been defined with.
85
+
86
+ You are also able to do the exact same in just one line of code:
87
+
88
+ ```ruby
89
+ notification = Notification.create target: User.first, object: Recipe.first, pusher: name, pusher_options: custom_options
90
+ ```
91
+
92
+ **Note:** In this case, pass `custom_options` as a `Hash`.
93
+
94
+ It is possible to use mutliple pushers at a time:
95
+
96
+ ```ruby
97
+ notification.push [name_one, name_two], name_one: custom_options, name_two: custom_options
98
+ ```
99
+
100
+ ### Writing a custom pusher
101
+
102
+ Writing custom pushers is fairly simple. Just add a new subclass to `NotificationPusher`:
103
+
104
+ ```ruby
105
+ class NotificationPusher::CustomPusher
106
+
107
+ def initialize notification, options = {}
108
+ # ...
109
+ end
110
+
111
+ end
112
+ ```
113
+
114
+ This is how to define and use your pusher:
115
+
116
+ ```ruby
117
+ NotificationPusher.configure do |config|
118
+ config.define_pusher :CustomPusher, option_one: 'value_one'
119
+ end
120
+ ```
121
+
122
+ ```ruby
123
+ notification = Notification.create target: User.first, object: Recipe.first
124
+ notification.push :CustomPusher, option_one: 'value_two'
125
+ ```
126
+
127
+ For further reference take a look at the default [ActionMailer](notification-pusher-actionmailer), [ActionCable](notification-pusher-actioncable) and [OneSignal](notification-pusher-onesignal) pusher.
128
+
129
+ ---
130
+
131
+ ## To Do
132
+
133
+ [Here](https://github.com/jonhue/notifications-rails/projects/3) is the full list of current projects.
134
+
135
+ To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/notifications-rails/issues/new).
136
+
137
+ ---
138
+
139
+ ## Contributing
140
+
141
+ We hope that you will consider contributing to NotificationPusher. Please read this short overview for some information about how to get started:
142
+
143
+ [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)
144
+
145
+ ### Contributors
146
+
147
+ Give the people some :heart: who are working on this project. See them all at:
148
+
149
+ https://github.com/jonhue/notifications-rails/graphs/contributors
150
+
151
+ ### Semantic Versioning
152
+
153
+ NotificationPusher follows Semantic Versioning 2.0 as defined at http://semver.org.
154
+
155
+ ## License
156
+
157
+ MIT License
158
+
159
+ Copyright (c) 2017 Jonas Hübotter
160
+
161
+ Permission is hereby granted, free of charge, to any person obtaining a copy
162
+ of this software and associated documentation files (the "Software"), to deal
163
+ in the Software without restriction, including without limitation the rights
164
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
165
+ copies of the Software, and to permit persons to whom the Software is
166
+ furnished to do so, subject to the following conditions:
167
+
168
+ The above copyright notice and this permission notice shall be included in all
169
+ copies or substantial portions of the Software.
170
+
171
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
172
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
173
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
174
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
175
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
176
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
177
+ SOFTWARE.
@@ -1,17 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/migration'
3
5
 
4
6
  module NotificationPusher
7
+ class InstallGenerator < Rails::Generators::Base
8
+ source_root(File.join(File.dirname(__FILE__), '../templates/install'))
9
+ desc 'Install NotificationPusher'
5
10
 
6
- class InstallGenerator < Rails::Generators::Base
7
-
8
- source_root File.join File.dirname(__FILE__), '../templates/install'
9
- desc 'Install NotificationPusher'
10
-
11
- def create_initializer
12
- template 'initializer.rb', 'config/initializers/notification-pusher.rb'
13
- end
14
-
11
+ def create_initializer
12
+ template 'initializer.rb', 'config/initializers/notification-pusher.rb'
15
13
  end
16
-
14
+ end
17
15
  end
@@ -1,7 +1,8 @@
1
- NotificationPusher.configure do |config|
2
-
3
- # A pusher handles the process of sending your notifications to various services for you.
4
- # Learn more: https://github.com/jonhue/notifications-rails/tree/master/notification-pusher#pushers
5
- # config.define_pusher :ActionMailer, email: 'my@email.com'
6
-
7
- end
1
+ # frozen_string_literal: true
2
+
3
+ NotificationPusher.configure do |config|
4
+ # A pusher handles the process of sending your notifications to various
5
+ # services for you.
6
+ # Learn more: https://github.com/jonhue/notifications-rails/tree/master/notification-pusher#pushers
7
+ # config.define_pusher :ActionMailer, email: 'my@email.com'
8
+ end
@@ -1,9 +1,9 @@
1
- module NotificationPusher
2
-
3
- require 'notification_pusher/configuration'
1
+ # frozen_string_literal: true
4
2
 
5
- autoload :Pusher, 'notification_pusher/pusher'
3
+ module NotificationPusher
4
+ require 'notification_pusher/configuration'
6
5
 
7
- autoload :NotificationLibrary, 'notification_pusher/notification_library'
6
+ autoload :Pusher, 'notification_pusher/pusher'
8
7
 
8
+ autoload :NotificationLibrary, 'notification_pusher/notification_library'
9
9
  end
@@ -1,26 +1,24 @@
1
- module NotificationPusher
2
-
3
- class << self
4
- attr_accessor :configuration
5
- end
6
-
7
- def self.configure
8
- self.configuration ||= Configuration.new
9
- yield configuration
10
- end
11
-
12
- class Configuration
13
-
14
- attr_accessor :pushers
15
-
16
- def initialize
17
- @pushers = []
18
- end
19
-
20
- def define_pusher name, options = {}
21
- self.pushers << ::NotificationPusher::Pusher.new(name, options)
22
- end
23
-
24
- end
25
-
26
- end
1
+ # frozen_string_literal: true
2
+
3
+ module NotificationPusher
4
+ class << self
5
+ attr_accessor :configuration
6
+ end
7
+
8
+ def self.configure
9
+ self.configuration ||= Configuration.new
10
+ yield configuration
11
+ end
12
+
13
+ class Configuration
14
+ attr_accessor :pushers
15
+
16
+ def initialize
17
+ @pushers = []
18
+ end
19
+
20
+ def define_pusher(name, options = {})
21
+ pushers << ::NotificationPusher::Pusher.new(name, options)
22
+ end
23
+ end
24
+ end
@@ -1,43 +1,46 @@
1
- require 'notification-handler'
2
- require 'active_support'
3
-
4
- module NotificationPusher
5
- module NotificationLibrary
6
-
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- attr_accessor :pusher
11
- attr_accessor :pusher_options
12
-
13
- after_create_commit :initialize_pusher
14
-
15
- include NotificationPusher::NotificationLibrary::InstanceMethods
16
- end
17
-
18
- module InstanceMethods
19
-
20
- def push name, options = {}
21
- self.pusher = name
22
- self.pusher_options = options
23
- self.initialize_pusher
24
- end
25
-
26
- def initialize_pusher
27
- unless self.pusher.nil?
28
- if self.pusher.kind_of?(Array)
29
- self.pusher.each do |class_name|
30
- pusher = NotificationPusher::Pusher.find_by_name(class_name).first
31
- pusher.push(self, self.pusher_options[class_name.to_sym])
32
- end
33
- else
34
- pusher = NotificationPusher::Pusher.find_by_name(self.pusher).first
35
- pusher.push(self, self.pusher_options)
36
- end
37
- end
38
- end
39
-
40
- end
41
-
42
- end
43
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'notification-handler'
4
+ require 'active_support'
5
+
6
+ module NotificationPusher
7
+ module NotificationLibrary
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ attr_accessor :pusher
12
+ attr_accessor :pusher_options
13
+
14
+ after_create_commit :initialize_pusher
15
+
16
+ include NotificationPusher::NotificationLibrary::InstanceMethods
17
+ end
18
+
19
+ module InstanceMethods
20
+ def push(name, options = {})
21
+ self.pusher = name
22
+ self.pusher_options = options
23
+ initialize_pusher
24
+ end
25
+
26
+ private
27
+
28
+ def initialize_pusher
29
+ return if pusher.nil?
30
+
31
+ if pusher.is_a?(Array)
32
+ pusher.each do |class_name|
33
+ initiate_push(class_name, pusher_options[class_name.to_sym])
34
+ end
35
+ else
36
+ initiate_push(pusher, pusher_options)
37
+ end
38
+ end
39
+
40
+ def initiate_push(class_name, options = {})
41
+ pusher = NotificationPusher::Pusher.find_by_name(class_name).first
42
+ pusher.push(self, options)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,28 +1,27 @@
1
- module NotificationPusher
2
- class Pusher
3
-
4
- attr_accessor :name
5
- attr_accessor :options
6
- attr_accessor :instances
7
-
8
- def initialize name, options = {}
9
- @instances = []
10
- @name = name
11
- @options = options
12
- end
13
-
14
- def push notification, options = {}
15
- default_options = self.options
16
- options = options.nil? ? default_options : default_options.merge!(options)
17
- if defined?(NotificationPusher.const_get(self.name))
18
- instance = NotificationPusher.const_get(self.name).new notification, options
19
- self.instances << instance
20
- end
21
- end
22
-
23
- def self.find_by_name name
24
- NotificationPusher.configuration.pushers.select { |pusher| pusher.name == name }
25
- end
26
-
27
- end
28
- end
1
+ # frozen_string_literal: true
2
+
3
+ module NotificationPusher
4
+ class Pusher
5
+ attr_reader :name
6
+
7
+ def initialize(name, options = {})
8
+ @instances = []
9
+ @name = name
10
+ @options = options
11
+ end
12
+
13
+ def push(notification, options = {})
14
+ options = @options.merge!(options)
15
+
16
+ return unless defined?(NotificationPusher.const_get(@name))
17
+ instance = NotificationPusher.const_get(@name).new(notification, options)
18
+ @instances << instance
19
+ end
20
+
21
+ def self.find_by_name(name)
22
+ NotificationPusher.configuration.pushers.select do |pusher|
23
+ pusher.name == name
24
+ end
25
+ end
26
+ end
27
+ end
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notification-pusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
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: 2018-04-25 00:00:00.000000000 Z
11
+ date: 2018-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '5.2'
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: '5.0'
26
+ version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: notification-handler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.5
33
+ version: 1.2.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.5
40
+ version: 1.2.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.7'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.7'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.52'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '0.52'
82
+ version: '0'
69
83
  description: Push your notifications to various services. Including Email, ActionCable,
70
84
  OneSignal (cross-platform notifications).
71
85
  email: me@jonhue.me
@@ -73,7 +87,6 @@ executables: []
73
87
  extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
- - CHANGELOG.md
77
90
  - LICENSE
78
91
  - README.md
79
92
  - lib/generators/notification_pusher/install_generator.rb
@@ -94,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
107
  requirements:
95
108
  - - ">="
96
109
  - !ruby/object:Gem::Version
97
- version: '2.3'
110
+ version: 2.2.2
98
111
  required_rubygems_version: !ruby/object:Gem::Requirement
99
112
  requirements:
100
113
  - - ">="
@@ -102,9 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
115
  version: '0'
103
116
  requirements: []
104
117
  rubyforge_project:
105
- rubygems_version: 2.7.4
118
+ rubygems_version: 2.7.6
106
119
  signing_key:
107
120
  specification_version: 4
108
- summary: Push your notifications to various services. Including Email, ActionCable,
109
- OneSignal (cross-platform notifications)
121
+ summary: Push your notifications to various services
110
122
  test_files: []
@@ -1,41 +0,0 @@
1
- # Changelog
2
-
3
- ### master
4
-
5
- * nothing yet
6
-
7
- ### 1.2.5 - 2018/04/25
8
-
9
- * bugfixes
10
- * fixed #4 - Calling `push` on a notification instance throws an error
11
-
12
- ### 1.0.0 - 2017/12/28
13
-
14
- * bugfixes
15
-
16
- ### 1.0.0.beta6 - 2017/12/28
17
-
18
- * bugfixes
19
- * fix lib loading problems
20
-
21
- ### 1.0.0.beta5 - 2017/12/28
22
-
23
- * bugfixes
24
- * fix generators
25
- * fix lib loading problems
26
- * fix syntax errors
27
-
28
- ### 1.0.0.beta3 - 2017/12/25
29
-
30
- * features
31
- * add `Pusher` class and allow definition in configuration
32
-
33
- ### 1.0.0.beta2 - 2017/12/23
34
-
35
- * enhancements
36
- * add `NotificationPusher::NotificationLibrary` module to extend `NotificationHandler::Notification` model
37
- * drop Rails dependency
38
-
39
- ### 1.0.0.beta1 - 2017/12/22
40
-
41
- * initial release