File: noticed.rb

package info (click to toggle)
ruby-noticed 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: ruby: 1,186; makefile: 4
file content (44 lines) | stat: -rw-r--r-- 1,255 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require "noticed/version"
require "noticed/engine"

require "zeitwerk"

loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
loader.ignore("#{__dir__}/generators")
loader.do_not_eager_load("#{__dir__}/noticed/bulk_delivery_methods")
loader.do_not_eager_load("#{__dir__}/noticed/delivery_methods")
loader.do_not_eager_load("#{__dir__}/noticed/notification_channel.rb")
loader.setup

module Noticed
  include ActiveSupport::Deprecation::DeprecatedConstantAccessor

  def self.deprecator # :nodoc:
    @deprecator ||= ActiveSupport::Deprecation.new("3.0", "Noticed")
  end

  deprecate_constant :Base, "Noticed::Event", deprecator: deprecator

  module DeliveryMethods
    include ActiveSupport::Deprecation::DeprecatedConstantAccessor

    deprecate_constant :Base, "Noticed::DeliveryMethod", deprecator: Noticed.deprecator
  end

  mattr_accessor :parent_class
  @@parent_class = "Noticed::ApplicationJob"

  class ValidationError < StandardError; end

  class ResponseUnsuccessful < StandardError
    attr_reader :response

    def initialize(response, url, args)
      @response = response
      @url = url
      @args = args

      super("POST request to #{url} returned #{response.code} response:\n#{response.body.inspect}")
    end
  end
end