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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5995154e25aa6d876e155c33a55da4604f2f7757
4
- data.tar.gz: fc7097388c33fd8a607e2deca10ffe7d769fe9c5
3
+ metadata.gz: 39c718af73a6aa28bd7f35c841b27c3e89e657fa
4
+ data.tar.gz: 20dbdde4eb1abd386d4e9fa55a5f236d8e507b01
5
5
  SHA512:
6
- metadata.gz: 4a01db40601239898b1b9999f73ec0ee16fa1d1833b64ffded4d6bd4a4bd1666e843ef4424c951b6494936320e6603e96090f52fb80c33b3d50f5b91b76b06e2
7
- data.tar.gz: fc63088ae0632869acfd095ff2654d215fca6c2eda610468314937b53c0341c2ae0e97f40b941e9df4e061c0f17ee27ff248e9c4c5c7615b3ec6dd49bb86a99c
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
- Typhoeus::Request.new(
42
- api_url,
43
- method: :post,
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.api_url
63
- @api_url ||= 'https://api.informantapp.com/api/v1/form_submissions'
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
- value && matcher.match(name) ? '[FILTERED]' : value
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(/#{InformantRails::Config.filter_parameters.join('|').presence || '$^'}/)
10
+ @matcher ||= Regexp.new(/#{Config.filter_parameters.join('|').presence || '$^'}/)
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module InformantRails
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  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.6.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-11 00:00:00.000000000 Z
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