Class: Raises::Delivery
- Inherits:
-
Object
- Object
- Raises::Delivery
- Defined in:
- lib/raises/delivery.rb
Instance Method Summary collapse
- #call(notice) ⇒ Object
-
#initialize(post:, spool:, warn:) ⇒ Delivery
constructor
A new instance of Delivery.
Constructor Details
#initialize(post:, spool:, warn:) ⇒ Delivery
Returns a new instance of Delivery.
7 8 9 10 11 |
# File 'lib/raises/delivery.rb', line 7 def initialize(post:, spool:, warn:) @post = post @spool = spool @warn = warn end |
Instance Method Details
#call(notice) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/raises/delivery.rb', line 13 def call(notice) response = @post.call(notice) return response unless response.respond_to?(:code) return response if response.is_a?(Net::HTTPSuccess) handle_response(notice, response.code.to_i) response rescue StandardError => e handle_exception(notice, e) nil end |