noticed 2.8.1 → 2.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afd30437fc53aab8cee21f63530ce41e5b349037b517679a3d0fae3e2c315c3e
4
- data.tar.gz: 701eba3612bdddace5ec6421c16fe66290a6f591cfa91258c6bd2397c95a56e5
3
+ metadata.gz: 5d201383e13c8502a7be311994d28792696c530b57a5f9157b597719afab78a5
4
+ data.tar.gz: b09a619ca82762e66c8467a71372b42eb0e7bc733e12d95a4be331a8d4fc5767
5
5
  SHA512:
6
- metadata.gz: 0e44bf6d5ac832e7307314f5598ecf75abeafbc9049324361c8b57e12e565e9b096c49c02487c3bc1e50a2016a8c07e83239b79bff73af7a4e36870632c03455
7
- data.tar.gz: 0afb4e395bd954663fd191b136456e5d79debb9af7595a6391a20930456d2760f9db274a8b0845713bb330ada1e7e0298905b07b8f379def4dcf6a2c2b671996
6
+ metadata.gz: '09d653f788e3aed44e266714c82d368be140f42f180731dfef600359a09bf4fe8431d79633b129c7fd4403b3cbf31e32a0996d441ffbebef654957ad23fb478d'
7
+ data.tar.gz: 3469a8576ec134f72f6dc0ea4f192bdedb5312026c4f3ac44772f90552736fea8d8480145b3bbea1bb88d438bea13d6cc42d79e22f726438235e86c61e435ab2
@@ -29,6 +29,8 @@ module Noticed
29
29
  request.body = json.to_json
30
30
  elsif (form = args.delete(:form))
31
31
  request.form_data = form
32
+ elsif (body = args.delete(:body))
33
+ request.body = body
32
34
  end
33
35
 
34
36
  logger.debug("POST #{url}")
@@ -4,6 +4,7 @@ module Noticed
4
4
  include RequiredOptions
5
5
 
6
6
  extend ActiveModel::Callbacks
7
+
7
8
  define_model_callbacks :deliver
8
9
 
9
10
  class_attribute :logger, default: Rails.logger
@@ -10,7 +10,8 @@ module Noticed
10
10
  basic_auth: evaluate_option(:basic_auth),
11
11
  headers: evaluate_option(:headers),
12
12
  json: evaluate_option(:json),
13
- form: evaluate_option(:form)
13
+ form: evaluate_option(:form),
14
+ body: evaluate_option(:body)
14
15
  )
15
16
  end
16
17
  end
data/lib/noticed/coder.rb CHANGED
@@ -11,10 +11,10 @@ module Noticed
11
11
 
12
12
  def self.dump(data)
13
13
  return if data.nil?
14
- if Rails.gem_version >= Gem::Version.new("8.1.0.beta1")
15
- ActiveJob::Arguments.serialize(data)
16
- else
14
+ if ActiveJob::Arguments.respond_to?(:serialize_argument, true)
17
15
  ActiveJob::Arguments.send(:serialize_argument, data)
16
+ else
17
+ ActiveJob::Arguments.serialize(data)
18
18
  end
19
19
  end
20
20
  end
@@ -4,6 +4,7 @@ module Noticed
4
4
  include RequiredOptions
5
5
 
6
6
  extend ActiveModel::Callbacks
7
+
7
8
  define_model_callbacks :deliver
8
9
 
9
10
  class_attribute :logger, default: Rails.logger
@@ -0,0 +1,24 @@
1
+ module Noticed
2
+ module DeliveryMethods
3
+ class ActionPushNative < DeliveryMethod
4
+ required_options :devices, :format
5
+
6
+ def deliver
7
+ notification = (!!evaluate_option(:silent)) ? notification_class.silent : notification_class
8
+
9
+ notification
10
+ .with_apple(evaluate_option(:with_apple))
11
+ .with_google(evaluate_option(:with_google))
12
+ .with_data(evaluate_option(:with_data))
13
+ .new(**evaluate_option(:format))
14
+ .deliver_later_to(evaluate_option(:devices))
15
+ end
16
+
17
+ def notification_class
18
+ fetch_constant(:class) || ApplicationPushNotification
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_action_push_native, Noticed::DeliveryMethods::ActionPushNative
@@ -9,7 +9,8 @@ module Noticed
9
9
  basic_auth: evaluate_option(:basic_auth),
10
10
  headers: evaluate_option(:headers),
11
11
  json: evaluate_option(:json),
12
- form: evaluate_option(:form)
12
+ form: evaluate_option(:form),
13
+ body: evaluate_option(:body)
13
14
  )
14
15
  end
15
16
  end
@@ -2,6 +2,10 @@ module Noticed
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Noticed
4
4
 
5
+ initializer "noticed.deprecator" do |app|
6
+ app.deprecators[:noticed] = Noticed.deprecator if app.respond_to?(:deprecators)
7
+ end
8
+
5
9
  initializer "noticed.has_notifications" do
6
10
  ActiveSupport.on_load(:active_record) do
7
11
  include Noticed::HasNotifications
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.8.1"
2
+ VERSION = "2.9.3"
3
3
  end
data/lib/noticed.rb CHANGED
@@ -1,53 +1,34 @@
1
1
  require "noticed/version"
2
2
  require "noticed/engine"
3
3
 
4
+ require "zeitwerk"
5
+
6
+ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
7
+ loader.ignore("#{__dir__}/generators")
8
+ loader.do_not_eager_load("#{__dir__}/noticed/bulk_delivery_methods")
9
+ loader.do_not_eager_load("#{__dir__}/noticed/delivery_methods")
10
+ loader.do_not_eager_load("#{__dir__}/noticed/notification_channel.rb")
11
+ loader.setup
12
+
4
13
  module Noticed
5
14
  include ActiveSupport::Deprecation::DeprecatedConstantAccessor
6
15
 
7
16
  def self.deprecator # :nodoc:
8
- @deprecator ||= ActiveSupport::Deprecation.new
17
+ @deprecator ||= ActiveSupport::Deprecation.new("3.0", "Noticed")
9
18
  end
10
19
 
11
20
  deprecate_constant :Base, "Noticed::Event", deprecator: deprecator
12
21
 
13
- autoload :ApiClient, "noticed/api_client"
14
- autoload :BulkDeliveryMethod, "noticed/bulk_delivery_method"
15
- autoload :Coder, "noticed/coder"
16
- autoload :DeliveryMethod, "noticed/delivery_method"
17
- autoload :HasNotifications, "noticed/has_notifications"
18
- autoload :NotificationChannel, "noticed/notification_channel"
19
- autoload :RequiredOptions, "noticed/required_options"
20
- autoload :Translation, "noticed/translation"
21
-
22
- module BulkDeliveryMethods
23
- autoload :Bluesky, "noticed/bulk_delivery_methods/bluesky"
24
- autoload :Discord, "noticed/bulk_delivery_methods/discord"
25
- autoload :Slack, "noticed/bulk_delivery_methods/slack"
26
- autoload :Test, "noticed/bulk_delivery_methods/test"
27
- autoload :Webhook, "noticed/bulk_delivery_methods/webhook"
28
- end
29
-
30
22
  module DeliveryMethods
31
23
  include ActiveSupport::Deprecation::DeprecatedConstantAccessor
32
- deprecate_constant :Base, "Noticed::DeliveryMethod", deprecator: Noticed.deprecator
33
24
 
34
- autoload :ActionCable, "noticed/delivery_methods/action_cable"
35
- autoload :Email, "noticed/delivery_methods/email"
36
- autoload :Fcm, "noticed/delivery_methods/fcm"
37
- autoload :Ios, "noticed/delivery_methods/ios"
38
- autoload :MicrosoftTeams, "noticed/delivery_methods/microsoft_teams"
39
- autoload :Slack, "noticed/delivery_methods/slack"
40
- autoload :Test, "noticed/delivery_methods/test"
41
- autoload :TwilioMessaging, "noticed/delivery_methods/twilio_messaging"
42
- autoload :VonageSms, "noticed/delivery_methods/vonage_sms"
43
- autoload :Webhook, "noticed/delivery_methods/webhook"
25
+ deprecate_constant :Base, "Noticed::DeliveryMethod", deprecator: Noticed.deprecator
44
26
  end
45
27
 
46
28
  mattr_accessor :parent_class
47
29
  @@parent_class = "Noticed::ApplicationJob"
48
30
 
49
- class ValidationError < StandardError
50
- end
31
+ class ValidationError < StandardError; end
51
32
 
52
33
  class ResponseUnsuccessful < StandardError
53
34
  attr_reader :response
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noticed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -67,6 +67,7 @@ files:
67
67
  - lib/noticed/coder.rb
68
68
  - lib/noticed/delivery_method.rb
69
69
  - lib/noticed/delivery_methods/action_cable.rb
70
+ - lib/noticed/delivery_methods/action_push_native.rb
70
71
  - lib/noticed/delivery_methods/discord.rb
71
72
  - lib/noticed/delivery_methods/email.rb
72
73
  - lib/noticed/delivery_methods/fcm.rb
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  requirements: []
104
- rubygems_version: 3.6.9
105
+ rubygems_version: 3.7.2
105
106
  specification_version: 4
106
107
  summary: Notifications for Ruby on Rails applications
107
108
  test_files: []