action_reporter 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -1
- data/action_reporter.gemspec +1 -1
- data/lib/action_reporter/audited_reporter.rb +1 -1
- data/lib/action_reporter/base.rb +14 -3
- data/lib/action_reporter/honeybadger_reporter.rb +1 -1
- data/lib/action_reporter/scout_apm_reporter.rb +2 -2
- data/lib/action_reporter/sentry_reporter.rb +1 -1
- data/lib/action_reporter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ffc0aa9e71f1bde8106a6271270158927aba409cd2d021a34b6f5a5fa50a302
|
4
|
+
data.tar.gz: 72f59c880571a2c959fd924d0600ac013b3e63a9cbd6581df689e489a515dfb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbd3f847c1cbc6f3cad4ac3dd20be9db54a6b446cc1f3dbef5c0b086e43544ca0554bed0861c08793119def4d51595286be89012b8393d09c6b180436da118af
|
7
|
+
data.tar.gz: a38c21395c31224de18f8225d15bb508b4387245563718b83ab824b6a8d34fbc625bed00f2f12a3636f8b4b10d80e162febc0791721cd9f06266284267df2de7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -48,7 +48,8 @@ ActionReporter.enabled_reporters = [
|
|
48
48
|
Then you can use it in your code:
|
49
49
|
|
50
50
|
```ruby
|
51
|
-
ActionReporter.
|
51
|
+
ActionReporter.audited_user = current_user
|
52
|
+
ActionReporter.context(entry_id: entry.id)
|
52
53
|
ActionReporter.notify('Something went wrong', context: { record: record })
|
53
54
|
```
|
54
55
|
|
data/action_reporter.gemspec
CHANGED
data/lib/action_reporter/base.rb
CHANGED
@@ -1,11 +1,22 @@
|
|
1
|
+
require_relative 'error'
|
2
|
+
|
1
3
|
module ActionReporter
|
2
4
|
class Base
|
3
|
-
def self.class_accessor(class_name)
|
5
|
+
def self.class_accessor(class_name, gem_spec: nil)
|
4
6
|
method_name = class_name.gsub("::", "_").downcase + "_class"
|
5
7
|
define_method(method_name) do
|
6
|
-
raise Error.new("#{class_name} is not defined") unless Object.const_defined?(class_name)
|
8
|
+
raise ActionReporter::Error.new("#{class_name} is not defined") unless Object.const_defined?(class_name)
|
7
9
|
|
8
|
-
|
10
|
+
@@class_cache ||= {}
|
11
|
+
@@class_cache[class_name] ||= begin
|
12
|
+
if gem_spec
|
13
|
+
gem_name, version = gem_spec.scan(/([^(\s]+)\s*(?:\(([^)]+)\))?/).first
|
14
|
+
latest_spec = Gem.loaded_specs[gem_name]
|
15
|
+
version_satisfied = latest_spec && Gem::Requirement.new(version).satisfied_by?(latest_spec.version)
|
16
|
+
raise ActionReporter::Error.new("#{gem_spec} is not loaded") if !version_satisfied
|
17
|
+
end
|
18
|
+
Object.const_get(class_name)
|
19
|
+
end
|
9
20
|
end
|
10
21
|
end
|
11
22
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActionReporter
|
2
2
|
class ScoutApmReporter < Base
|
3
|
-
class_accessor "ScoutApm::Error"
|
4
|
-
class_accessor "ScoutApm::Context"
|
3
|
+
class_accessor "ScoutApm::Error", gem_spec: "scout_apm (~> 5)"
|
4
|
+
class_accessor "ScoutApm::Context", gem_spec: "scout_apm (~> 5)"
|
5
5
|
|
6
6
|
def notify(error, context: {})
|
7
7
|
self.context(context)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Makarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby wrapper for multiple reporting services
|
14
14
|
email:
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
|
-
rubygems_version: 3.
|
58
|
+
rubygems_version: 3.4.10
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: See description
|