dlnk_error_notifier 0.1.0 → 0.1.1
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 +4 -4
- data/bin/console +1 -1
- data/lib/{error_notifier → dlnk_error_notifier}/jobs/http_post_job.rb +2 -2
- data/lib/{error_notifier → dlnk_error_notifier}/middleware.rb +3 -3
- data/lib/dlnk_error_notifier/version.rb +5 -0
- data/lib/dlnk_error_notifier.rb +10 -0
- metadata +5 -5
- data/lib/error_notifier/version.rb +0 -5
- data/lib/error_notifier.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14e0b1b0c886c02aa18e4834e76718b2ba382f960df9990b869ac13d747e6423
|
4
|
+
data.tar.gz: fd43685cf77e6e9448ef5684ac1ec3272177fefc93d524ed646dc4d4b6c05880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 302e7187567a766ecbd94a12aa2225e475e16b7e2107f6c1e0d8197db91bc3ffcd22fe27b5d5a0456233532b88921a9e1ed8119cee2b0852848273810c3bf2f6
|
7
|
+
data.tar.gz: d85eed8374bf56ae088b54cbc1651814681874fddffb9ad782a171ab497c72c98f9cc178390696ebdfadc720fec2b3ade32b671e06660bec8682049698904d8e
|
data/bin/console
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "bundler/setup"
|
5
|
-
require "
|
5
|
+
require "dlnk_error_notifier"
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -3,13 +3,13 @@
|
|
3
3
|
require "active_job"
|
4
4
|
require "httparty"
|
5
5
|
|
6
|
-
module
|
6
|
+
module DlnkErrorNotifier
|
7
7
|
# HttpPostJob is an ActiveJob that performs an HTTP POST request.
|
8
8
|
# This job is enqueued to run in the background, preventing the main thread
|
9
9
|
# from being blocked by the HTTP request.
|
10
10
|
#
|
11
11
|
# @example Enqueue the job
|
12
|
-
#
|
12
|
+
# DlnkErrorNotifier::HttpPostJob.perform_later('https://your-webhook-url.com', { key: 'value' }.to_json)
|
13
13
|
#
|
14
14
|
# @param url [String] the URL to which the POST request is sent
|
15
15
|
# @param body [String] the body of the POST request, typically in JSON format
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rack/request"
|
4
|
-
require "
|
4
|
+
require "dlnk_error_notifier/jobs/http_post_job"
|
5
5
|
|
6
|
-
module
|
6
|
+
module DlnkErrorNotifier
|
7
7
|
# Middleware to catch exceptions and send them to a webhook
|
8
8
|
class Middleware
|
9
9
|
def initialize(app)
|
@@ -37,7 +37,7 @@ module ErrorNotifier
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def send_webhook(error_details)
|
40
|
-
|
40
|
+
DlnkErrorNotifier::HttpPostJob.perform_later(
|
41
41
|
ENV["WEBHOOK_URL"] || "http://localhost:3000/webhook",
|
42
42
|
error_details.to_json
|
43
43
|
)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dlnk_error_notifier/version"
|
4
|
+
require_relative "dlnk_error_notifier/middleware"
|
5
|
+
require "dlnk_error_notifier/jobs/http_post_job"
|
6
|
+
|
7
|
+
module DlnkErrorNotifier
|
8
|
+
class Error < StandardError; end
|
9
|
+
# Your code goes here...
|
10
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dlnk_error_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dalink
|
@@ -36,10 +36,10 @@ files:
|
|
36
36
|
- README.md
|
37
37
|
- bin/console
|
38
38
|
- bin/setup
|
39
|
-
- lib/
|
40
|
-
- lib/
|
41
|
-
- lib/
|
42
|
-
- lib/
|
39
|
+
- lib/dlnk_error_notifier.rb
|
40
|
+
- lib/dlnk_error_notifier/jobs/http_post_job.rb
|
41
|
+
- lib/dlnk_error_notifier/middleware.rb
|
42
|
+
- lib/dlnk_error_notifier/version.rb
|
43
43
|
homepage: https://github.com/dalink/error_notifier
|
44
44
|
licenses:
|
45
45
|
- MIT
|
data/lib/error_notifier.rb
DELETED