unagi-notifications 1.0.0
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 +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +91 -0
- data/LICENSE.txt +21 -0
- data/README.md +84 -0
- data/Rakefile +10 -0
- data/lib/assets/javascripts/firebase.js +36 -0
- data/lib/assets/javascripts/unagi-notifications.js +88 -0
- data/lib/notifications/engine.rb +7 -0
- data/lib/notifications/helper.rb +37 -0
- data/lib/notifications/railtie.rb +10 -0
- data/lib/notifications/uploader.rb +37 -0
- data/lib/notifications/version.rb +3 -0
- data/lib/notifications.rb +27 -0
- data/notifications.gemspec +45 -0
- data/test/notifications_test.rb +11 -0
- data/test/test_helper.rb +4 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3902435573c80a3be0426000abb3d1503ee39985
|
4
|
+
data.tar.gz: 3a5c22e2fd5268616c2949c032fab23aa3bef8bf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c02a69a3a07afa1bcd303cd728642d5260c814dde6eb909bb87ffe5610365304155e8948144be8661f950e8d09c1337d1ba2d1d1ba43e1b736d4efa16a32facf
|
7
|
+
data.tar.gz: f96e3014cd93a8a8413ea9d74501700350639eff4d1a125891308a091d3a0d14277adbdc11315ec0cf7fb2cedbf662b5c692d19ddc1fcace805bf19e445781a9
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
unagi-notifications (0.1.0)
|
5
|
+
actionpack (>= 3.2)
|
6
|
+
faraday
|
7
|
+
railties (>= 3.2)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
remote: https://rails-assets.org/
|
12
|
+
specs:
|
13
|
+
actionpack (5.1.5)
|
14
|
+
actionview (= 5.1.5)
|
15
|
+
activesupport (= 5.1.5)
|
16
|
+
rack (~> 2.0)
|
17
|
+
rack-test (>= 0.6.3)
|
18
|
+
rails-dom-testing (~> 2.0)
|
19
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
20
|
+
actionview (5.1.5)
|
21
|
+
activesupport (= 5.1.5)
|
22
|
+
builder (~> 3.1)
|
23
|
+
erubi (~> 1.4)
|
24
|
+
rails-dom-testing (~> 2.0)
|
25
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
26
|
+
activesupport (5.1.5)
|
27
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
28
|
+
i18n (~> 0.7)
|
29
|
+
minitest (~> 5.1)
|
30
|
+
tzinfo (~> 1.1)
|
31
|
+
builder (3.2.3)
|
32
|
+
concurrent-ruby (1.0.5)
|
33
|
+
crass (1.0.3)
|
34
|
+
erubi (1.7.1)
|
35
|
+
faraday (0.14.0)
|
36
|
+
multipart-post (>= 1.2, < 3)
|
37
|
+
i18n (0.9.5)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
loofah (2.2.0)
|
40
|
+
crass (~> 1.0.2)
|
41
|
+
nokogiri (>= 1.5.9)
|
42
|
+
method_source (0.9.0)
|
43
|
+
mini_portile2 (2.3.0)
|
44
|
+
minitest (5.11.3)
|
45
|
+
multipart-post (2.0.0)
|
46
|
+
nokogiri (1.8.2)
|
47
|
+
mini_portile2 (~> 2.3.0)
|
48
|
+
rack (2.0.4)
|
49
|
+
rack-test (0.8.3)
|
50
|
+
rack (>= 1.0, < 3)
|
51
|
+
rails-assets-jquery (1.11.1)
|
52
|
+
rails-assets-jquery-ui (1.10.4)
|
53
|
+
rails-assets-jquery (>= 1.6)
|
54
|
+
rails-dom-testing (2.0.3)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
nokogiri (>= 1.6)
|
57
|
+
rails-html-sanitizer (1.0.3)
|
58
|
+
loofah (~> 2.0)
|
59
|
+
railties (5.1.5)
|
60
|
+
actionpack (= 5.1.5)
|
61
|
+
activesupport (= 5.1.5)
|
62
|
+
method_source
|
63
|
+
rake (>= 0.8.7)
|
64
|
+
thor (>= 0.18.1, < 2.0)
|
65
|
+
rake (10.5.0)
|
66
|
+
sprockets (3.7.1)
|
67
|
+
concurrent-ruby (~> 1.0)
|
68
|
+
rack (> 1, < 3)
|
69
|
+
sprockets-rails (3.2.1)
|
70
|
+
actionpack (>= 4.0)
|
71
|
+
activesupport (>= 4.0)
|
72
|
+
sprockets (>= 3.0.0)
|
73
|
+
thor (0.20.0)
|
74
|
+
thread_safe (0.3.6)
|
75
|
+
tzinfo (1.2.5)
|
76
|
+
thread_safe (~> 0.1)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
bundler (~> 1.16)
|
83
|
+
faraday
|
84
|
+
rails-assets-jquery (= 1.11.1)
|
85
|
+
rails-assets-jquery-ui (= 1.10.4)
|
86
|
+
rake (~> 10.0)
|
87
|
+
sprockets-rails
|
88
|
+
unagi-notifications!
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Unagi (http://www.unagi.com.ar/)
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Unagi Notifications
|
2
|
+
|
3
|
+
**Unagi Notifications** is a gem developed by [Unagi](http://www.unagi.com.ar/) for Ruby on Rails applications. It integrates a simple real-time notifications system based on Google's Firebase platform.
|
4
|
+
|
5
|
+
The gem allows Rails applications to upload notifications on server-side and get them on client-sife using simple and customizable view helpers.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'notifications'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install notifications
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
Add the following code in order to configure the gem:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Notifications.configure do |config|
|
29
|
+
config.firebase_project_id = '' # You must set the Firebase project ID here
|
30
|
+
config.firebase_api_key = '' # You must set the Firebase API key here
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
### Notification creation
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Notification::Uploader.call(
|
40
|
+
origin: 'your_origin',
|
41
|
+
destination: 'your_destination',
|
42
|
+
text: 'This is an awesome notification text!',
|
43
|
+
link: 'your.awesome.website.com/posts/1',
|
44
|
+
created_at: Time.now
|
45
|
+
)
|
46
|
+
```
|
47
|
+
|
48
|
+
### Notifications reading
|
49
|
+
We provide two helpers that can be used on Rails views for users' unread notifications with HTML customization:
|
50
|
+
|
51
|
+
**Notifications list**
|
52
|
+
|
53
|
+
```erb
|
54
|
+
<%= notifications_for current_user.id,
|
55
|
+
container: :ul, # The notifications wrapper tag
|
56
|
+
container_class: 'dropdown-menu', # The notifications wrapper class
|
57
|
+
notification_container: :li, # The wrapper tag of a notification
|
58
|
+
notification_container_class: 'dropdown-item', # The wrapper class of a notification
|
59
|
+
notification_class: 'text-bold' # The notification link class
|
60
|
+
%>
|
61
|
+
```
|
62
|
+
|
63
|
+
**Notifications counter**
|
64
|
+
|
65
|
+
```erb
|
66
|
+
<%= notifications_count_for current_user.id,
|
67
|
+
container: :span, # The counter wrapper tag
|
68
|
+
container_class: 'u-bold' # The counter wrapper class
|
69
|
+
%>
|
70
|
+
```
|
71
|
+
|
72
|
+
## Development
|
73
|
+
|
74
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests. You can also run `bundle console` for an interactive prompt that will allow you to experiment.
|
75
|
+
|
76
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
|
80
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lucashour/notifications.
|
81
|
+
|
82
|
+
## License
|
83
|
+
|
84
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|