informant-rails 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +9 -0
- data/lib/informant-rails/client.rb +12 -13
- data/lib/informant-rails/config.rb +2 -1
- data/lib/informant-rails/parameter_filter.rb +2 -2
- data/lib/informant-rails/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39c718af73a6aa28bd7f35c841b27c3e89e657fa
|
4
|
+
data.tar.gz: 20dbdde4eb1abd386d4e9fa55a5f236d8e507b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf8bbaf441747889dffad1e6388e8ef5804d33c817d3705a616ebea5508f81ea9901d475dea268259c910595461ad4472f30706e8d105f202b6983f8d4ad9c80
|
7
|
+
data.tar.gz: e8bca12a4fd0a5be1896a6985f48d71ebec26bc0a6ea32e21cf4dc0a338f557d95c168ea8e97cdc1bd13c02dcd238ba4e895e7185dc099307ea9dd9de94ad925
|
data/README.markdown
CHANGED
@@ -50,6 +50,7 @@ InformantRails::Config.configure do |config|
|
|
50
50
|
config.api_token = ENV['INFORMANT_API_KEY']
|
51
51
|
config.exclude_models = %w(UntrackedModel)
|
52
52
|
config.filter_parameters.push *%w(password password_confirmation)
|
53
|
+
config.value_tracking = true
|
53
54
|
end
|
54
55
|
```
|
55
56
|
|
@@ -76,3 +77,11 @@ Default Value: `Rails.configuration.filter_parameters`
|
|
76
77
|
Example Value: `['password', 'password_confirmation']`
|
77
78
|
|
78
79
|
Any field names specified here will not be included in value tracking. Any sensitive information that you wouldn't want to include in your server log should be listed here as well.
|
80
|
+
|
81
|
+
### filter_parameters
|
82
|
+
|
83
|
+
Default Value: `true`
|
84
|
+
|
85
|
+
Example Value: `false`
|
86
|
+
|
87
|
+
This will enable and disable tracking of values globally. If you turn this off, no field value information will be sent at all. This is useful if you have compliance or security concerns about the nature of your data.
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'typhoeus'
|
2
|
-
|
3
1
|
module InformantRails
|
4
2
|
class Client
|
5
3
|
|
@@ -38,19 +36,20 @@ module InformantRails
|
|
38
36
|
end
|
39
37
|
|
40
38
|
def self.transmit(completed_request)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
body: { payload: completed_request }.to_json,
|
45
|
-
headers: {
|
46
|
-
"Authorization" => ActionController::HttpAuthentication::Token.encode_credentials(Config.api_token),
|
47
|
-
"Content-Type" => "application/json"
|
48
|
-
}
|
49
|
-
).run
|
39
|
+
Net::HTTP.start(api_endpoint.host, api_endpoint.port, use_ssl: api_endpoint.scheme == 'https') do |http|
|
40
|
+
http.request(net_http_post_request(completed_request))
|
41
|
+
end
|
50
42
|
end
|
51
43
|
|
52
44
|
private
|
53
45
|
|
46
|
+
def self.net_http_post_request(completed_request)
|
47
|
+
Net::HTTP::Post.new(api_endpoint, {
|
48
|
+
"Authorization" => ActionController::HttpAuthentication::Token.encode_credentials(Config.api_token),
|
49
|
+
"Content-Type" => "application/json"
|
50
|
+
}).tap { |r| r.body = { payload: completed_request }.to_json }
|
51
|
+
end
|
52
|
+
|
54
53
|
def self.include_model?(model)
|
55
54
|
!Config.exclude_models.include?(model.class.to_s)
|
56
55
|
end
|
@@ -59,8 +58,8 @@ module InformantRails
|
|
59
58
|
Thread.current[:informant_request] = Request.new
|
60
59
|
end
|
61
60
|
|
62
|
-
def self.
|
63
|
-
@
|
61
|
+
def self.api_endpoint
|
62
|
+
@api_endpoint ||= URI('https://api.informantapp.com/api/v1/form_submissions')
|
64
63
|
end
|
65
64
|
|
66
65
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module InformantRails::Config
|
2
2
|
extend self
|
3
3
|
|
4
|
-
attr_accessor :api_token, :exclude_models, :filter_parameters
|
4
|
+
attr_accessor :api_token, :exclude_models, :filter_parameters, :value_tracking
|
5
5
|
|
6
6
|
self.api_token = ENV['INFORMANT_API_KEY']
|
7
7
|
self.exclude_models = []
|
8
8
|
self.filter_parameters = []
|
9
|
+
self.value_tracking = true
|
9
10
|
|
10
11
|
def configure; yield self end
|
11
12
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module InformantRails
|
2
2
|
class ParameterFilter
|
3
3
|
def self.filter(name, value)
|
4
|
-
|
4
|
+
Config.value_tracking && !matcher.match(name) ? value : '[FILTERED]'
|
5
5
|
end
|
6
6
|
|
7
7
|
protected
|
8
8
|
|
9
9
|
def self.matcher
|
10
|
-
@matcher ||= Regexp.new(/#{
|
10
|
+
@matcher ||= Regexp.new(/#{Config.filter_parameters.join('|').presence || '$^'}/)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: informant-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Elliott
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 3.0.0
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: typhoeus
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
28
|
description: The Informant tells you what's irritating your users.
|
43
29
|
email:
|
44
30
|
- paul@codingfrontier.com
|