brokepoint 0.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/brokepoint.rb +35 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6b248d6746b94967395d5e43c5f69cabab94a789fa10acb35709f371ad6a9a72
4
+ data.tar.gz: '086192edde7d8000e8a70bf6c4049307cafd91ce5874df68410b3503ffac4b74'
5
+ SHA512:
6
+ metadata.gz: c550d05634eb8940110e92c81930bce34ab60d45c372944ff9ac0430175ff5a5f21b35df8ce11a8287e3b52ef358d369d8f7150ccaaa9bfdcfc56aeb8ad4be09
7
+ data.tar.gz: 7e3b200da845f13e21c98d728241fef3bdd16b9d59cbcded0515a71c4e8b442dd37b55f3d1eb4e243285a67460e180f9c07f3c366a0252d3215ef49d4f8bed40
data/lib/brokepoint.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+
5
+ class BrokepointMiddleware
6
+ def initialize(app)
7
+ @app = app
8
+ end
9
+
10
+ def call(env)
11
+ begin
12
+ status, headers, response = @app.call(env)
13
+ rescue Exception => e
14
+ Rails.logger.debug("exception has been noted")
15
+ send_message_to_brokepoint(e.message, e.full_message)
16
+ raise e
17
+ end
18
+
19
+ [status, headers, response]
20
+ end
21
+
22
+ private
23
+
24
+ def send_message_to_brokepoint(message, stacktrace)
25
+ brokepoint_installation_address = URI.parse("#{ENV.fetch('BROKEPOINT_URL')}/events")
26
+ headers = {'Content-Type': 'application/json'}
27
+
28
+ error = {
29
+ title: message,
30
+ raw_body: stacktrace
31
+ }
32
+
33
+ Net::HTTP.post(brokepoint_installation_address, { event: error }.to_json, headers)
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brokepoint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Shane Preece
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Use this gem to capture errors, exceptions, and logs and send them to
14
+ your Brokepoint install
15
+ email: brokepoint@leafcanvas.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/brokepoint.rb
21
+ homepage: https://brokepoint.com
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.0.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Error logging and tracking that works with Brokepoint
44
+ test_files: []