notification_hub 0.1.5 → 0.1.6
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/lib/notification_hub.rb +10 -1
- data/lib/notification_hub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5067d62595f0af5c45a6c8157068fc49cd2e3cd0
|
4
|
+
data.tar.gz: e75fdf19d41797cb7db3de3b5e72d68ad5f39308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f32c44be47a4bf76c345e415135b6ed9ee2e4e29b5d20f056b96d77923d6eeeb7b5739b5ffd90f81708c479167f7317eda61243c55c3e0f94fef8cbc85eca0b
|
7
|
+
data.tar.gz: 1d8796d5c84622043aadf205d2047cc84ffd3962a171f008d781dd09fe3cd3247f8a0d285a482d05f06f518a11b202e1183e860fbaa3c73be2ee5355e13cbe18
|
data/lib/notification_hub.rb
CHANGED
@@ -53,7 +53,13 @@ module NotificationHub
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def send_message(association_model_id, event_code, data_wrapper)
|
56
|
+
def send_message(association_model_id, event_code, data_wrapper)
|
57
|
+
unless NotificationHub.events.keys.include? event_code
|
58
|
+
NotificationHub.logger.error "Event code is not registered"
|
59
|
+
NotificationHub.logger.error "Event:#{event_code}"
|
60
|
+
raise "Event code is not registered"
|
61
|
+
end
|
62
|
+
|
57
63
|
# Fetch data from the database if record id is passed.
|
58
64
|
data = {}
|
59
65
|
data_wrapper.each do |key,value|
|
@@ -80,6 +86,7 @@ module NotificationHub
|
|
80
86
|
channel_const.send_message(event_code, data, device_details)
|
81
87
|
rescue => e
|
82
88
|
NotificationHub.logger.error e.message
|
89
|
+
NotificationHub.logger.error "Event:#{event_code} Channel:#{susbcription.channel_code} Subscription: #{susbcription.id} Device:#{device.id}"
|
83
90
|
e.backtrace.each { |line| NotificationHub.logger.error line }
|
84
91
|
end
|
85
92
|
end
|
@@ -87,6 +94,7 @@ module NotificationHub
|
|
87
94
|
end
|
88
95
|
|
89
96
|
def send_direct_message(event_code, data_wrapper, device_details, channel_code, gateway_code=nil)
|
97
|
+
|
90
98
|
# Fetch data from the database if record id is passed.
|
91
99
|
data = {}
|
92
100
|
data_wrapper.each do |key,value|
|
@@ -106,6 +114,7 @@ module NotificationHub
|
|
106
114
|
channel_const.send_message(event_code, data, device_details)
|
107
115
|
rescue => e
|
108
116
|
NotificationHub.logger.error e.message
|
117
|
+
NotificationHub.logger.error "Event:#{event_code} Channel:#{channel_code} Device:#{device_details.to_json}"
|
109
118
|
e.backtrace.each { |line| NotificationHub.logger.error line }
|
110
119
|
end
|
111
120
|
end
|