Class: Raises::Delivery
- Inherits:
-
Object
- Object
- Raises::Delivery
- Defined in:
- lib/raises/delivery.rb
Instance Method Summary collapse
- #call(payload, path: "v1/notices") ⇒ 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(payload, path: "v1/notices") ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/raises/delivery.rb', line 13 def call(payload, path: "v1/notices") item = { "path" => path, "payload" => payload } response = @post.call(path, payload) return true unless response.respond_to?(:code) return true if response.is_a?(Net::HTTPSuccess) || response.code.to_i.between?(200, 299) response_accepted?(item, response.code.to_i) rescue StandardError => e exception_accepted?(item || { "path" => path, "payload" => payload }, e) end |