noticed 1.2.4 → 1.2.9

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
  SHA256:
3
- metadata.gz: 2936d217d3d881874888d8dd68280ecc9888f41fc1edf3f195e713bf863d2233
4
- data.tar.gz: a73fba77cb4eebead7c3d343c501cbe7ca5b19db5a24b11b6d33e6674c41a1f9
3
+ metadata.gz: aab5129001fd96625a6a4141dfcf8aa93263b691fb663faa25e66153c5df9244
4
+ data.tar.gz: 22d30af822563d150c933bc5aeb2116386db73bcb114d82cf46059ae53c9407e
5
5
  SHA512:
6
- metadata.gz: 67f055f8a05d3418caf3c21c2a3938341705752e6154284bbe596ac31563fd715c7d29d5651f690ce310433d762b7dca05e99ec8326b93d477a85db91cddfd10
7
- data.tar.gz: 3fbaf13b4dd6f7f3fa9f50a52849ef0ff112268c730cdca202f2e421fd7f66cdc797147c549911addb2161ed2c40d7738d6d85e5d420427f46658eaef5b13b81
6
+ metadata.gz: 1ecf9ce4e2be01cbb171a86f1fe10feb2931e2035c8f857f2b98951c5f8e299b9eadef7b0b1086f53b971f5fa5a31f266491c57f5715cf615b7acc7cf828f518
7
+ data.tar.gz: 8f896e1e98893d611697c10ebb30e6359a5cafefc9b54d6eff7a434b05eef90d055ed82e9e1d3ed61fcb76dbc2c0be4b5845ebdff799527e745507c919070585
data/Rakefile CHANGED
@@ -18,6 +18,10 @@ require "bundler/gem_tasks"
18
18
 
19
19
  require "rake/testtask"
20
20
 
21
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
22
+ load "rails/tasks/engine.rake"
23
+ load "rails/tasks/statistics.rake"
24
+
21
25
  Rake::TestTask.new(:test) do |t|
22
26
  t.libs << "test"
23
27
  t.pattern = "test/**/*_test.rb"
@@ -29,9 +29,10 @@ module Noticed
29
29
  new(params)
30
30
  end
31
31
 
32
- def param(name)
33
- param_names.push(name)
32
+ def params(*names)
33
+ param_names.concat Array.wrap(names)
34
34
  end
35
+ alias param params
35
36
  end
36
37
 
37
38
  def initialize(params = {})
@@ -68,6 +69,9 @@ module Noticed
68
69
  def run_delivery(recipient, enqueue: true)
69
70
  delivery_methods = self.class.delivery_methods.dup
70
71
 
72
+ # Set recipient to instance var so it is available to Notification class
73
+ @recipient = recipient
74
+
71
75
  # Run database delivery inline first if it exists so other methods have access to the record
72
76
  if (index = delivery_methods.find_index { |m| m[:name] == :database })
73
77
  delivery_method = delivery_methods.delete_at(index)
@@ -1,11 +1,19 @@
1
1
  module Noticed
2
2
  class Coder
3
3
  def self.load(data)
4
+ return if data.nil?
5
+
6
+ # Text columns need JSON parsing
7
+ if data.is_a?(String)
8
+ data = JSON.parse(data)
9
+ end
10
+
4
11
  ActiveJob::Arguments.send(:deserialize_argument, data)
5
12
  end
6
13
 
7
14
  def self.dump(data)
8
- ActiveJob::Arguments.send(:serialize_argument, data)
15
+ return if data.nil?
16
+ ActiveJob::Arguments.send(:serialize_argument, data).to_json
9
17
  end
10
18
  end
11
19
  end
@@ -16,11 +16,19 @@ module Noticed
16
16
  end
17
17
 
18
18
  def channel
19
- if (method = options[:channel])
20
- notification.send(method)
21
- else
22
- Noticed::NotificationChannel
23
- end
19
+ @channel ||= begin
20
+ value = options[:channel]
21
+ case value
22
+ when String
23
+ value.constantize
24
+ when Symbol
25
+ notification.send(value)
26
+ when Class
27
+ value
28
+ else
29
+ Noticed::NotificationChannel
30
+ end
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -11,7 +11,7 @@ module Noticed
11
11
  if (method = options[:format])
12
12
  notification.send(method)
13
13
  else
14
- params
14
+ notification.params
15
15
  end
16
16
  end
17
17
 
@@ -2,7 +2,7 @@ module Noticed
2
2
  module DeliveryMethods
3
3
  class Twilio < Base
4
4
  def deliver
5
- HTTP.basic_auth(user: account_sid, pass: auth_token).post(url, json: format)
5
+ HTTP.basic_auth(user: account_sid, pass: auth_token).post(url, form: format)
6
6
  end
7
7
 
8
8
  private
@@ -13,7 +13,7 @@ module Translation
13
13
 
14
14
  def scope_translation_key(key)
15
15
  if key.to_s.start_with?(".")
16
- "notifications.#{self.class.name.underscore}#{key}"
16
+ "#{i18n_scope}.#{self.class.name.underscore}#{key}"
17
17
  else
18
18
  key
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noticed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-04 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails