informant-rails 0.4.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d4785624c920d4ca6824b6befb87cc543d21fdf
4
- data.tar.gz: 6837efd1c829ef10bb6e063b01f308273d2d430a
3
+ metadata.gz: 8a65828c53957be32307a98b3b0d54e8faaa0c23
4
+ data.tar.gz: 014728da192e78d784c737dcd9b17bf067eecab0
5
5
  SHA512:
6
- metadata.gz: 04335311d02cae372009a805ebfcc5068e43e70ad937b7e7f08ac20df99252a4a8167615fd305d50496c21f8ad4cc12b3ec38df41cfa6e3ec066d634b2f43295
7
- data.tar.gz: 4b071c277ec10063659068adae0abd6cd59c235e72e50be604c42e01cf374888d79a560af98eddfbdfd6ef83e92261636901b506e0094df49ff2f3f1952b2747
6
+ metadata.gz: 4df17ef313a87bc1a7f66bf25c2d5486fc94e4980eee851a2171ea3087c30731b4dac1b7b69a53a7c13c51b6c22b3a2363ccb8459d3a58e4150beb7d0d27d180
7
+ data.tar.gz: 70366afc5e6eb6c236afb3576f1f826dba2e5445727119bf40cd3b443b530b1d7f33220c6b0b3ab45a8ef6048dce8c68c76e6410e45fef43a209247fb3cca374
@@ -22,7 +22,7 @@ module InformantRails
22
22
  end
23
23
 
24
24
  def self.process
25
- if Config.api_token.present? && request && request.models.any?
25
+ if request && request.models.any?
26
26
  Typhoeus::Request.new(
27
27
  api_url,
28
28
  method: :post,
@@ -1,26 +1,32 @@
1
1
  module InformantRails
2
2
  class Railtie < ::Rails::Railtie
3
3
  initializer 'informant middleware' do |config|
4
- config.middleware.use 'InformantRails::Middleware'
4
+ if InformantRails::Config.api_token
5
+ config.middleware.use 'InformantRails::Middleware'
6
+ end
5
7
  end
6
8
 
7
9
  initializer 'informant ActionController binding' do
8
- class ::ActionController::Base
9
- before_filter do
10
- InformantRails::Client.record_action(
11
- controller_name, action_name
12
- )
10
+ if InformantRails::Config.api_token
11
+ ActiveSupport.on_load :action_controller do
12
+ include InformantRails::RequestTracking
13
13
  end
14
- end
15
14
 
16
- InformantRails::Config.filter_parameters = Rails.configuration.filter_parameters
15
+ InformantRails::Config.filter_parameters = Rails.configuration.filter_parameters
16
+ end
17
17
  end
18
18
 
19
19
  initializer 'informant ActiveRecord binding' do
20
- class ::ActiveRecord::Base
21
- set_callback(:validate, :after) do
22
- InformantRails::Client.record_validated_model(self)
20
+ if InformantRails::Config.api_token
21
+
22
+ ActiveSupport.on_load(:active_record) do
23
+ include InformantRails::ValidationTracking
23
24
  end
25
+
26
+ ActiveSupport.on_load(:mongoid) do
27
+ include InformantRails::ValidationTracking
28
+ end
29
+
24
30
  end
25
31
  end
26
32
  end
@@ -0,0 +1,11 @@
1
+ module InformantRails
2
+ module RequestTracking
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_filter do
7
+ InformantRails::Client.record_action(controller_name, action_name)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module InformantRails
2
+ module ValidationTracking
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ set_callback(:validate, :after) do
7
+ InformantRails::Client.record_validated_model(self)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module InformantRails
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -1,18 +1,20 @@
1
- require 'informant-rails/railtie'
2
-
3
1
  if defined?(Rake)
4
2
  require 'rake'
5
3
  Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
6
4
  end
7
5
 
8
6
  module InformantRails
9
- autoload :Config, 'informant-rails/config'
10
- autoload :ConnectionTester, 'informant-rails/connection_tester'
11
- autoload :Client, 'informant-rails/client'
12
- autoload :FieldError, 'informant-rails/field_error'
13
- autoload :Middleware, 'informant-rails/middleware'
14
- autoload :Model, 'informant-rails/model'
15
- autoload :Request, 'informant-rails/request'
16
- autoload :ParameterFilter, 'informant-rails/parameter_filter'
17
- autoload :VERSION, 'informant-rails/version'
7
+ autoload :Config, 'informant-rails/config'
8
+ autoload :ConnectionTester, 'informant-rails/connection_tester'
9
+ autoload :Client, 'informant-rails/client'
10
+ autoload :FieldError, 'informant-rails/field_error'
11
+ autoload :Middleware, 'informant-rails/middleware'
12
+ autoload :Model, 'informant-rails/model'
13
+ autoload :Request, 'informant-rails/request'
14
+ autoload :ParameterFilter, 'informant-rails/parameter_filter'
15
+ autoload :RequestTracking, 'informant-rails/request_tracking'
16
+ autoload :ValidationTracking, 'informant-rails/validation_tracking'
17
+ autoload :VERSION, 'informant-rails/version'
18
18
  end
19
+
20
+ require 'informant-rails/railtie'
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.1
4
+ version: 0.5.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-07-29 00:00:00.000000000 Z
12
+ date: 2014-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -59,6 +59,8 @@ files:
59
59
  - lib/informant-rails/parameter_filter.rb
60
60
  - lib/informant-rails/railtie.rb
61
61
  - lib/informant-rails/request.rb
62
+ - lib/informant-rails/request_tracking.rb
63
+ - lib/informant-rails/validation_tracking.rb
62
64
  - lib/informant-rails/version.rb
63
65
  - lib/tasks/test_connection.rake
64
66
  homepage: https://www.informantapp.com