noticed 1.6.2 → 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: 061ed935e699ea448343624ca8df81a5d884446616e9c613a46c19dafd7322e3
4
- data.tar.gz: a358b5c5d96adf95277510eaad75a65c4e579418d80d7daadb35b0315d5010f2
3
+ metadata.gz: dca9fddb81724156c172bcb7ac9bdcbc7d3571554dd3b906d3df02395c730b23
4
+ data.tar.gz: 5a8676aa3224c61b6623b81db22aecde7fa175c5514da465dfd735269b91394a
5
5
  SHA512:
6
- metadata.gz: 7c7768341c6aa1183d872447ff1da9d28b6f45548c5203ab99bf08588909995fbc05557dc55aa54265fd328b85ed1fc234c8cf9b33af1e6937adad2cc0c865b4
7
- data.tar.gz: d817b2475b44d40fed4d4b456dff9b16f21f7a6d0a5cfc65c2e242347312e2614c473da213378ae7e8d134a8eb9a8c3d433362d46af058a19b6f708d84fbca20
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?
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "1.6.2"
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.2
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