notify_user 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b33bbd2593d7ade8139c4a5a5bbb693ca0806fc6
4
- data.tar.gz: cd5dba867d875a448871642ca027b5553f937c02
3
+ metadata.gz: dc991c9547c3c9b6a595ebee3bb5a48284f620d2
4
+ data.tar.gz: 923ed73f2a0d2be1fc57a35b6ab5c6c0f0f59562
5
5
  SHA512:
6
- metadata.gz: 91ae7db27368c1ea284d9eb6567bf8f5430a7f956bf12c3cc5163a0662aad19543fc0d19e55dce11ca226414ee1d196159ad5b075ee6e511ab42f8257bc12488
7
- data.tar.gz: 42525066c51679061f1cc730797c090d87a5b9a911ba2d510fcd7dd6f9cc7202601220ae5a5c79585b48d4fd83ac9bdcbc86307c3d5073f20df2622b95a75777
6
+ metadata.gz: 8ef3f9889f3f3524633eca6d9d8dc70e09bd530b444a4978409b2abe6e4154437c8440ce6e8b84b9e13468ac4a68b9335007a1bf9397adfb28f7033a2cc621ce
7
+ data.tar.gz: c0969fcd052e22151f9ec4bf17b6ce1d9c45779d3318d4954f1e0db91733bac9c1abbdd0e4b62f8ed8101e22b7c3194a4dce333e198bc8aead830727cf514a24
@@ -77,18 +77,19 @@ module NotifyUser
77
77
  def message
78
78
  string = ActionView::Base.new(
79
79
  Rails.configuration.paths["app/views"]).render(
80
- :template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
81
- :locals => { :params => self.params}, :layout => false)
82
- return ::CGI.unescapeHTML("#{string}")
80
+ :template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
81
+ :locals => { :params => self.params})
82
+
83
+ return ::CGI.unescapeHTML("#{string}")
83
84
  end
84
85
 
85
86
  def mobile_message(length=115)
86
87
  string = truncate(ActionView::Base.new(
87
88
  Rails.configuration.paths["app/views"]).render(
88
- :template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
89
- :locals => { :params => self.params}, :layout => false), :length => length)
89
+ :template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
90
+ :locals => { :params => self.params}), :length => length)
90
91
 
91
- return ::CGI.unescapeHTML("#{string}")
92
+ return ::CGI.unescapeHTML("#{string}")
92
93
  end
93
94
 
94
95
  ## Public Interface
@@ -175,7 +176,7 @@ module NotifyUser
175
176
  # if aggregation is false bypass aggregation completely
176
177
  self.channels.each do |channel_name, options|
177
178
  if(options[:aggregate_per] == false)
178
- self.class.delay.deliver_notification_channel(self.id, channel_name)
179
+ self.class.delay.deliver_notification_channel(self.id, channel_name)
179
180
  else
180
181
  # only notifies channels if no pending aggreagte notifications
181
182
  if not aggregation_pending?
@@ -186,7 +187,7 @@ module NotifyUser
186
187
  end
187
188
  end
188
189
 
189
- # Sends immediately and without aggregation
190
+ # Sends immediately and without aggregation
190
191
  def deliver!
191
192
  if pending_no_aggregation? and not user_has_unsubscribed?
192
193
  self.mark_as_sent!
@@ -242,7 +243,7 @@ module NotifyUser
242
243
 
243
244
  # Find any pending notifications with the same type and target, which can all be sent in one message.
244
245
  notifications = self.pending_aggregation_with(notification)
245
-
246
+
246
247
  notifications.map(&:mark_as_sent)
247
248
  notifications.map(&:save)
248
249
 
@@ -257,21 +258,21 @@ module NotifyUser
257
258
  end
258
259
 
259
260
  private
260
-
261
+
261
262
  def unsubscribed_validation
262
- errors.add(:target, (" has unsubscribed from this type")) if user_has_unsubscribed?
263
+ errors.add(:target, (" has unsubscribed from this type")) if user_has_unsubscribed?
263
264
  end
264
265
 
265
266
  def user_has_unsubscribed?
266
- #return true if user has unsubscribed
267
- return true unless NotifyUser::Unsubscribe.has_unsubscribed_from(self.target, self.type).empty?
267
+ #return true if user has unsubscribed
268
+ return true unless NotifyUser::Unsubscribe.has_unsubscribed_from(self.target, self.type).empty?
268
269
 
269
- return false
270
+ return false
270
271
  end
271
-
272
+
272
273
  def self.unsubscribed_from_channel?(user, type)
273
- #return true if user has unsubscribed
274
- return !NotifyUser::Unsubscribe.has_unsubscribed_from(user, type).empty?
274
+ #return true if user has unsubscribed
275
+ return !NotifyUser::Unsubscribe.has_unsubscribed_from(user, type).empty?
275
276
  end
276
277
 
277
278
 
@@ -1,3 +1,3 @@
1
1
  module NotifyUser
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notify_user
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Spacek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails