action_cable_notifications 0.1.9 → 0.1.10
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93a9012143b6b7d56623ffc5fa9f1af2b7d6e903
|
4
|
+
data.tar.gz: 33e6cc435a5e149a7899a83c97aced3c3815d841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f782dc30ebf6f14d961e020e1965b713305eba0b6ab7775441bc180afb6ad3b857ad84f629b190a9a41078f9df6b11ead947c867cbad79b15380286255bae9
|
7
|
+
data.tar.gz: c6f608b919a1ac36263908afbf0132dbb7044c3f214b706600c625c5ffefc5be1182eb6afd49256d1da7404ef9c317f4778feb02f591f873b5f0fc188d5c5c79
|
@@ -38,26 +38,34 @@ class CableNotifications
|
|
38
38
|
@collections[collection] = []
|
39
39
|
|
40
40
|
collection_add: (packet, collection) ->
|
41
|
-
|
41
|
+
for index, row of packet.data
|
42
|
+
@collections[collection || packet.collection].push( row )
|
42
43
|
|
43
44
|
collection_remove: (packet, collection) ->
|
44
45
|
console.warn 'Method not implemented: collection_remove '
|
45
46
|
|
46
|
-
|
47
|
+
create: (packet, collection) ->
|
47
48
|
data = processPacketHelper(packet, collection)
|
48
49
|
if data.record
|
49
50
|
console.warn 'Expected not to find a document already present for an add: ' + data.record
|
50
51
|
else
|
51
52
|
data.collection.push(packet.data)
|
52
53
|
|
53
|
-
|
54
|
+
update: (packet, collection) ->
|
54
55
|
data = processPacketHelper(packet, collection)
|
55
56
|
if !data.record
|
56
57
|
console.warn 'Expected to find a document to change'
|
57
58
|
else if !_.isEmpty(packet.data)
|
58
59
|
_.extend(data.record, packet.data)
|
59
60
|
|
60
|
-
|
61
|
+
update_many: (packet, collection) ->
|
62
|
+
local_collection = @collections[collection || packet.collection]
|
63
|
+
_.each packet.data, (fields) ->
|
64
|
+
record = _.findIndex(local_collection, (r) -> r.id == fields.id)
|
65
|
+
if record
|
66
|
+
_.extend(local_collection[index], fields)
|
67
|
+
|
68
|
+
destroy: (packet, collection) ->
|
61
69
|
data = processPacketHelper(packet, collection)
|
62
70
|
if !data.record
|
63
71
|
console.warn 'Expected to find a document to remove'
|
@@ -76,7 +76,7 @@ module ActionCableNotifications
|
|
76
76
|
if self.class.scoped_collection(options[:scope]).where(id: self.id)
|
77
77
|
ActionCable.server.broadcast broadcasting,
|
78
78
|
collection: self.model_name.collection,
|
79
|
-
msg: '
|
79
|
+
msg: 'create',
|
80
80
|
id: self.id,
|
81
81
|
data: self
|
82
82
|
end
|
@@ -106,7 +106,7 @@ module ActionCableNotifications
|
|
106
106
|
# performance for large data sets where only a sub
|
107
107
|
ActionCable.server.broadcast broadcasting,
|
108
108
|
collection: self.model_name.collection,
|
109
|
-
msg: '
|
109
|
+
msg: 'update',
|
110
110
|
id: self.id,
|
111
111
|
data: changes
|
112
112
|
end
|
@@ -124,7 +124,7 @@ module ActionCableNotifications
|
|
124
124
|
if self.class.scoped_collection(options[:scope]).where(id: self.id)
|
125
125
|
ActionCable.server.broadcast broadcasting,
|
126
126
|
collection: self.model_name.collection,
|
127
|
-
msg: '
|
127
|
+
msg: 'destroy',
|
128
128
|
id: self.id
|
129
129
|
end
|
130
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ByS Sistemas de Control
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|