informant-rails 0.3.0 → 0.4.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 +3 -3
- data/lib/informant-rails.rb +11 -7
- data/lib/informant-rails/client.rb +1 -1
- data/lib/informant-rails/config.rb +1 -2
- data/lib/informant-rails/connection_tester.rb +54 -0
- data/lib/informant-rails/request.rb +2 -1
- data/lib/informant-rails/version.rb +1 -1
- data/lib/tasks/test_connection.rake +8 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b475336e08262fb18d9144935a74c840e66eb077
|
4
|
+
data.tar.gz: 97825732d9a6b6eec24086e3204512ad9a0ceab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d4de5d1a83e3cbae1501a77cd610a027d237a4ea6c0c035f2b12284a4b483124c58015739bb00b0fc251ab109732ff7480a9f2fd86b55e37fe3390dc64346c4
|
7
|
+
data.tar.gz: 9b55616f2b53852b21343a429374e6125c62a3f2fc240c5b470f911006d28207dc07c24f917d5703674522fca6ac3017c78f4693755f53c7e09169b520b4f6a7
|
data/README.markdown
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
|
5
5
|
The informant-rails gem provides Rails and ActiveRecord hooks for The Informant.
|
6
6
|
|
7
|
-
[![Homepage](https://addons.heroku.com/
|
7
|
+
[![Homepage](https://s3.amazonaws.com/assets.heroku.com/addons.heroku.com/icons/1347/original.png)](https://addons.heroku.com/informant)
|
8
8
|
|
9
9
|
## Compatibility
|
10
10
|
|
11
11
|
The informant-rails gem is tested against Ruby 1.9.3, 2.0.0, and Rubinius.
|
12
12
|
|
13
|
-
[![Build Status](https://
|
14
|
-
[![Code Climate](https://codeclimate.com/github/
|
13
|
+
[![Build Status](https://travis-ci.org/informantapp/informant-rails.svg?branch=master)](https://travis-ci.org/informantapp/informant-rails)
|
14
|
+
[![Code Climate](https://codeclimate.com/github/informantapp/informant-rails.png)](https://codeclimate.com/github/informantapp/informant-rails)
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
data/lib/informant-rails.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
require 'informant-rails/railtie'
|
2
2
|
|
3
|
+
load File.join(File.dirname(__FILE__), 'tasks', 'test_connection.rake')
|
4
|
+
|
3
5
|
module InformantRails
|
4
|
-
autoload :Config,
|
5
|
-
autoload :
|
6
|
-
autoload :
|
7
|
-
autoload :
|
8
|
-
autoload :
|
9
|
-
autoload :
|
10
|
-
autoload :
|
6
|
+
autoload :Config, 'informant-rails/config'
|
7
|
+
autoload :ConnectionTester, 'informant-rails/connection_tester'
|
8
|
+
autoload :Client, 'informant-rails/client'
|
9
|
+
autoload :FieldError, 'informant-rails/field_error'
|
10
|
+
autoload :Middleware, 'informant-rails/middleware'
|
11
|
+
autoload :Model, 'informant-rails/model'
|
12
|
+
autoload :Request, 'informant-rails/request'
|
13
|
+
autoload :ParameterFilter, 'informant-rails/parameter_filter'
|
14
|
+
autoload :VERSION, 'informant-rails/version'
|
11
15
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module InformantRails::Config
|
2
2
|
extend self
|
3
3
|
|
4
|
-
attr_accessor :api_token, :
|
4
|
+
attr_accessor :api_token, :exclude_models, :filter_parameters
|
5
5
|
|
6
6
|
self.api_token = ENV['INFORMANT_API_KEY']
|
7
|
-
self.server_environment = Rails.env
|
8
7
|
self.exclude_models = []
|
9
8
|
self.filter_parameters = []
|
10
9
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module InformantRails
|
2
|
+
class ConnectionTester
|
3
|
+
def self.run; new.run end
|
4
|
+
|
5
|
+
def run
|
6
|
+
if InformantRails::Config.api_token.blank?
|
7
|
+
Rails.logger.info missing_api_token_message
|
8
|
+
else
|
9
|
+
InformantRails::Client.record('HTTP_REFERER' => '/connectivity/test')
|
10
|
+
InformantRails::Client.record_action('Connectivity', 'test')
|
11
|
+
InformantRails::Client.request.instance_variable_set('@models', [{
|
12
|
+
name: 'TestClass',
|
13
|
+
errors: [name: 'field_name', value: 'field_value', message: 'must be unique']
|
14
|
+
}])
|
15
|
+
response = InformantRails::Client.process
|
16
|
+
|
17
|
+
if response.success?
|
18
|
+
Rails.logger.info success_message
|
19
|
+
else
|
20
|
+
Rails.logger.info bad_response_message(response.body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Rails.logger.info assistance_message
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def missing_api_token_message
|
30
|
+
%<
|
31
|
+
Your API token could not be found in the configuration. You can retrieve it from your Informantapp.com dashboard.
|
32
|
+
|
33
|
+
Then add it to your server's environment as `INFORMANT_API_KEY`
|
34
|
+
|
35
|
+
OR
|
36
|
+
|
37
|
+
Set it manually with an initializer (config/informant.rb)
|
38
|
+
InformantRails::Config.api_token = 'your token'
|
39
|
+
>
|
40
|
+
end
|
41
|
+
|
42
|
+
def bad_response_message(server_message)
|
43
|
+
"Seems like we have a problem. \"#{server_message}\" in this case."
|
44
|
+
end
|
45
|
+
|
46
|
+
def success_message
|
47
|
+
"Everything looks good. You should see a test request on your dashboard."
|
48
|
+
end
|
49
|
+
|
50
|
+
def assistance_message
|
51
|
+
"If you need assistance or have any questions, send an email to informantapp@gmail.com or tweet @informantapp and we'll help you out!"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
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.4.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-
|
12
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 3.0.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 3.0.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: typhoeus
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/informant-rails.rb
|
53
53
|
- lib/informant-rails/client.rb
|
54
54
|
- lib/informant-rails/config.rb
|
55
|
+
- lib/informant-rails/connection_tester.rb
|
55
56
|
- lib/informant-rails/field_error.rb
|
56
57
|
- lib/informant-rails/middleware.rb
|
57
58
|
- lib/informant-rails/model.rb
|
@@ -59,6 +60,7 @@ files:
|
|
59
60
|
- lib/informant-rails/railtie.rb
|
60
61
|
- lib/informant-rails/request.rb
|
61
62
|
- lib/informant-rails/version.rb
|
63
|
+
- lib/tasks/test_connection.rake
|
62
64
|
homepage: https://www.informantapp.com
|
63
65
|
licenses:
|
64
66
|
- GPL
|