informant-rails 2.1.0 → 2.2.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.
- checksums.yaml +4 -4
- data/README.markdown +7 -4
- data/Rakefile +5 -5
- data/lib/informant-rails.rb +2 -10
- data/lib/informant-rails/config.rb +11 -22
- data/lib/informant-rails/diagnostic.rb +25 -21
- data/lib/informant-rails/middleware.rb +8 -4
- data/lib/informant-rails/railtie.rb +8 -5
- data/lib/informant-rails/request_tracking.rb +2 -2
- data/lib/informant-rails/validation_tracking.rb +1 -3
- data/lib/informant-rails/version.rb +1 -1
- data/lib/tasks/diagnostic.rake +2 -4
- metadata +33 -13
- data/lib/informant-rails/client.rb +0 -70
- data/lib/informant-rails/event/base.rb +0 -25
- data/lib/informant-rails/event/client_info.rb +0 -16
- data/lib/informant-rails/event/form_submission.rb +0 -36
- data/lib/informant-rails/field_error.rb +0 -19
- data/lib/informant-rails/model.rb +0 -17
- data/lib/informant-rails/parameter_filter.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69200fabf6b1767d2cb6a26d3a9c46e7c3c8fdb1d3d08a3ad9b63a919a0bc8c8
|
4
|
+
data.tar.gz: dbd81e0ed5e7c86ea0afa48a7bd0587d55b2f647ec896a09534e6571a25eee70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9220c0cfc3ddb9d4a5845851b31b50d2d6d6b53963ae9cb2b657c15fd179cb67a506c0e9a4b8ac77fb209e5c7945ecac06e930df40af7aeb714a0a018226bf9
|
7
|
+
data.tar.gz: 2746d2d97cae5c6fc47b67fe223e9bf097d08f72de1c1ac06cfa3bd14bcb0773be649b3d63b2eb061619d8a19ade22c1348c32be7c3f0626cbebb0320eab75b9
|
data/README.markdown
CHANGED
@@ -8,12 +8,11 @@ The informant-rails gem provides Rails and ActiveRecord hooks for The Informant.
|
|
8
8
|
|
9
9
|
## Compatibility
|
10
10
|
|
11
|
-
The informant-rails gem officially supports Ruby 2.
|
11
|
+
The informant-rails gem officially supports Ruby 2.5+.
|
12
12
|
|
13
|
-
It will work automatically with Rails
|
13
|
+
It will work automatically with Rails 5.2+ as well as Mongoid 6.2 and up.
|
14
14
|
|
15
|
-
[](https://codeclimate.com/github/informantapp/informant-rails)
|
15
|
+
[](https://gitlab.com/informantapp/informant-rails/-/commits/master)
|
17
16
|
|
18
17
|
## Installation
|
19
18
|
|
@@ -28,6 +27,10 @@ It will work automatically with Rails 3 and up as well as Mongoid 3 and up.
|
|
28
27
|
4. Deploy with the gem installed
|
29
28
|
5. Submit a form and you'll see it appear in our web interface
|
30
29
|
|
30
|
+
We've set up
|
31
|
+
[informant-rails-example](https://gitlab.com/informantapp/informant-rails-example)
|
32
|
+
as a demonstrate of installation and operation.
|
33
|
+
|
31
34
|
## Usage
|
32
35
|
|
33
36
|
By default, any request that causes an ActiveRecord or Mongoid model to be validated will be tracked by the Informant once the gem is added to your project.
|
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'bundler/gem_tasks'
|
3
3
|
|
4
|
-
if !ENV[
|
5
|
-
require
|
4
|
+
if !ENV['APPRAISAL_INITIALIZED']
|
5
|
+
require 'appraisal/task'
|
6
6
|
Appraisal::Task.new
|
7
7
|
task default: :appraisal
|
8
8
|
else
|
9
|
-
require
|
9
|
+
require 'rspec/core/rake_task'
|
10
10
|
RSpec::Core::RakeTask.new
|
11
11
|
task default: :spec
|
12
12
|
end
|
data/lib/informant-rails.rb
CHANGED
@@ -3,23 +3,15 @@ if defined?(Rake)
|
|
3
3
|
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
|
4
4
|
end
|
5
5
|
|
6
|
+
require 'informant-common'
|
7
|
+
|
6
8
|
module InformantRails
|
7
9
|
autoload :Config, 'informant-rails/config'
|
8
10
|
autoload :Diagnostic, 'informant-rails/diagnostic'
|
9
|
-
autoload :Client, 'informant-rails/client'
|
10
|
-
autoload :FieldError, 'informant-rails/field_error'
|
11
11
|
autoload :Middleware, 'informant-rails/middleware'
|
12
|
-
autoload :Model, 'informant-rails/model'
|
13
|
-
autoload :ParameterFilter, 'informant-rails/parameter_filter'
|
14
12
|
autoload :RequestTracking, 'informant-rails/request_tracking'
|
15
13
|
autoload :ValidationTracking, 'informant-rails/validation_tracking'
|
16
14
|
autoload :VERSION, 'informant-rails/version'
|
17
|
-
|
18
|
-
module Event
|
19
|
-
autoload :Base, 'informant-rails/event/base'
|
20
|
-
autoload :ClientInfo, 'informant-rails/event/client_info'
|
21
|
-
autoload :FormSubmission, 'informant-rails/event/form_submission'
|
22
|
-
end
|
23
15
|
end
|
24
16
|
|
25
17
|
require 'informant-rails/railtie'
|
@@ -1,24 +1,13 @@
|
|
1
|
-
module InformantRails
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def self.client_identifier
|
14
|
-
@client_identifier ||= "informant-rails-#{InformantRails::VERSION}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.enabled?
|
18
|
-
api_token.present?
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.collector_host
|
22
|
-
@collector_host ||= ENV['INFORMANT_COLLECTOR_HOST'] || 'https://collector-api.informantapp.com'
|
1
|
+
module InformantRails
|
2
|
+
module Config
|
3
|
+
extend self
|
4
|
+
|
5
|
+
delegate :api_token, :api_token=,
|
6
|
+
:collector_host,
|
7
|
+
:enabled?,
|
8
|
+
:exclude_models, :exclude_models=,
|
9
|
+
:filter_parameters, :filter_parameters=,
|
10
|
+
:value_tracking?, :value_tracking=,
|
11
|
+
to: InformantCommon::Config
|
23
12
|
end
|
24
13
|
end
|
@@ -1,34 +1,23 @@
|
|
1
1
|
class TestClass
|
2
|
-
|
3
|
-
{
|
4
|
-
field_name: 'must be unique'
|
5
|
-
}
|
6
|
-
end
|
2
|
+
include ActiveModel::Model
|
7
3
|
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
attr_accessor :field_name
|
5
|
+
|
6
|
+
validates_presence_of :field_name
|
11
7
|
end
|
12
8
|
|
13
9
|
module InformantRails
|
14
10
|
class Diagnostic
|
15
|
-
def self.run
|
11
|
+
def self.run
|
12
|
+
new.run
|
13
|
+
end
|
16
14
|
|
17
15
|
def run
|
18
16
|
if Config.api_token.blank?
|
19
17
|
Rails.logger.info missing_api_token_message
|
20
18
|
else
|
21
|
-
|
22
|
-
|
23
|
-
form_submission.action = 'test'
|
24
|
-
form_submission.process_model(TestClass.new)
|
25
|
-
response = Client.transmit(form_submission).join.value
|
26
|
-
|
27
|
-
if response.code == '204'
|
28
|
-
Rails.logger.info success_message
|
29
|
-
else
|
30
|
-
Rails.logger.info bad_response_message(response.body)
|
31
|
-
end
|
19
|
+
response = InformantCommon::Client.transmit(test_form_submission).join.value
|
20
|
+
display_response_message(response)
|
32
21
|
end
|
33
22
|
|
34
23
|
Rails.logger.info assistance_message
|
@@ -54,11 +43,26 @@ module InformantRails
|
|
54
43
|
end
|
55
44
|
|
56
45
|
def success_message
|
57
|
-
|
46
|
+
'Everything looks good. You should see a test request on your dashboard.'
|
58
47
|
end
|
59
48
|
|
60
49
|
def assistance_message
|
61
50
|
"If you need assistance or have any questions, send an email to support@informantapp.com or tweet @informantapp and we'll help you out!"
|
62
51
|
end
|
52
|
+
|
53
|
+
def test_form_submission
|
54
|
+
InformantCommon::Event::FormSubmission.new.tap do |form_submission|
|
55
|
+
form_submission.handler = 'Connectivity#test'
|
56
|
+
form_submission.process_model(InformantCommon::Model::ActiveModel.new(TestClass.new.tap(&:valid?)))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def display_response_message(response)
|
61
|
+
if response.code == '204'
|
62
|
+
Rails.logger.info success_message
|
63
|
+
else
|
64
|
+
Rails.logger.info bad_response_message(response.body)
|
65
|
+
end
|
66
|
+
end
|
63
67
|
end
|
64
68
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module InformantRails
|
2
|
-
class Middleware
|
2
|
+
class Middleware
|
3
|
+
def initialize(app)
|
4
|
+
@app = app
|
5
|
+
end
|
6
|
+
|
3
7
|
def call(env)
|
4
|
-
Client.
|
5
|
-
response = app.call(env)
|
6
|
-
Client.process
|
8
|
+
InformantCommon::Client.start_transaction!(env['REQUEST_METHOD'])
|
9
|
+
response = @app.call(env)
|
10
|
+
InformantCommon::Client.process
|
7
11
|
response
|
8
12
|
end
|
9
13
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
module InformantRails
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
initializer 'informant' do |config|
|
4
|
-
Config.api_token ||= ENV['INFORMANT_API_KEY']
|
5
|
-
|
6
4
|
begin
|
7
5
|
if Config.enabled?
|
8
|
-
|
6
|
+
InformantCommon::Client.transmit(
|
7
|
+
InformantCommon::Event::AgentInfo.new(
|
8
|
+
agent_identifier: "informant-rails-#{InformantRails::VERSION}",
|
9
|
+
framework_version: "rails-#{Rails.version}"
|
10
|
+
)
|
11
|
+
)
|
9
12
|
InformantRails::Config.filter_parameters = Rails.configuration.filter_parameters
|
10
13
|
|
11
14
|
config.middleware.use InformantRails::Middleware
|
@@ -22,8 +25,8 @@ module InformantRails
|
|
22
25
|
include InformantRails::ValidationTracking
|
23
26
|
end
|
24
27
|
end
|
25
|
-
rescue
|
26
|
-
puts "Unable to bootstrap informant."
|
28
|
+
rescue StandardError => e
|
29
|
+
puts "Unable to bootstrap informant: #{e.message}"
|
27
30
|
end
|
28
31
|
end
|
29
32
|
end
|
@@ -5,11 +5,11 @@ module InformantRails
|
|
5
5
|
included do
|
6
6
|
if defined? before_action
|
7
7
|
before_action do
|
8
|
-
|
8
|
+
InformantCommon::Client.current_transaction&.handler = [controller_name, action_name].join('#')
|
9
9
|
end
|
10
10
|
else
|
11
11
|
before_filter do
|
12
|
-
|
12
|
+
InformantCommon::Client.current_transaction&.handler = [controller_name, action_name].join('#')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/tasks/diagnostic.rake
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
namespace :informant do
|
2
|
-
|
3
|
-
|
4
|
-
task :diagnostic => :environment do
|
2
|
+
desc 'Verify connectivity from your app to Informant'
|
3
|
+
task diagnostic: :environment do
|
5
4
|
Rails.logger = Logger.new(STDOUT)
|
6
5
|
InformantRails::Diagnostic.run
|
7
6
|
end
|
8
|
-
|
9
7
|
end
|
metadata
CHANGED
@@ -1,22 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: informant-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Informant, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: informant-common
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rails
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
33
|
+
version: 5.2.0
|
20
34
|
- - "<"
|
21
35
|
- !ruby/object:Gem::Version
|
22
36
|
version: 7.0.0
|
@@ -26,10 +40,24 @@ dependencies:
|
|
26
40
|
requirements:
|
27
41
|
- - ">="
|
28
42
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
43
|
+
version: 5.2.0
|
30
44
|
- - "<"
|
31
45
|
- !ruby/object:Gem::Version
|
32
46
|
version: 7.0.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: appraisal
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
33
61
|
description: The Informant tracks what users do wrong in your forms so you can make
|
34
62
|
them better.
|
35
63
|
email:
|
@@ -42,16 +70,9 @@ files:
|
|
42
70
|
- README.markdown
|
43
71
|
- Rakefile
|
44
72
|
- lib/informant-rails.rb
|
45
|
-
- lib/informant-rails/client.rb
|
46
73
|
- lib/informant-rails/config.rb
|
47
74
|
- lib/informant-rails/diagnostic.rb
|
48
|
-
- lib/informant-rails/event/base.rb
|
49
|
-
- lib/informant-rails/event/client_info.rb
|
50
|
-
- lib/informant-rails/event/form_submission.rb
|
51
|
-
- lib/informant-rails/field_error.rb
|
52
75
|
- lib/informant-rails/middleware.rb
|
53
|
-
- lib/informant-rails/model.rb
|
54
|
-
- lib/informant-rails/parameter_filter.rb
|
55
76
|
- lib/informant-rails/railtie.rb
|
56
77
|
- lib/informant-rails/request_tracking.rb
|
57
78
|
- lib/informant-rails/validation_tracking.rb
|
@@ -76,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
97
|
- !ruby/object:Gem::Version
|
77
98
|
version: '0'
|
78
99
|
requirements: []
|
79
|
-
|
80
|
-
rubygems_version: 2.7.8
|
100
|
+
rubygems_version: 3.0.3
|
81
101
|
signing_key:
|
82
102
|
specification_version: 4
|
83
103
|
summary: The Informant tracks server-side validation errors and gives you metrics
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
|
3
|
-
module InformantRails
|
4
|
-
class Client
|
5
|
-
def self.enabled?; @enabled end
|
6
|
-
def self.disable!; @enabled = false end
|
7
|
-
def self.enable!; @enabled = true end
|
8
|
-
enable!
|
9
|
-
|
10
|
-
def self.supported_request_methods
|
11
|
-
@supported_request_methods ||= %w(POST PATCH PUT DELETE)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.record(env)
|
15
|
-
new_request if enabled? && supported_request_methods.include?(env['REQUEST_METHOD'])
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.record_action(controller_name, action)
|
19
|
-
if request
|
20
|
-
request.filename = controller_name
|
21
|
-
request.action = action
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.record_validated_model(model)
|
26
|
-
request.process_model(model) if request && include_model?(model)
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.process
|
30
|
-
if request && request.models.any?
|
31
|
-
this_request = request
|
32
|
-
transmit(this_request)
|
33
|
-
end
|
34
|
-
ensure
|
35
|
-
cleanup
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.request
|
39
|
-
Thread.current[:informant_request]
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.cleanup
|
43
|
-
Thread.current[:informant_request] = nil
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.transmit(event)
|
47
|
-
Thread.new(Client) do |client_class|
|
48
|
-
Net::HTTP.start(*event.net_http_start_arguments) do |http|
|
49
|
-
response = http.request(event.post_request)
|
50
|
-
client_class.disable! if response.code == '401'
|
51
|
-
response
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.log_client_info
|
57
|
-
transmit(InformantRails::Event::ClientInfo.new)
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def self.include_model?(model)
|
63
|
-
!Config.exclude_models.include?(model.class.to_s)
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.new_request
|
67
|
-
Thread.current[:informant_request] = Event::FormSubmission.new
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module InformantRails::Event
|
2
|
-
class Base
|
3
|
-
def self.endpoint
|
4
|
-
raise 'Must implement'
|
5
|
-
end
|
6
|
-
def endpoint; self.class.endpoint end
|
7
|
-
|
8
|
-
def self.authorization_header_value
|
9
|
-
@authorization_header_value ||= ActionController::HttpAuthentication::Token.encode_credentials(InformantRails::Config.api_token)
|
10
|
-
end
|
11
|
-
def authorization_header_value; self.class.authorization_header_value end
|
12
|
-
|
13
|
-
def post_request
|
14
|
-
Net::HTTP::Post.new(endpoint, {
|
15
|
-
"Authorization" => authorization_header_value,
|
16
|
-
"Content-Type" => "application/json"
|
17
|
-
}).tap { |r| r.body = to_json }
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.net_http_start_arguments
|
21
|
-
@net_http_start_arguments ||= [endpoint.host, endpoint.port, use_ssl: endpoint.scheme == 'https']
|
22
|
-
end
|
23
|
-
def net_http_start_arguments; self.class.net_http_start_arguments end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module InformantRails::Event
|
2
|
-
class ClientInfo < Base
|
3
|
-
def as_json(*args)
|
4
|
-
{
|
5
|
-
agent_identifier: InformantRails::Config.client_identifier,
|
6
|
-
framework_version: "rails-#{Rails.version}",
|
7
|
-
runtime_version: "ruby-#{RUBY_VERSION}",
|
8
|
-
mongoid_version: defined?(Mongoid) ? Mongoid::VERSION : nil
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.endpoint
|
13
|
-
@endpoint ||= URI("#{InformantRails::Config.collector_host}/v2/client-info")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module InformantRails::Event
|
2
|
-
class FormSubmission < Base
|
3
|
-
attr_accessor :filename, :action
|
4
|
-
|
5
|
-
def process_model(model)
|
6
|
-
if model && untracked?(model)
|
7
|
-
models << InformantRails::Model.new(model)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def models
|
12
|
-
@models ||= []
|
13
|
-
end
|
14
|
-
|
15
|
-
def as_json(*args)
|
16
|
-
{
|
17
|
-
name: [filename, action].compact.join('#'),
|
18
|
-
models: models.map(&:as_json)
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.endpoint
|
23
|
-
@endpoint ||= URI("#{InformantRails::Config.collector_host}/v2/form-submissions")
|
24
|
-
end
|
25
|
-
|
26
|
-
protected
|
27
|
-
|
28
|
-
def rails_version
|
29
|
-
@rails_version ||= Rails.version
|
30
|
-
end
|
31
|
-
|
32
|
-
def untracked?(model)
|
33
|
-
!models.detect { |container| container.model == model }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module InformantRails
|
2
|
-
class FieldError
|
3
|
-
attr_accessor :name, :value, :message
|
4
|
-
|
5
|
-
def initialize(name, value, message=nil)
|
6
|
-
self.name = name
|
7
|
-
self.value = value
|
8
|
-
self.message = message
|
9
|
-
end
|
10
|
-
|
11
|
-
def value=(value)
|
12
|
-
@value = InformantRails::ParameterFilter.filter(name, value)
|
13
|
-
end
|
14
|
-
|
15
|
-
def as_json(*args)
|
16
|
-
{ name: name, value: value, message: message }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module InformantRails
|
2
|
-
class Model < Struct.new(:model)
|
3
|
-
def name
|
4
|
-
model.class.name
|
5
|
-
end
|
6
|
-
|
7
|
-
def errors
|
8
|
-
model.errors.map do |field, error|
|
9
|
-
InformantRails::FieldError.new(field.to_s, model[field], error)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def as_json(*args)
|
14
|
-
{ name: name, errors: errors.map(&:as_json) }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module InformantRails
|
2
|
-
class ParameterFilter
|
3
|
-
def self.filter(name, value)
|
4
|
-
Config.value_tracking && !matcher.match(name) ? value : '[FILTERED]'
|
5
|
-
end
|
6
|
-
|
7
|
-
protected
|
8
|
-
|
9
|
-
def self.matcher
|
10
|
-
@matcher ||= Regexp.new(/#{Config.filter_parameters.join('|').presence || '$^'}/)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|