notification-handler 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 +4 -4
- data/LICENSE +21 -21
- data/README.md +260 -260
- data/app/models/notification_handler/notification.rb +8 -6
- data/lib/generators/notification_handler/install_generator.rb +33 -34
- data/lib/generators/templates/install/initializer.rb +12 -11
- data/lib/generators/templates/install/notification_model.rb +4 -2
- data/lib/generators/templates/install/notifications_migration.rb.erb +16 -16
- data/lib/notification-handler.rb +10 -10
- data/lib/notification_handler/configuration.rb +26 -28
- data/lib/notification_handler/engine.rb +9 -7
- data/lib/notification_handler/group.rb +19 -17
- data/lib/notification_handler/notification_library.rb +68 -62
- data/lib/notification_handler/notification_scopes.rb +21 -17
- data/lib/notification_handler/object.rb +24 -24
- data/lib/notification_handler/railtie.rb +16 -16
- data/lib/notification_handler/target.rb +26 -27
- metadata +41 -29
- data/CHANGELOG.md +0 -51
- data/lib/generators/templates/install/README.md +0 -1
@@ -1,24 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NotificationHandler
|
4
|
+
module Object
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def notification_object
|
11
|
+
has_many :belonging_notifications,
|
12
|
+
as: :object, class_name: 'Notification', dependent: :destroy
|
13
|
+
include NotificationHandler::Object::InstanceMethods
|
14
|
+
|
15
|
+
return unless defined?(NotificationSettings)
|
16
|
+
include NotificationSettings::Subscribable
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module InstanceMethods
|
21
|
+
# ...
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/railtie'
|
4
|
+
require 'active_record'
|
5
|
+
require 'active_support'
|
6
|
+
|
7
|
+
module NotificationHandler
|
8
|
+
class Railtie < Rails::Railtie
|
9
|
+
initializer 'notification-handler.active_record' do
|
10
|
+
ActiveSupport.on_load :active_record do
|
11
|
+
include NotificationHandler::Target
|
12
|
+
include NotificationHandler::Object
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,27 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NotificationHandler
|
4
|
+
module Target
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def notification_target
|
11
|
+
has_many :notifications, as: :target, dependent: :destroy
|
12
|
+
include NotificationHandler::Target::InstanceMethods
|
13
|
+
|
14
|
+
include NotificationSettings::Target if defined?(NotificationSettings)
|
15
|
+
return unless defined?(NotificationSettings)
|
16
|
+
include NotificationSettings::Subscriber
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module InstanceMethods
|
21
|
+
def notify(options = {})
|
22
|
+
notifications.create(options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,97 +1,109 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notification-handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
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-
|
11
|
+
date: 2018-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
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.
|
26
|
+
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.2'
|
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: '5.
|
40
|
+
version: '5.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: railties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.2'
|
48
48
|
type: :runtime
|
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: '5.
|
54
|
+
version: '5.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
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
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
96
|
+
version: '0'
|
83
97
|
description: Create and modify your notifications through a simple API.
|
84
98
|
email: me@jonhue.me
|
85
99
|
executables: []
|
86
100
|
extensions: []
|
87
101
|
extra_rdoc_files: []
|
88
102
|
files:
|
89
|
-
- CHANGELOG.md
|
90
103
|
- LICENSE
|
91
104
|
- README.md
|
92
105
|
- app/models/notification_handler/notification.rb
|
93
106
|
- lib/generators/notification_handler/install_generator.rb
|
94
|
-
- lib/generators/templates/install/README.md
|
95
107
|
- lib/generators/templates/install/initializer.rb
|
96
108
|
- lib/generators/templates/install/notification_model.rb
|
97
109
|
- lib/generators/templates/install/notifications_migration.rb.erb
|
@@ -116,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
128
|
requirements:
|
117
129
|
- - ">="
|
118
130
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
131
|
+
version: 2.2.2
|
120
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
133
|
requirements:
|
122
134
|
- - ">="
|
@@ -124,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
136
|
version: '0'
|
125
137
|
requirements: []
|
126
138
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.7.
|
139
|
+
rubygems_version: 2.7.6
|
128
140
|
signing_key:
|
129
141
|
specification_version: 4
|
130
142
|
summary: Create and modify your notifications through a simple API
|
data/CHANGELOG.md
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
|
3
|
-
### master
|
4
|
-
|
5
|
-
* nothing yet
|
6
|
-
|
7
|
-
### 1.2.3 - 2018/01/23
|
8
|
-
|
9
|
-
* bugfixes
|
10
|
-
* removed ActiveRecord STI from `Notification` model
|
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.beta4 - 2017/12/27
|
29
|
-
|
30
|
-
* features
|
31
|
-
* add caching functionality
|
32
|
-
* add `read` attribute to `Notification` instances
|
33
|
-
* add `notify` method to notification targets
|
34
|
-
|
35
|
-
### 1.0.0.beta3 - 2017/12/25
|
36
|
-
|
37
|
-
* features
|
38
|
-
* allow `Group` object definition in configuration
|
39
|
-
|
40
|
-
### 1.0.0.beta2 - 2017/12/23
|
41
|
-
|
42
|
-
* features
|
43
|
-
* add `NotificationHandler::Group` class for target grouping notifications
|
44
|
-
* add `metadata` hash to `Notification` objects
|
45
|
-
* enhancements
|
46
|
-
* add custom `NotificationHandler::Notification` class
|
47
|
-
* drop Rails dependency
|
48
|
-
|
49
|
-
### 1.0.0.beta1 - 2017/12/22
|
50
|
-
|
51
|
-
* initial release
|
@@ -1 +0,0 @@
|
|
1
|
-
Now run `rails db:migrate` to add NotificationHandler to your database.
|