action_cable_notifications 0.1.4 → 0.1.5
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 +4 -4
- data/README.md +23 -1
- data/lib/action_cable_notifications/callbacks.rb +1 -2
- data/lib/action_cable_notifications/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77099f72f8abc9a8cdddad94a14066bacf6ed237
|
4
|
+
data.tar.gz: 7912095ef91683daa7a35a5ae951b06674d57ee7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dc22ba6426f9b2f06ef710e6908bb97eac861c6fd0d6810cf887e21814d1531621fcde8ab6a12ccdd75a2a0152f069100ad5b3d75d977cd221db148197c6e7c
|
7
|
+
data.tar.gz: d079cacae3eb059499f1f008928dd677be4aefbc873420b647a7db588b47f13d6d24fc506bae64395363b292f9fcde29e1d30a6a16f9dd20463ca11f367ac302
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ class TestChannel < ApplicationCable::Channel
|
|
32
32
|
include ActionCableNotifications::Streams
|
33
33
|
|
34
34
|
def subscribed
|
35
|
-
stream_notifications_for model, include_initial: true
|
35
|
+
stream_notifications_for model, include_initial: true, scope: [:all, [:limit, 5], [:order, :id]]
|
36
36
|
end
|
37
37
|
|
38
38
|
def unsubscribed
|
@@ -41,6 +41,28 @@ class TestChannel < ApplicationCable::Channel
|
|
41
41
|
end
|
42
42
|
```
|
43
43
|
|
44
|
+
Method stream_notifications_for receives the following parameters:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
stream_notifications_for(model, options = {}, &block)
|
48
|
+
```
|
49
|
+
|
50
|
+
* model: **(ActiveRecord model)** - Specifies the model to be used for data fetching and event binding.
|
51
|
+
* options: **(Hash)** - Options to be used for configuracion. Default options are:
|
52
|
+
```ruby
|
53
|
+
{
|
54
|
+
actions: [:create, :update, :destroy], # Controller actions to attach to
|
55
|
+
broadcasting: model.model_name.collection, # Name of the pubsub stream
|
56
|
+
callback: nil, # Same as http://edgeapi.rubyonrails.org/classes/ActionCable/Channel/Streams.html
|
57
|
+
coder: nil, # Pass `coder: ActiveSupport::JSON` to decode messages as JSON before passing to the callback.
|
58
|
+
# Defaults to `coder: nil` which does no decoding, passes raw messages.
|
59
|
+
include_initial: false, # Send all records to the subscriber upon connection
|
60
|
+
params: params, # Params sent during subscription
|
61
|
+
scope: :all # Default collection scope
|
62
|
+
}
|
63
|
+
```
|
64
|
+
* block: **(Proc)** - Same as options[:callback]
|
65
|
+
|
44
66
|
## Contributing
|
45
67
|
Contribution directions go here.
|
46
68
|
|
@@ -45,8 +45,6 @@ module ActionCableNotifications
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
private
|
49
|
-
|
50
48
|
def notify_create
|
51
49
|
self.ActionCableNotificationsOptions.each do |broadcasting, options|
|
52
50
|
# Checks if record is within scope before broadcasting
|
@@ -89,5 +87,6 @@ module ActionCableNotifications
|
|
89
87
|
end
|
90
88
|
end
|
91
89
|
end
|
90
|
+
|
92
91
|
end
|
93
92
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_cable_notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ByS Sistemas de Control
|
@@ -44,8 +44,8 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
-
description: Rails engine that provides
|
48
|
-
|
47
|
+
description: Rails engine that provides Automatic realtime notification broadcast
|
48
|
+
for ActiveRecord models changes using Action Cable and websockets
|
49
49
|
email:
|
50
50
|
- info@bys-control.com.ar
|
51
51
|
executables: []
|