noticed 1.6.1 → 1.6.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
  SHA256:
3
- metadata.gz: dec51920d13ba117cce592dc0545e22d5618528033e736b267238a8456cf8341
4
- data.tar.gz: 503d20af8d1640173e066e99fe3c8794155666d1f84456731253de6524f1d8e0
3
+ metadata.gz: dca9fddb81724156c172bcb7ac9bdcbc7d3571554dd3b906d3df02395c730b23
4
+ data.tar.gz: 5a8676aa3224c61b6623b81db22aecde7fa175c5514da465dfd735269b91394a
5
5
  SHA512:
6
- metadata.gz: 3d05f0f58b8d10e06782472cca617de0ba0140e42ffa0a7995adf80467fa88ae49f7656e0dd3c52d4e3130e9c3908543e5b72d05884431940422b092c50b7258
7
- data.tar.gz: 602e15164492cf2de75d6b3b43a33d67312fdd18fa0cd42fd1b3a6d4f3397ab5d283b2346a3b019dfb9dd7f79b265387b927e135fb41e560fb3fa13ba0d99d7a
6
+ metadata.gz: 582f1a4e7282af29b7a66fcf322f13e2af6880757a3871a7cb74a44b3cc5fb9de6e404e5a62d78349cd7283caab14445bb63a508595878d98cadc352ea8bcbc1
7
+ data.tar.gz: 3764af8b5240a7b7de561512086497ea60ff9fecb1ff49d85ce2ea42509b97188519a97d9e05c884e0d48aebbfdca3cb27022b88347160e066942fd00b191ec5
data/README.md CHANGED
@@ -109,7 +109,7 @@ end
109
109
  * `if: :method_name` - Calls `method_name` and cancels delivery method if `false` is returned
110
110
  * `unless: :method_name` - Calls `method_name` and cancels delivery method if `true` is returned
111
111
  * `delay: ActiveSupport::Duration` - Delays the delivery for the given duration of time
112
- * `delay: :method_name` - Calls `method_name which should return an `ActiveSupport::Duration` and delays the delivery for the given duration of time
112
+ * `delay: :method_name` - Calls `method_name` which should return an `ActiveSupport::Duration` and delays the delivery for the given duration of time
113
113
 
114
114
  ##### Helper Methods
115
115
 
@@ -16,7 +16,6 @@ module Noticed
16
16
  argument :attributes, type: :array, default: [], banner: "field:type field:type"
17
17
 
18
18
  def generate_notification
19
- binding.irb
20
19
  generate :model, name, "recipient:references{polymorphic}", "type", "params:#{json_column_type}", "read_at:datetime:index", *attributes
21
20
  end
22
21
 
@@ -6,7 +6,7 @@ module Noticed
6
6
 
7
7
  class_attribute :option_names, instance_writer: false, default: []
8
8
 
9
- attr_reader :notification, :options, :params, :recipient, :record
9
+ attr_reader :notification, :options, :params, :recipient, :record, :logger
10
10
 
11
11
  class << self
12
12
  # Copy option names from parent
@@ -36,6 +36,9 @@ module Noticed
36
36
  @recipient = args[:recipient]
37
37
  @record = args[:record]
38
38
 
39
+ # Set the default logger
40
+ @logger = @options.fetch(:logger, Rails.logger)
41
+
39
42
  # Make notification aware of database record and recipient during delivery
40
43
  @notification.record = args[:record]
41
44
  @notification.recipient = args[:recipient]
@@ -65,7 +68,6 @@ module Noticed
65
68
  # post("http://example.com", basic_auth: {user:, pass:}, headers: {}, json: {}, form: {})
66
69
  #
67
70
  def post(url, args = {})
68
- options ||= {}
69
71
  basic_auth = args.delete(:basic_auth)
70
72
  headers = args.delete(:headers)
71
73
 
@@ -76,8 +78,8 @@ module Noticed
76
78
  response = request.post(url, args)
77
79
 
78
80
  if options[:debug]
79
- Rails.logger.debug("POST #{url}")
80
- Rails.logger.debug("Response: #{response.code}: #{response}")
81
+ logger.debug("POST #{url}")
82
+ logger.debug("Response: #{response.code}: #{response}")
81
83
  end
82
84
 
83
85
  if !options[:ignore_failure] && !response.status.success?
data/lib/noticed/model.rb CHANGED
@@ -13,7 +13,7 @@ module Noticed
13
13
  included do
14
14
  self.inheritance_column = nil
15
15
 
16
- if Rails.gem_version >= Gem::Version.new("7.1")
16
+ if Rails.gem_version >= Gem::Version.new("7.1.0.alpha")
17
17
  serialize :params, coder: noticed_coder
18
18
  else
19
19
  serialize :params, noticed_coder
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "1.6.1"
2
+ VERSION = "1.6.3"
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.6.1
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-28 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails